Lines Matching +full:common +full:- +full:auth

2  * Counter with CBC-MAC (CCM) with AES
4 * Copyright (c) 2010-2012, Jouni Malinen <j@w1.fi>
12 #include "common.h"
38 b[0] |= (((M - 2) / 2) /* M' */ << 3); in aes_ccm_auth_start()
39 b[0] |= (L - 1) /* L' */; in aes_ccm_auth_start()
40 os_memcpy(&b[1], nonce, 15 - L); in aes_ccm_auth_start()
41 WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len); in aes_ccm_auth_start()
51 os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len); in aes_ccm_auth_start()
56 if (aad_len > AES_BLOCK_SIZE - 2) { in aes_ccm_auth_start()
76 /* XOR zero-padded last block */ in aes_ccm_auth()
87 a[0] = L - 1; /* Flags = L' */ in aes_ccm_encr_start()
88 os_memcpy(&a[1], nonce, 15 - L); in aes_ccm_encr_start()
100 WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i); in aes_ccm_encr()
108 WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i); in aes_ccm_encr()
110 /* XOR zero-padded last block */ in aes_ccm_encr()
117 static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth) in aes_ccm_encr_auth() argument
124 WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); in aes_ccm_encr_auth()
127 auth[i] = x[i] ^ tmp[i]; in aes_ccm_encr_auth()
128 wpa_hexdump_key(MSG_EXCESSIVE, "CCM U", auth, M); in aes_ccm_encr_auth()
132 static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t) in aes_ccm_decr_auth() argument
137 wpa_hexdump_key(MSG_EXCESSIVE, "CCM U", auth, M); in aes_ccm_decr_auth()
139 WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0); in aes_ccm_decr_auth()
142 t[i] = auth[i] ^ tmp[i]; in aes_ccm_decr_auth()
147 /* AES-CCM with fixed L=2 and aad_len <= 30 assumption */
150 const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth) in aes_ccm_ae() argument
157 return -1; in aes_ccm_ae()
161 return -1; in aes_ccm_ae()
169 aes_ccm_encr_auth(aes, M, x, a, auth); in aes_ccm_ae()
177 /* AES-CCM with fixed L=2 and aad_len <= 30 assumption */
180 const u8 *aad, size_t aad_len, const u8 *auth, u8 *plain) in aes_ccm_ad() argument
188 return -1; in aes_ccm_ad()
192 return -1; in aes_ccm_ad()
196 aes_ccm_decr_auth(aes, M, a, auth, t); in aes_ccm_ad()
207 wpa_printf(MSG_EXCESSIVE, "CCM: Auth mismatch"); in aes_ccm_ad()
208 return -1; in aes_ccm_ad()