Lines Matching refs:len

18     unsigned int len;  in chacha_poly1305_tls_init()  local
25 len = aad[EVP_AEAD_TLS1_AAD_LEN - 2] << 8 | aad[EVP_AEAD_TLS1_AAD_LEN - 1]; in chacha_poly1305_tls_init()
28 if (len < POLY1305_BLOCK_SIZE) in chacha_poly1305_tls_init()
30 len -= POLY1305_BLOCK_SIZE; /* discount attached tag */ in chacha_poly1305_tls_init()
31 aad[EVP_AEAD_TLS1_AAD_LEN - 2] = (unsigned char)(len >> 8); in chacha_poly1305_tls_init()
32 aad[EVP_AEAD_TLS1_AAD_LEN - 1] = (unsigned char)len; in chacha_poly1305_tls_init()
34 ctx->tls_payload_length = len; in chacha_poly1305_tls_init()
63 ctx->len.aad = 0; in chacha20_poly1305_initkey()
64 ctx->len.text = 0; in chacha20_poly1305_initkey()
82 ctx->len.aad = 0; in chacha20_poly1305_initiv()
83 ctx->len.text = 0; in chacha20_poly1305_initiv()
110 void *xor128_encrypt_n_pad(void *out, const void *inp, void *otp, size_t len);
111 void *xor128_decrypt_n_pad(void *out, const void *inp, void *otp, size_t len);
120 const unsigned char *in, size_t len) in chacha20_poly1305_tls_cipher() argument
142 ctx->len.aad = EVP_AEAD_TLS1_AAD_LEN; in chacha20_poly1305_tls_cipher()
143 ctx->len.text = plen; in chacha20_poly1305_tls_cipher()
167 ctx->len.aad = EVP_AEAD_TLS1_AAD_LEN; in chacha20_poly1305_tls_cipher()
168 ctx->len.text = plen; in chacha20_poly1305_tls_cipher()
201 ctx->len.aad = EVP_AEAD_TLS1_AAD_LEN; in chacha20_poly1305_tls_cipher()
202 ctx->len.text = plen; in chacha20_poly1305_tls_cipher()
219 memcpy(ctr, (unsigned char *)&ctx->len, POLY1305_BLOCK_SIZE); in chacha20_poly1305_tls_cipher()
221 ctr[0] = (unsigned char)(ctx->len.aad); in chacha20_poly1305_tls_cipher()
222 ctr[1] = (unsigned char)(ctx->len.aad>>8); in chacha20_poly1305_tls_cipher()
223 ctr[2] = (unsigned char)(ctx->len.aad>>16); in chacha20_poly1305_tls_cipher()
224 ctr[3] = (unsigned char)(ctx->len.aad>>24); in chacha20_poly1305_tls_cipher()
225 ctr[4] = (unsigned char)(ctx->len.aad>>32); in chacha20_poly1305_tls_cipher()
226 ctr[5] = (unsigned char)(ctx->len.aad>>40); in chacha20_poly1305_tls_cipher()
227 ctr[6] = (unsigned char)(ctx->len.aad>>48); in chacha20_poly1305_tls_cipher()
228 ctr[7] = (unsigned char)(ctx->len.aad>>56); in chacha20_poly1305_tls_cipher()
230 ctr[8] = (unsigned char)(ctx->len.text); in chacha20_poly1305_tls_cipher()
231 ctr[9] = (unsigned char)(ctx->len.text>>8); in chacha20_poly1305_tls_cipher()
232 ctr[10] = (unsigned char)(ctx->len.text>>16); in chacha20_poly1305_tls_cipher()
233 ctr[11] = (unsigned char)(ctx->len.text>>24); in chacha20_poly1305_tls_cipher()
234 ctr[12] = (unsigned char)(ctx->len.text>>32); in chacha20_poly1305_tls_cipher()
235 ctr[13] = (unsigned char)(ctx->len.text>>40); in chacha20_poly1305_tls_cipher()
236 ctr[14] = (unsigned char)(ctx->len.text>>48); in chacha20_poly1305_tls_cipher()
237 ctr[15] = (unsigned char)(ctx->len.text>>56); in chacha20_poly1305_tls_cipher()
251 if (len > POLY1305_BLOCK_SIZE) in chacha20_poly1305_tls_cipher()
252 memset(out - (len - POLY1305_BLOCK_SIZE), 0, in chacha20_poly1305_tls_cipher()
253 len - POLY1305_BLOCK_SIZE); in chacha20_poly1305_tls_cipher()
257 len -= POLY1305_BLOCK_SIZE; in chacha20_poly1305_tls_cipher()
260 *out_padlen = len; in chacha20_poly1305_tls_cipher()
294 ctx->len.aad = ctx->len.text = 0; in chacha20_poly1305_aead_cipher()
298 ctx->len.aad = EVP_AEAD_TLS1_AAD_LEN; in chacha20_poly1305_aead_cipher()
306 ctx->len.aad += inl; in chacha20_poly1305_aead_cipher()
311 if ((rem = (size_t)ctx->len.aad % POLY1305_BLOCK_SIZE)) in chacha20_poly1305_aead_cipher()
327 ctx->len.text += plen; in chacha20_poly1305_aead_cipher()
333 ctx->len.text += plen; in chacha20_poly1305_aead_cipher()
343 if ((rem = (size_t)ctx->len.aad % POLY1305_BLOCK_SIZE)) in chacha20_poly1305_aead_cipher()
348 if ((rem = (size_t)ctx->len.text % POLY1305_BLOCK_SIZE)) in chacha20_poly1305_aead_cipher()
352 Poly1305_Update(poly, (unsigned char *)&ctx->len, in chacha20_poly1305_aead_cipher()
355 temp[0] = (unsigned char)(ctx->len.aad); in chacha20_poly1305_aead_cipher()
356 temp[1] = (unsigned char)(ctx->len.aad>>8); in chacha20_poly1305_aead_cipher()
357 temp[2] = (unsigned char)(ctx->len.aad>>16); in chacha20_poly1305_aead_cipher()
358 temp[3] = (unsigned char)(ctx->len.aad>>24); in chacha20_poly1305_aead_cipher()
359 temp[4] = (unsigned char)(ctx->len.aad>>32); in chacha20_poly1305_aead_cipher()
360 temp[5] = (unsigned char)(ctx->len.aad>>40); in chacha20_poly1305_aead_cipher()
361 temp[6] = (unsigned char)(ctx->len.aad>>48); in chacha20_poly1305_aead_cipher()
362 temp[7] = (unsigned char)(ctx->len.aad>>56); in chacha20_poly1305_aead_cipher()
363 temp[8] = (unsigned char)(ctx->len.text); in chacha20_poly1305_aead_cipher()
364 temp[9] = (unsigned char)(ctx->len.text>>8); in chacha20_poly1305_aead_cipher()
365 temp[10] = (unsigned char)(ctx->len.text>>16); in chacha20_poly1305_aead_cipher()
366 temp[11] = (unsigned char)(ctx->len.text>>24); in chacha20_poly1305_aead_cipher()
367 temp[12] = (unsigned char)(ctx->len.text>>32); in chacha20_poly1305_aead_cipher()
368 temp[13] = (unsigned char)(ctx->len.text>>40); in chacha20_poly1305_aead_cipher()
369 temp[14] = (unsigned char)(ctx->len.text>>48); in chacha20_poly1305_aead_cipher()
370 temp[15] = (unsigned char)(ctx->len.text>>56); in chacha20_poly1305_aead_cipher()