aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-06 15:54:03 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:37 +0200
commite35abbe588636c5ca73d8aaa9082314289346bd9 (patch)
treeeece22634e08ca1ada844d640bb8d8c2d086e61a /src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
parentc3858662d2d1d431bdb453f2b50e63d9c2c5bfad (diff)
downloadstrongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.bz2
strongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.xz
Add a return value to crypter_t.encrypt
Diffstat (limited to 'src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c')
-rw-r--r--src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
index 6e4eff689..c5c531e31 100644
--- a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
+++ b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
@@ -337,9 +337,15 @@ static status_t ChallengeResponse(chunk_t challenge_hash, chunk_t password_hash,
for (i = 0; i < 3; i++)
{
chunk_t expanded, encrypted;
+
expanded = ExpandDESKey(keys[i]);
crypter->set_key(crypter, expanded);
- crypter->encrypt(crypter, challenge_hash, chunk_empty, &encrypted);
+ if (!crypter->encrypt(crypter, challenge_hash, chunk_empty, &encrypted))
+ {
+ chunk_clear(&expanded);
+ crypter->destroy(crypter);
+ return FAILED;
+ }
memcpy(&response->ptr[i * 8], encrypted.ptr, encrypted.len);
chunk_clear(&encrypted);
chunk_clear(&expanded);