^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Common values for the Poly1305 algorithm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef _CRYPTO_INTERNAL_POLY1305_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define _CRYPTO_INTERNAL_POLY1305_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/unaligned.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <crypto/poly1305.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Poly1305 core functions. These only accept whole blocks; the caller must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * handle any needed block buffering and padding. 'hibit' must be 1 for any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * full blocks, or 0 for the final block if it had to be padded. If 'nonce' is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * non-NULL, then it's added at the end to compute the Poly1305 MAC. Otherwise,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * only the ε-almost-∆-universal hash function (not the full MAC) is computed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void poly1305_core_setkey(struct poly1305_core_key *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) const u8 raw_key[POLY1305_BLOCK_SIZE]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static inline void poly1305_core_init(struct poly1305_state *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *state = (struct poly1305_state){};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void poly1305_core_blocks(struct poly1305_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) const struct poly1305_core_key *key, const void *src,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned int nblocks, u32 hibit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void poly1305_core_emit(const struct poly1305_state *state, const u32 nonce[4],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void *dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif