aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-11-13 11:29:17 +0200
committerJouni Malinen <j@w1.fi>2011-11-13 11:29:17 +0200
commit3724ddc0c10ab54b768cbd4044f7c215d97bf011 (patch)
treeb185e4b47de023f00b55c5276e78e762a54f4914 /src/eap_server
parentb6c8df695cb236c66a41ac1fe954698cc4286444 (diff)
downloadexternal_wpa_supplicant_8_ti-3724ddc0c10ab54b768cbd4044f7c215d97bf011.zip
external_wpa_supplicant_8_ti-3724ddc0c10ab54b768cbd4044f7c215d97bf011.tar.gz
external_wpa_supplicant_8_ti-3724ddc0c10ab54b768cbd4044f7c215d97bf011.tar.bz2
PEAP: Verify peap_prfplus() result
This function can fail in theory since the SHA-1 functions are allowed to return an error. While this does not really happen in practice (we would not get this far if SHA-1 does not work), it is cleaner to include the error handling here to keep static analyzers happier. [Bug 421] Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_server')
-rw-r--r--src/eap_server/eap_server_peap.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/eap_server/eap_server_peap.c b/src/eap_server/eap_server_peap.c
index 8a7d626..381c44a 100644
--- a/src/eap_server/eap_server_peap.c
+++ b/src/eap_server/eap_server_peap.c
@@ -351,8 +351,12 @@ static int eap_peap_derive_cmk(struct eap_sm *sm, struct eap_peap_data *data)
* in the end of the label just before ISK; is that just a typo?)
*/
wpa_hexdump_key(MSG_DEBUG, "EAP-PEAP: TempKey", tk, 40);
- peap_prfplus(data->peap_version, tk, 40, "Inner Methods Compound Keys",
- isk, sizeof(isk), imck, sizeof(imck));
+ if (peap_prfplus(data->peap_version, tk, 40,
+ "Inner Methods Compound Keys",
+ isk, sizeof(isk), imck, sizeof(imck)) < 0) {
+ os_free(tk);
+ return -1;
+ }
wpa_hexdump_key(MSG_DEBUG, "EAP-PEAP: IMCK (IPMKj)",
imck, sizeof(imck));
@@ -1320,9 +1324,10 @@ static u8 * eap_peap_getKey(struct eap_sm *sm, void *priv, size_t *len)
* termination for this label while the one used for deriving
* IPMK|CMK did not use null termination.
*/
- peap_prfplus(data->peap_version, data->ipmk, 40,
- "Session Key Generating Function",
- (u8 *) "\00", 1, csk, sizeof(csk));
+ if (peap_prfplus(data->peap_version, data->ipmk, 40,
+ "Session Key Generating Function",
+ (u8 *) "\00", 1, csk, sizeof(csk)) < 0)
+ return NULL;
wpa_hexdump_key(MSG_DEBUG, "EAP-PEAP: CSK", csk, sizeof(csk));
eapKeyData = os_malloc(EAP_TLS_KEY_LEN);
if (eapKeyData) {