aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_common
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-10-17 17:19:52 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-17 17:40:01 (GMT)
commit0504d2da12b300967229a0a695fe481337d02f0a (patch)
tree3de01f791056e7782a8dc7f228c021b61c89f254 /src/eap_common
parent2ab957afc5352dd6d54e78874eb1605904b433bb (diff)
downloadhostap-0504d2da12b300967229a0a695fe481337d02f0a.zip
hostap-0504d2da12b300967229a0a695fe481337d02f0a.tar.gz
hostap-0504d2da12b300967229a0a695fe481337d02f0a.tar.bz2
EAP-GPSK: Check HMAC-SHA256 result in GKDF and MIC
hmac_sha256() and hmac_sha256_vector() return a result code now, so use that return value to terminate HMAC-SHA256-based GKDF/MIC similarly to what was already done with the CMAC-based GKDF/MIC. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_common')
-rw-r--r--src/eap_common/eap_gpsk_common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/eap_common/eap_gpsk_common.c b/src/eap_common/eap_gpsk_common.c
index 8c7ae27..b081879 100644
--- a/src/eap_common/eap_gpsk_common.c
+++ b/src/eap_common/eap_gpsk_common.c
@@ -92,7 +92,8 @@ static int eap_gpsk_gkdf_sha256(const u8 *psk /* Y */,
n = (len + hashlen - 1) / hashlen;
for (i = 1; i <= n; i++) {
WPA_PUT_BE16(ibuf, i);
- hmac_sha256_vector(psk, 32, 2, addr, vlen, hash);
+ if (hmac_sha256_vector(psk, 32, 2, addr, vlen, hash))
+ return -1;
clen = left > hashlen ? hashlen : left;
os_memcpy(opos, hash, clen);
opos += clen;
@@ -534,8 +535,7 @@ int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor,
break;
#ifdef EAP_GPSK_SHA256
case EAP_GPSK_CIPHER_SHA256:
- hmac_sha256(sk, sk_len, data, len, mic);
- ret = 0;
+ ret = hmac_sha256(sk, sk_len, data, len, mic);
break;
#endif /* EAP_GPSK_SHA256 */
default:
@@ -545,5 +545,8 @@ int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor,
break;
}
+ if (ret)
+ wpa_printf(MSG_DEBUG, "EAP-GPSK: Could not compute MIC");
+
return ret;
}