Lines Matching refs:dctx
132 void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) in poly1305_init_arch() argument
134 poly1305_simd_init(&dctx->h, key); in poly1305_init_arch()
135 dctx->s[0] = get_unaligned_le32(&key[16]); in poly1305_init_arch()
136 dctx->s[1] = get_unaligned_le32(&key[20]); in poly1305_init_arch()
137 dctx->s[2] = get_unaligned_le32(&key[24]); in poly1305_init_arch()
138 dctx->s[3] = get_unaligned_le32(&key[28]); in poly1305_init_arch()
139 dctx->buflen = 0; in poly1305_init_arch()
140 dctx->sset = true; in poly1305_init_arch()
144 static unsigned int crypto_poly1305_setdctxkey(struct poly1305_desc_ctx *dctx, in crypto_poly1305_setdctxkey() argument
148 if (unlikely(!dctx->sset)) { in crypto_poly1305_setdctxkey()
149 if (!dctx->rset && len >= POLY1305_BLOCK_SIZE) { in crypto_poly1305_setdctxkey()
150 poly1305_simd_init(&dctx->h, inp); in crypto_poly1305_setdctxkey()
154 dctx->rset = 1; in crypto_poly1305_setdctxkey()
157 dctx->s[0] = get_unaligned_le32(&inp[0]); in crypto_poly1305_setdctxkey()
158 dctx->s[1] = get_unaligned_le32(&inp[4]); in crypto_poly1305_setdctxkey()
159 dctx->s[2] = get_unaligned_le32(&inp[8]); in crypto_poly1305_setdctxkey()
160 dctx->s[3] = get_unaligned_le32(&inp[12]); in crypto_poly1305_setdctxkey()
162 dctx->sset = true; in crypto_poly1305_setdctxkey()
168 void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src, in poly1305_update_arch() argument
173 if (unlikely(dctx->buflen)) { in poly1305_update_arch()
174 bytes = min(srclen, POLY1305_BLOCK_SIZE - dctx->buflen); in poly1305_update_arch()
175 memcpy(dctx->buf + dctx->buflen, src, bytes); in poly1305_update_arch()
178 dctx->buflen += bytes; in poly1305_update_arch()
180 if (dctx->buflen == POLY1305_BLOCK_SIZE) { in poly1305_update_arch()
181 if (likely(!crypto_poly1305_setdctxkey(dctx, dctx->buf, POLY1305_BLOCK_SIZE))) in poly1305_update_arch()
182 poly1305_simd_blocks(&dctx->h, dctx->buf, POLY1305_BLOCK_SIZE, 1); in poly1305_update_arch()
183 dctx->buflen = 0; in poly1305_update_arch()
190 used = crypto_poly1305_setdctxkey(dctx, src, bytes); in poly1305_update_arch()
192 poly1305_simd_blocks(&dctx->h, src + used, bytes - used, 1); in poly1305_update_arch()
197 dctx->buflen = srclen; in poly1305_update_arch()
198 memcpy(dctx->buf, src, srclen); in poly1305_update_arch()
203 void poly1305_final_arch(struct poly1305_desc_ctx *dctx, u8 *dst) in poly1305_final_arch() argument
205 if (unlikely(dctx->buflen)) { in poly1305_final_arch()
206 dctx->buf[dctx->buflen++] = 1; in poly1305_final_arch()
207 memset(dctx->buf + dctx->buflen, 0, in poly1305_final_arch()
208 POLY1305_BLOCK_SIZE - dctx->buflen); in poly1305_final_arch()
209 poly1305_simd_blocks(&dctx->h, dctx->buf, POLY1305_BLOCK_SIZE, 0); in poly1305_final_arch()
212 poly1305_simd_emit(&dctx->h, dst, dctx->s); in poly1305_final_arch()
213 memzero_explicit(dctx, sizeof(*dctx)); in poly1305_final_arch()
219 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_init() local
221 *dctx = (struct poly1305_desc_ctx){}; in crypto_poly1305_init()
228 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_update() local
230 poly1305_update_arch(dctx, src, srclen); in crypto_poly1305_update()
236 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc); in crypto_poly1305_final() local
238 if (unlikely(!dctx->sset)) in crypto_poly1305_final()
241 poly1305_final_arch(dctx, dst); in crypto_poly1305_final()