Lines Matching refs:resid

44 	size_t resid, todo;  in chacha20_poly1305_encrypt()  local
57 resid = src_len; in chacha20_poly1305_encrypt()
58 todo = rounddown2(resid, CHACHA20_NATIVE_BLOCK_LEN); in chacha20_poly1305_encrypt()
64 resid -= todo; in chacha20_poly1305_encrypt()
66 if (resid > 0) { in chacha20_poly1305_encrypt()
67 exf->encrypt_last(ctx, src, dst, resid); in chacha20_poly1305_encrypt()
68 exf->update(ctx, dst, resid); in chacha20_poly1305_encrypt()
69 dst += resid; in chacha20_poly1305_encrypt()
70 if (resid % POLY1305_BLOCK_LEN != 0) in chacha20_poly1305_encrypt()
72 POLY1305_BLOCK_LEN - resid % POLY1305_BLOCK_LEN); in chacha20_poly1305_encrypt()
91 size_t resid, todo; in chacha20_poly1305_decrypt() local
100 resid = src_len - POLY1305_HASH_LEN; in chacha20_poly1305_decrypt()
111 exf->update(ctx, src, resid); in chacha20_poly1305_decrypt()
112 if (resid % POLY1305_BLOCK_LEN != 0) in chacha20_poly1305_decrypt()
114 POLY1305_BLOCK_LEN - resid % POLY1305_BLOCK_LEN); in chacha20_poly1305_decrypt()
117 u.lengths[1] = htole64(resid); in chacha20_poly1305_decrypt()
120 result = (timingsafe_bcmp(u.tag, src + resid, POLY1305_HASH_LEN) == 0); in chacha20_poly1305_decrypt()
124 todo = rounddown2(resid, CHACHA20_NATIVE_BLOCK_LEN); in chacha20_poly1305_decrypt()
129 resid -= todo; in chacha20_poly1305_decrypt()
131 if (resid > 0) in chacha20_poly1305_decrypt()
132 exf->decrypt_last(ctx, src, dst, resid); in chacha20_poly1305_decrypt()
147 size_t resid, todo; in xchacha20_poly1305_encrypt() local
160 resid = src_len; in xchacha20_poly1305_encrypt()
161 todo = rounddown2(resid, CHACHA20_NATIVE_BLOCK_LEN); in xchacha20_poly1305_encrypt()
167 resid -= todo; in xchacha20_poly1305_encrypt()
169 if (resid > 0) { in xchacha20_poly1305_encrypt()
170 exf->encrypt_last(ctx, src, dst, resid); in xchacha20_poly1305_encrypt()
171 exf->update(ctx, dst, resid); in xchacha20_poly1305_encrypt()
172 dst += resid; in xchacha20_poly1305_encrypt()
173 if (resid % POLY1305_BLOCK_LEN != 0) in xchacha20_poly1305_encrypt()
175 POLY1305_BLOCK_LEN - resid % POLY1305_BLOCK_LEN); in xchacha20_poly1305_encrypt()
194 size_t resid, todo; in xchacha20_poly1305_decrypt() local
203 resid = src_len - POLY1305_HASH_LEN; in xchacha20_poly1305_decrypt()
214 exf->update(ctx, src, resid); in xchacha20_poly1305_decrypt()
215 if (resid % POLY1305_BLOCK_LEN != 0) in xchacha20_poly1305_decrypt()
217 POLY1305_BLOCK_LEN - resid % POLY1305_BLOCK_LEN); in xchacha20_poly1305_decrypt()
220 u.lengths[1] = htole64(resid); in xchacha20_poly1305_decrypt()
223 result = (timingsafe_bcmp(u.tag, src + resid, POLY1305_HASH_LEN) == 0); in xchacha20_poly1305_decrypt()
227 todo = rounddown2(resid, CHACHA20_NATIVE_BLOCK_LEN); in xchacha20_poly1305_decrypt()
232 resid -= todo; in xchacha20_poly1305_decrypt()
234 if (resid > 0) in xchacha20_poly1305_decrypt()
235 exf->decrypt_last(ctx, src, dst, resid); in xchacha20_poly1305_decrypt()