aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/gcmp.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-09-09 11:01:03 (GMT)
committerJouni Malinen <j@w1.fi>2012-09-09 11:01:22 (GMT)
commitf1732956006118a1abd1e99be880e93cb44fbd1a (patch)
tree9cffee880cd990b4956ac1e1d7adad2e7f3c06dc /wlantest/gcmp.c
parentf90a4542b4095640c2da69b85a27ce230c14642c (diff)
downloadhostap-f1732956006118a1abd1e99be880e93cb44fbd1a.zip
hostap-f1732956006118a1abd1e99be880e93cb44fbd1a.tar.gz
hostap-f1732956006118a1abd1e99be880e93cb44fbd1a.tar.bz2
wlantest: Add GCMP-256 test vector
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest/gcmp.c')
-rw-r--r--wlantest/gcmp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/wlantest/gcmp.c b/wlantest/gcmp.c
index 5639b7e..d8535d0 100644
--- a/wlantest/gcmp.c
+++ b/wlantest/gcmp.c
@@ -73,7 +73,7 @@ static void gcmp_aad_nonce(const struct ieee80211_hdr *hdr, const u8 *data,
}
-u8 * gcmp_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
+u8 * gcmp_decrypt(const u8 *tk, size_t tk_len, const struct ieee80211_hdr *hdr,
const u8 *data, size_t data_len, size_t *decrypted_len)
{
u8 aad[30], nonce[12], *plain;
@@ -95,7 +95,7 @@ u8 * gcmp_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
wpa_hexdump(MSG_EXCESSIVE, "GCMP AAD", aad, aad_len);
wpa_hexdump(MSG_EXCESSIVE, "GCMP nonce", nonce, sizeof(nonce));
- if (aes_gcm_ad(tk, 16, nonce, sizeof(nonce), m, mlen, aad, aad_len,
+ if (aes_gcm_ad(tk, tk_len, nonce, sizeof(nonce), m, mlen, aad, aad_len,
m + mlen, plain) < 0) {
u16 seq_ctrl = le_to_host16(hdr->seq_ctrl);
wpa_printf(MSG_INFO, "Invalid GCMP frame: A1=" MACSTR
@@ -113,7 +113,8 @@ u8 * gcmp_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
}
-u8 * gcmp_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen, u8 *qos,
+u8 * gcmp_encrypt(const u8 *tk, size_t tk_len, u8 *frame, size_t len,
+ size_t hdrlen, u8 *qos,
u8 *pn, int keyid, size_t *encrypted_len)
{
u8 aad[30], nonce[12], *crypt, *pos;
@@ -146,8 +147,8 @@ u8 * gcmp_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen, u8 *qos,
wpa_hexdump(MSG_EXCESSIVE, "GCMP AAD", aad, aad_len);
wpa_hexdump(MSG_EXCESSIVE, "GCMP nonce", nonce, sizeof(nonce));
- if (aes_gcm_ae(tk, 16, nonce, sizeof(nonce), frame + hdrlen, plen, aad,
- aad_len, pos, pos + plen) < 0) {
+ if (aes_gcm_ae(tk, tk_len, nonce, sizeof(nonce), frame + hdrlen, plen,
+ aad, aad_len, pos, pos + plen) < 0) {
os_free(crypt);
return NULL;
}