aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer/eap_fast.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-02-28 01:58:46 (GMT)
committerJouni Malinen <j@w1.fi>2008-02-28 01:58:46 (GMT)
commit2bab8ae401b5a1ee38c801a51cddd892a05449e1 (patch)
treee13720d9ccd27edaf28e7ce818ffe0781324add5 /src/eap_peer/eap_fast.c
parented5a02fd945d3495f41ceae6f10a74ca72a01f8c (diff)
downloadhostap-2bab8ae401b5a1ee38c801a51cddd892a05449e1.zip
hostap-2bab8ae401b5a1ee38c801a51cddd892a05449e1.tar.gz
hostap-2bab8ae401b5a1ee38c801a51cddd892a05449e1.tar.bz2
EAP-FAST: Define and use EAP_FAST_CMK_LEN
Diffstat (limited to 'src/eap_peer/eap_fast.c')
-rw-r--r--src/eap_peer/eap_fast.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/eap_peer/eap_fast.c b/src/eap_peer/eap_fast.c
index 294554a..a94ed6c 100644
--- a/src/eap_peer/eap_fast.c
+++ b/src/eap_peer/eap_fast.c
@@ -596,7 +596,8 @@ static void eap_fast_write_crypto_binding(
rbind->subtype = EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE;
os_memcpy(rbind->nonce, _bind->nonce, sizeof(_bind->nonce));
inc_byte_array(rbind->nonce, sizeof(rbind->nonce));
- hmac_sha1(cmk, 20, (u8 *) rbind, sizeof(*rbind), rbind->compound_mac);
+ hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) rbind, sizeof(*rbind),
+ rbind->compound_mac);
wpa_printf(MSG_DEBUG, "EAP-FAST: Reply Crypto-Binding TLV: Version %d "
"Received Version %d SubType %d",
@@ -670,8 +671,9 @@ static int eap_fast_get_cmk(struct eap_sm *sm, struct eap_fast_data *data,
os_memcpy(data->simck, imck, EAP_FAST_SIMCK_LEN);
wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: S-IMCK[j]",
data->simck, EAP_FAST_SIMCK_LEN);
- os_memcpy(cmk, imck + EAP_FAST_SIMCK_LEN, 20);
- wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: CMK[j]", cmk, 20);
+ os_memcpy(cmk, imck + EAP_FAST_SIMCK_LEN, EAP_FAST_CMK_LEN);
+ wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: CMK[j]",
+ cmk, EAP_FAST_CMK_LEN);
return 0;
}
@@ -709,7 +711,7 @@ static struct wpabuf * eap_fast_process_crypto_binding(
struct wpabuf *resp;
u8 *pos;
struct eap_tlv_intermediate_result_tlv *rresult;
- u8 cmk[20], cmac[20];
+ u8 cmk[EAP_FAST_CMK_LEN], cmac[SHA1_MAC_LEN];
int res, req_tunnel_pac = 0;
size_t len;
@@ -724,7 +726,8 @@ static struct wpabuf * eap_fast_process_crypto_binding(
os_memset(_bind->compound_mac, 0, sizeof(cmac));
wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Crypto-Binding TLV for Compound "
"MAC calculation", (u8 *) _bind, bind_len);
- hmac_sha1(cmk, 20, (u8 *) _bind, bind_len, _bind->compound_mac);
+ hmac_sha1(cmk, EAP_FAST_CMK_LEN, (u8 *) _bind, bind_len,
+ _bind->compound_mac);
res = os_memcmp(cmac, _bind->compound_mac, sizeof(cmac));
wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Received Compound MAC",
cmac, sizeof(cmac));