Lines Matching refs:DTLS_CCM_BLOCKSIZE
43 memset((A) + DTLS_CCM_BLOCKSIZE - (L), 0, (L)); \
45 for (i = DTLS_CCM_BLOCKSIZE - 1; (C) && (i > (L)); --i, (C) >>= 8) \
54 unsigned char nonce[DTLS_CCM_BLOCKSIZE], in block0() argument
61 memcpy(result + 1, nonce, DTLS_CCM_BLOCKSIZE - L); in block0()
85 unsigned char B[DTLS_CCM_BLOCKSIZE], in add_auth_data() argument
86 unsigned char X[DTLS_CCM_BLOCKSIZE]) { in add_auth_data() argument
91 memset(B, 0, DTLS_CCM_BLOCKSIZE); in add_auth_data()
122 i = min(DTLS_CCM_BLOCKSIZE - j, la); in add_auth_data()
127 memxor(B, X, DTLS_CCM_BLOCKSIZE); in add_auth_data()
131 while (la > DTLS_CCM_BLOCKSIZE) { in add_auth_data()
132 for (i = 0; i < DTLS_CCM_BLOCKSIZE; ++i) in add_auth_data()
134 la -= DTLS_CCM_BLOCKSIZE; in add_auth_data()
140 memset(B, 0, DTLS_CCM_BLOCKSIZE); in add_auth_data()
142 memxor(B, X, DTLS_CCM_BLOCKSIZE); in add_auth_data()
151 unsigned char A[DTLS_CCM_BLOCKSIZE], in encrypt() argument
152 unsigned char S[DTLS_CCM_BLOCKSIZE]) { in encrypt() argument
164 unsigned char B[DTLS_CCM_BLOCKSIZE], in mac() argument
165 unsigned char X[DTLS_CCM_BLOCKSIZE]) { in mac() argument
177 unsigned char nonce[DTLS_CCM_BLOCKSIZE], in dtls_ccm_encrypt_message() argument
184 unsigned char A[DTLS_CCM_BLOCKSIZE]; /* A_i blocks for encryption input */ in dtls_ccm_encrypt_message()
185 unsigned char B[DTLS_CCM_BLOCKSIZE]; /* B_i blocks for CBC-MAC input */ in dtls_ccm_encrypt_message()
186 unsigned char S[DTLS_CCM_BLOCKSIZE]; /* S_i = encrypted A_i blocks */ in dtls_ccm_encrypt_message()
187 unsigned char X[DTLS_CCM_BLOCKSIZE]; /* X_i = encrypted B_i blocks */ in dtls_ccm_encrypt_message()
198 memcpy(A + 1, nonce, DTLS_CCM_BLOCKSIZE - L); in dtls_ccm_encrypt_message()
200 while (lm >= DTLS_CCM_BLOCKSIZE) { in dtls_ccm_encrypt_message()
202 mac(ctx, msg, DTLS_CCM_BLOCKSIZE, B, X); in dtls_ccm_encrypt_message()
205 encrypt(ctx, L, counter, msg, DTLS_CCM_BLOCKSIZE, A, S); in dtls_ccm_encrypt_message()
208 lm -= DTLS_CCM_BLOCKSIZE; in dtls_ccm_encrypt_message()
209 msg += DTLS_CCM_BLOCKSIZE; in dtls_ccm_encrypt_message()
219 memcpy(B + lm, X + lm, DTLS_CCM_BLOCKSIZE - lm); in dtls_ccm_encrypt_message()
241 unsigned char nonce[DTLS_CCM_BLOCKSIZE], in dtls_ccm_decrypt_message() argument
249 unsigned char A[DTLS_CCM_BLOCKSIZE]; /* A_i blocks for encryption input */ in dtls_ccm_decrypt_message()
250 unsigned char B[DTLS_CCM_BLOCKSIZE]; /* B_i blocks for CBC-MAC input */ in dtls_ccm_decrypt_message()
251 unsigned char S[DTLS_CCM_BLOCKSIZE]; /* S_i = encrypted A_i blocks */ in dtls_ccm_decrypt_message()
252 unsigned char X[DTLS_CCM_BLOCKSIZE]; /* X_i = encrypted B_i blocks */ in dtls_ccm_decrypt_message()
268 memcpy(A + 1, nonce, DTLS_CCM_BLOCKSIZE - L); in dtls_ccm_decrypt_message()
270 while (lm >= DTLS_CCM_BLOCKSIZE) { in dtls_ccm_decrypt_message()
272 encrypt(ctx, L, counter, msg, DTLS_CCM_BLOCKSIZE, A, S); in dtls_ccm_decrypt_message()
275 mac(ctx, msg, DTLS_CCM_BLOCKSIZE, B, X); in dtls_ccm_decrypt_message()
278 lm -= DTLS_CCM_BLOCKSIZE; in dtls_ccm_decrypt_message()
279 msg += DTLS_CCM_BLOCKSIZE; in dtls_ccm_decrypt_message()
292 memcpy(B + lm, X + lm, DTLS_CCM_BLOCKSIZE - lm); in dtls_ccm_decrypt_message()