Lines Matching full:aes

2  * Counter with CBC-MAC (CCM) with AES
13 #include "aes.h"
28 static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce, in aes_ccm_auth_start() argument
44 aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */ in aes_ccm_auth_start()
54 aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */ in aes_ccm_auth_start()
59 aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x); in aes_ccm_auth_start()
64 static void aes_ccm_auth(void *aes, const u8 *data, size_t len, u8 *x) in aes_ccm_auth() argument
73 aes_encrypt(aes, x, x); in aes_ccm_auth()
79 aes_encrypt(aes, x, x); in aes_ccm_auth()
92 static void aes_ccm_encr(void *aes, size_t L, const u8 *in, size_t len, u8 *out, in aes_ccm_encr() argument
102 aes_encrypt(aes, a, out); in aes_ccm_encr()
109 aes_encrypt(aes, a, out); 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
125 aes_encrypt(aes, a, tmp); 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
140 aes_encrypt(aes, a, tmp); in aes_ccm_decr_auth()
147 /* AES-CCM with fixed L=2 and aad_len <= 30 assumption */
153 void *aes; in aes_ccm_ae() local
159 aes = aes_encrypt_init(key, key_len); in aes_ccm_ae()
160 if (aes == NULL) in aes_ccm_ae()
163 aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, plain_len, x); in aes_ccm_ae()
164 aes_ccm_auth(aes, plain, plain_len, x); in aes_ccm_ae()
168 aes_ccm_encr(aes, L, plain, plain_len, crypt, a); in aes_ccm_ae()
169 aes_ccm_encr_auth(aes, M, x, a, auth); in aes_ccm_ae()
171 aes_encrypt_deinit(aes); in aes_ccm_ae()
177 /* AES-CCM with fixed L=2 and aad_len <= 30 assumption */
183 void *aes; in aes_ccm_ad() local
190 aes = aes_encrypt_init(key, key_len); in aes_ccm_ad()
191 if (aes == NULL) in aes_ccm_ad()
196 aes_ccm_decr_auth(aes, M, a, auth, t); in aes_ccm_ad()
199 aes_ccm_encr(aes, L, crypt, crypt_len, plain, a); in aes_ccm_ad()
201 aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, crypt_len, x); in aes_ccm_ad()
202 aes_ccm_auth(aes, plain, crypt_len, x); in aes_ccm_ad()
204 aes_encrypt_deinit(aes); in aes_ccm_ad()