Lines Matching refs:dctx
39 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_p10_init() local
41 poly1305_core_init(&dctx->h); in crypto_poly1305_p10_init()
42 dctx->buflen = 0; in crypto_poly1305_p10_init()
43 dctx->rset = 0; in crypto_poly1305_p10_init()
44 dctx->sset = false; in crypto_poly1305_p10_init()
49 static unsigned int crypto_poly1305_setdctxkey(struct poly1305_desc_ctx *dctx, in crypto_poly1305_setdctxkey() argument
54 if (unlikely(!dctx->sset)) { in crypto_poly1305_setdctxkey()
55 if (!dctx->rset && len >= POLY1305_BLOCK_SIZE) { in crypto_poly1305_setdctxkey()
56 struct poly1305_core_key *key = &dctx->core_r; in crypto_poly1305_setdctxkey()
63 dctx->rset = 1; in crypto_poly1305_setdctxkey()
66 dctx->s[0] = get_unaligned_le32(&inp[0]); in crypto_poly1305_setdctxkey()
67 dctx->s[1] = get_unaligned_le32(&inp[4]); in crypto_poly1305_setdctxkey()
68 dctx->s[2] = get_unaligned_le32(&inp[8]); in crypto_poly1305_setdctxkey()
69 dctx->s[3] = get_unaligned_le32(&inp[12]); in crypto_poly1305_setdctxkey()
71 dctx->sset = true; in crypto_poly1305_setdctxkey()
80 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_p10_update() local
83 if (unlikely(dctx->buflen)) { in crypto_poly1305_p10_update()
84 bytes = min(srclen, POLY1305_BLOCK_SIZE - dctx->buflen); in crypto_poly1305_p10_update()
85 memcpy(dctx->buf + dctx->buflen, src, bytes); in crypto_poly1305_p10_update()
88 dctx->buflen += bytes; in crypto_poly1305_p10_update()
90 if (dctx->buflen == POLY1305_BLOCK_SIZE) { in crypto_poly1305_p10_update()
91 if (likely(!crypto_poly1305_setdctxkey(dctx, dctx->buf, in crypto_poly1305_p10_update()
94 poly1305_64s(&dctx->h, dctx->buf, in crypto_poly1305_p10_update()
98 dctx->buflen = 0; in crypto_poly1305_p10_update()
104 used = crypto_poly1305_setdctxkey(dctx, src, bytes); in crypto_poly1305_p10_update()
111 poly1305_p10le_4blocks(&dctx->h, src, srclen); in crypto_poly1305_p10_update()
118 poly1305_64s(&dctx->h, src, POLY1305_BLOCK_SIZE, 1); in crypto_poly1305_p10_update()
126 dctx->buflen = srclen; in crypto_poly1305_p10_update()
127 memcpy(dctx->buf, src, srclen); in crypto_poly1305_p10_update()
135 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_p10_final() local
137 if (unlikely(!dctx->sset)) in crypto_poly1305_p10_final()
140 if ((dctx->buflen)) { in crypto_poly1305_p10_final()
141 dctx->buf[dctx->buflen++] = 1; in crypto_poly1305_p10_final()
142 memset(dctx->buf + dctx->buflen, 0, in crypto_poly1305_p10_final()
143 POLY1305_BLOCK_SIZE - dctx->buflen); in crypto_poly1305_p10_final()
145 poly1305_64s(&dctx->h, dctx->buf, POLY1305_BLOCK_SIZE, 0); in crypto_poly1305_p10_final()
147 dctx->buflen = 0; in crypto_poly1305_p10_final()
150 poly1305_emit_64(&dctx->h, &dctx->s, dst); in crypto_poly1305_p10_final()