aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_common
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-01-06 19:12:08 (GMT)
committerJouni Malinen <j@w1.fi>2016-01-06 19:12:08 (GMT)
commit7a36f1184ec88dfaecefecc5cf2946cedcedb1a5 (patch)
tree889c7f30efb425410e1f93f63544a6de70b9ef0e /src/eap_common
parent1e35aa15a4796190f3ffad904be6eb837165f589 (diff)
downloadhostap-7a36f1184ec88dfaecefecc5cf2946cedcedb1a5.zip
hostap-7a36f1184ec88dfaecefecc5cf2946cedcedb1a5.tar.gz
hostap-7a36f1184ec88dfaecefecc5cf2946cedcedb1a5.tar.bz2
EAP-PAX: Check hmac_sha1_vector() return value
This function can fail at least in theory, so check its return value before proceeding. This is mainly helping automated test case coverage to reach some more error paths. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_common')
-rw-r--r--src/eap_common/eap_pax_common.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/eap_common/eap_pax_common.c b/src/eap_common/eap_pax_common.c
index 0e80ef5..a11bce8 100644
--- a/src/eap_common/eap_pax_common.c
+++ b/src/eap_common/eap_pax_common.c
@@ -57,7 +57,8 @@ int eap_pax_kdf(u8 mac_id, const u8 *key, size_t key_len,
left = output_len;
for (counter = 1; counter <= (u8) num_blocks; counter++) {
size_t clen = left > EAP_PAX_MAC_LEN ? EAP_PAX_MAC_LEN : left;
- hmac_sha1_vector(key, key_len, 3, addr, len, mac);
+ if (hmac_sha1_vector(key, key_len, 3, addr, len, mac) < 0)
+ return -1;
os_memcpy(pos, mac, clen);
pos += clen;
left -= clen;
@@ -106,7 +107,8 @@ int eap_pax_mac(u8 mac_id, const u8 *key, size_t key_len,
len[2] = data3_len;
count = (data1 ? 1 : 0) + (data2 ? 1 : 0) + (data3 ? 1 : 0);
- hmac_sha1_vector(key, key_len, count, addr, len, hash);
+ if (hmac_sha1_vector(key, key_len, count, addr, len, hash) < 0)
+ return -1;
os_memcpy(mac, hash, EAP_PAX_MAC_LEN);
return 0;