148ea8c6eSArd Biesheuvel /* SPDX-License-Identifier: GPL-2.0 */
248ea8c6eSArd Biesheuvel /*
348ea8c6eSArd Biesheuvel * Common values for the Poly1305 algorithm
448ea8c6eSArd Biesheuvel */
548ea8c6eSArd Biesheuvel
648ea8c6eSArd Biesheuvel #ifndef _CRYPTO_INTERNAL_POLY1305_H
748ea8c6eSArd Biesheuvel #define _CRYPTO_INTERNAL_POLY1305_H
848ea8c6eSArd Biesheuvel
9*5f60d5f6SAl Viro #include <linux/unaligned.h>
1048ea8c6eSArd Biesheuvel #include <linux/types.h>
1148ea8c6eSArd Biesheuvel #include <crypto/poly1305.h>
1248ea8c6eSArd Biesheuvel
1348ea8c6eSArd Biesheuvel /*
141c08a104SJason A. Donenfeld * Poly1305 core functions. These only accept whole blocks; the caller must
151c08a104SJason A. Donenfeld * handle any needed block buffering and padding. 'hibit' must be 1 for any
161c08a104SJason A. Donenfeld * full blocks, or 0 for the final block if it had to be padded. If 'nonce' is
171c08a104SJason A. Donenfeld * non-NULL, then it's added at the end to compute the Poly1305 MAC. Otherwise,
181c08a104SJason A. Donenfeld * only the ε-almost-∆-universal hash function (not the full MAC) is computed.
1948ea8c6eSArd Biesheuvel */
201c08a104SJason A. Donenfeld
218d195e7aSArnd Bergmann void poly1305_core_setkey(struct poly1305_core_key *key,
228d195e7aSArnd Bergmann const u8 raw_key[POLY1305_BLOCK_SIZE]);
poly1305_core_init(struct poly1305_state * state)2348ea8c6eSArd Biesheuvel static inline void poly1305_core_init(struct poly1305_state *state)
2448ea8c6eSArd Biesheuvel {
2548ea8c6eSArd Biesheuvel *state = (struct poly1305_state){};
2648ea8c6eSArd Biesheuvel }
2748ea8c6eSArd Biesheuvel
2848ea8c6eSArd Biesheuvel void poly1305_core_blocks(struct poly1305_state *state,
291c08a104SJason A. Donenfeld const struct poly1305_core_key *key, const void *src,
3048ea8c6eSArd Biesheuvel unsigned int nblocks, u32 hibit);
311c08a104SJason A. Donenfeld void poly1305_core_emit(const struct poly1305_state *state, const u32 nonce[4],
321c08a104SJason A. Donenfeld void *dst);
3348ea8c6eSArd Biesheuvel
3448ea8c6eSArd Biesheuvel #endif
35