]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Fix CCMP-256 cipher
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 5 Apr 2013 19:18:25 +0000 (22:18 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 5 Apr 2013 19:18:25 +0000 (22:18 +0300)
TK was incorrectly truncated in a way that resulted in CCMP (128-bit
key) encryption being used in practice.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wlantest/ccmp.c

index d7a0e658461af2b9a26b59c92999802b00cff402..ee1f1a67cb8692284d855cea2f082a4e92e0eb95 100644 (file)
@@ -199,7 +199,7 @@ u8 * ccmp_256_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
        wpa_hexdump(MSG_EXCESSIVE, "CCMP-256 AAD", aad, aad_len);
        wpa_hexdump(MSG_EXCESSIVE, "CCMP-256 nonce", nonce, 13);
 
-       if (aes_ccm_ad(tk, 16, nonce, 16, data + 8, mlen, aad, aad_len,
+       if (aes_ccm_ad(tk, 32, nonce, 16, data + 8, mlen, aad, aad_len,
                       data + 8 + mlen, plain) < 0) {
                u16 seq_ctrl = le_to_host16(hdr->seq_ctrl);
                wpa_printf(MSG_INFO, "Invalid CCMP-256 MIC in frame: A1=" MACSTR
@@ -252,7 +252,7 @@ u8 * ccmp_256_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen,
        wpa_hexdump(MSG_EXCESSIVE, "CCMP-256 AAD", aad, aad_len);
        wpa_hexdump(MSG_EXCESSIVE, "CCMP-256 nonce", nonce, 13);
 
-       if (aes_ccm_ae(tk, 16, nonce, 16, frame + hdrlen, plen, aad, aad_len,
+       if (aes_ccm_ae(tk, 32, nonce, 16, frame + hdrlen, plen, aad, aad_len,
                       pos, pos + plen) < 0) {
                os_free(crypt);
                return NULL;