]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ERP: Use macro for EMSKname length instead of hardcoded integer value
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 3 Feb 2017 12:41:39 +0000 (14:41 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 3 Feb 2017 13:35:21 +0000 (15:35 +0200)
While RFC 5295 uses "8" as the value to use in the length field in KDF
context when deriving EMSKname, it is clearer to use the macro defining
EMSKname as the value since the KDF design in RFC 5295 encodes the
length of the derived data in octets in that part of the context data.
This change is just making the implementation easier to understand while
not actually changing the behavior.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/eap_peer/eap.c
src/eap_server/eap_server.c

index cd43934d0cb4020f538a411dce658468fad125fe..15584a478b74820feaea77b994d602791ecd4530 100644 (file)
@@ -526,7 +526,7 @@ static void eap_peer_erp_init(struct eap_sm *sm)
 
        wpa_hexdump_key(MSG_DEBUG, "EAP: EMSK", emsk, emsk_len);
 
-       WPA_PUT_BE16(len, 8);
+       WPA_PUT_BE16(len, EAP_EMSK_NAME_LEN);
        if (hmac_sha256_kdf(sm->eapSessionId, sm->eapSessionIdLen, "EMSK",
                            len, sizeof(len),
                            EMSKname, EAP_EMSK_NAME_LEN) < 0) {
index ebfaa122fcdf685a67f5ecbfcdaef6239e126960..1b571cf59350a5a518abc96cdda26b707e7b5abd 100644 (file)
@@ -452,7 +452,7 @@ static void eap_server_erp_init(struct eap_sm *sm)
 
        wpa_hexdump_key(MSG_DEBUG, "EAP: EMSK", emsk, emsk_len);
 
-       WPA_PUT_BE16(len, 8);
+       WPA_PUT_BE16(len, EAP_EMSK_NAME_LEN);
        if (hmac_sha256_kdf(sm->eap_if.eapSessionId, sm->eap_if.eapSessionIdLen,
                            "EMSK", len, sizeof(len),
                            EMSKname, EAP_EMSK_NAME_LEN) < 0) {