POLY1305_BLOCK_SIZE
unsigned char tag[POLY1305_BLOCK_SIZE];
unsigned char tls_aad[POLY1305_BLOCK_SIZE];
if (len != plen + POLY1305_BLOCK_SIZE)
tohash = buf + CHACHA_BLK_SIZE - POLY1305_BLOCK_SIZE;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
tail = (0 - i) & (POLY1305_BLOCK_SIZE - 1);
Poly1305_Update(POLY1305_ctx(actx), actx->tls_aad, POLY1305_BLOCK_SIZE);
tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
memcpy(ctr, (unsigned char *)&actx->len, POLY1305_BLOCK_SIZE);
tohash_len += POLY1305_BLOCK_SIZE;
memcpy(out, actx->tag, POLY1305_BLOCK_SIZE);
if (CRYPTO_memcmp(tohash, in, POLY1305_BLOCK_SIZE)) {
memset(out - (len - POLY1305_BLOCK_SIZE), 0,
len - POLY1305_BLOCK_SIZE);
if ((rem = (size_t)actx->len.aad % POLY1305_BLOCK_SIZE))
POLY1305_BLOCK_SIZE - rem);
else if (len != plen + POLY1305_BLOCK_SIZE)
unsigned char temp[POLY1305_BLOCK_SIZE];
if ((rem = (size_t)actx->len.aad % POLY1305_BLOCK_SIZE))
POLY1305_BLOCK_SIZE - rem);
if ((rem = (size_t)actx->len.text % POLY1305_BLOCK_SIZE))
POLY1305_BLOCK_SIZE - rem);
(unsigned char *)&actx->len, POLY1305_BLOCK_SIZE);
Poly1305_Update(POLY1305_ctx(actx), temp, POLY1305_BLOCK_SIZE);
memcpy(out, actx->tag, POLY1305_BLOCK_SIZE);
if (CRYPTO_memcmp(temp, in, POLY1305_BLOCK_SIZE)) {
memset(actx->tls_aad, 0, POLY1305_BLOCK_SIZE);
if (arg <= 0 || arg > POLY1305_BLOCK_SIZE)
if (arg <= 0 || arg > POLY1305_BLOCK_SIZE || !EVP_CIPHER_CTX_is_encrypting(ctx))
if (len < POLY1305_BLOCK_SIZE)
len -= POLY1305_BLOCK_SIZE; /* discount attached tag */
return POLY1305_BLOCK_SIZE; /* tag length */
while (len >= POLY1305_BLOCK_SIZE) {
inp += POLY1305_BLOCK_SIZE;
len -= POLY1305_BLOCK_SIZE;
while (len >= POLY1305_BLOCK_SIZE) {
inp += POLY1305_BLOCK_SIZE;
len -= POLY1305_BLOCK_SIZE;
rem = POLY1305_BLOCK_SIZE - num;
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
rem = len % POLY1305_BLOCK_SIZE;
if (len >= POLY1305_BLOCK_SIZE) {
while (num < POLY1305_BLOCK_SIZE)
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0);
inp += POLY1305_BLOCK_SIZE;
len -= POLY1305_BLOCK_SIZE;
while (len >= POLY1305_BLOCK_SIZE) {
unsigned char data[POLY1305_BLOCK_SIZE];
if (p->data_size == 0 || p->data_size > POLY1305_BLOCK_SIZE) {
if (p->data_size == 0 || p->data_size > POLY1305_BLOCK_SIZE) {
unsigned char tag[POLY1305_BLOCK_SIZE];
unsigned char tls_aad[POLY1305_BLOCK_SIZE];
tohash = buf + CHACHA_BLK_SIZE - POLY1305_BLOCK_SIZE;
memcpy(tohash, ctx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
memcpy(tohash, ctx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
tail = (0 - i) & (POLY1305_BLOCK_SIZE - 1);
Poly1305_Update(poly, ctx->tls_aad, POLY1305_BLOCK_SIZE);
tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
memcpy(ctr, (unsigned char *)&ctx->len, POLY1305_BLOCK_SIZE);
tohash_len += POLY1305_BLOCK_SIZE;
memcpy(out, ctx->tag, POLY1305_BLOCK_SIZE);
if (CRYPTO_memcmp(tohash, in, POLY1305_BLOCK_SIZE)) {
if (len > POLY1305_BLOCK_SIZE)
memset(out - (len - POLY1305_BLOCK_SIZE), 0,
len - POLY1305_BLOCK_SIZE);
len -= POLY1305_BLOCK_SIZE;
if (len < POLY1305_BLOCK_SIZE)
if (inl != plen + POLY1305_BLOCK_SIZE)
len -= POLY1305_BLOCK_SIZE; /* discount attached tag */
if ((rem = (size_t)ctx->len.aad % POLY1305_BLOCK_SIZE))
Poly1305_Update(poly, zero, POLY1305_BLOCK_SIZE - rem);
else if (inl != plen + POLY1305_BLOCK_SIZE)
unsigned char temp[POLY1305_BLOCK_SIZE];
if ((rem = (size_t)ctx->len.aad % POLY1305_BLOCK_SIZE))
Poly1305_Update(poly, zero, POLY1305_BLOCK_SIZE - rem);
if ((rem = (size_t)ctx->len.text % POLY1305_BLOCK_SIZE))
Poly1305_Update(poly, zero, POLY1305_BLOCK_SIZE - rem);
POLY1305_BLOCK_SIZE);
Poly1305_Update(poly, temp, POLY1305_BLOCK_SIZE);
memcpy(out, ctx->tag, POLY1305_BLOCK_SIZE);
if (CRYPTO_memcmp(temp, in, POLY1305_BLOCK_SIZE)) {
inl -= POLY1305_BLOCK_SIZE;
return POLY1305_BLOCK_SIZE; /* tag length */
rem = len % POLY1305_BLOCK_SIZE;
if (len >= POLY1305_BLOCK_SIZE) {
while (num < POLY1305_BLOCK_SIZE)
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0);
.blocksize = POLY1305_BLOCK_SIZE,
rem = POLY1305_BLOCK_SIZE - num;
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
unsigned char data[POLY1305_BLOCK_SIZE];