Lines Matching refs:dctx

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