Lines Matching refs:dctx
20 void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE])
22 poly1305_init_mips(&dctx->h, key);
23 dctx->s[0] = get_unaligned_le32(key + 16);
24 dctx->s[1] = get_unaligned_le32(key + 20);
25 dctx->s[2] = get_unaligned_le32(key + 24);
26 dctx->s[3] = get_unaligned_le32(key + 28);
27 dctx->buflen = 0;
33 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc);
35 dctx->buflen = 0;
36 dctx->rset = 0;
37 dctx->sset = false;
42 static void mips_poly1305_blocks(struct poly1305_desc_ctx *dctx, const u8 *src,
45 if (unlikely(!dctx->sset)) {
46 if (!dctx->rset) {
47 poly1305_init_mips(&dctx->h, src);
50 dctx->rset = 1;
53 dctx->s[0] = get_unaligned_le32(src + 0);
54 dctx->s[1] = get_unaligned_le32(src + 4);
55 dctx->s[2] = get_unaligned_le32(src + 8);
56 dctx->s[3] = get_unaligned_le32(src + 12);
59 dctx->sset = true;
67 poly1305_blocks_mips(&dctx->h, src, len, hibit);
73 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc);
75 if (unlikely(dctx->buflen)) {
76 u32 bytes = min(len, POLY1305_BLOCK_SIZE - dctx->buflen);
78 memcpy(dctx->buf + dctx->buflen, src, bytes);
81 dctx->buflen += bytes;
83 if (dctx->buflen == POLY1305_BLOCK_SIZE) {
84 mips_poly1305_blocks(dctx, dctx->buf, POLY1305_BLOCK_SIZE, 1);
85 dctx->buflen = 0;
90 mips_poly1305_blocks(dctx, src, len, 1);
96 dctx->buflen = len;
97 memcpy(dctx->buf, src, len);
102 void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src,
105 if (unlikely(dctx->buflen)) {
106 u32 bytes = min(nbytes, POLY1305_BLOCK_SIZE - dctx->buflen);
108 memcpy(dctx->buf + dctx->buflen, src, bytes);
111 dctx->buflen += bytes;
113 if (dctx->buflen == POLY1305_BLOCK_SIZE) {
114 poly1305_blocks_mips(&dctx->h, dctx->buf,
116 dctx->buflen = 0;
123 poly1305_blocks_mips(&dctx->h, src, len, 1);
129 dctx->buflen = nbytes;
130 memcpy(dctx->buf, src, nbytes);
135 void poly1305_final_arch(struct poly1305_desc_ctx *dctx, u8 *dst)
137 if (unlikely(dctx->buflen)) {
138 dctx->buf[dctx->buflen++] = 1;
139 memset(dctx->buf + dctx->buflen, 0,
140 POLY1305_BLOCK_SIZE - dctx->buflen);
141 poly1305_blocks_mips(&dctx->h, dctx->buf, POLY1305_BLOCK_SIZE, 0);
144 poly1305_emit_mips(&dctx->h, dst, dctx->s);
145 *dctx = (struct poly1305_desc_ctx){};
151 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc);
153 if (unlikely(!dctx->sset))
156 poly1305_final_arch(dctx, dst);