Home | History | Annotate | Download | only in crypto

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