poly1305.h (ad8f5b88383ea685f2b8df2a12ee3e08089a1287) poly1305.h (1b2c6a5120489d41c8ea3b8dacd0b4586289b158)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Common values for the Poly1305 algorithm
4 */
5
6#ifndef _CRYPTO_INTERNAL_POLY1305_H
7#define _CRYPTO_INTERNAL_POLY1305_H
8
9#include <asm/unaligned.h>
10#include <linux/types.h>
11#include <crypto/poly1305.h>
12
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Common values for the Poly1305 algorithm
4 */
5
6#ifndef _CRYPTO_INTERNAL_POLY1305_H
7#define _CRYPTO_INTERNAL_POLY1305_H
8
9#include <asm/unaligned.h>
10#include <linux/types.h>
11#include <crypto/poly1305.h>
12
13struct shash_desc;
14
15/*
16 * Poly1305 core functions. These implement the ε-almost-∆-universal hash
17 * function underlying the Poly1305 MAC, i.e. they don't add an encrypted nonce
18 * ("s key") at the end. They also only support block-aligned inputs.
19 */
20void poly1305_core_setkey(struct poly1305_key *key, const u8 *raw_key);
21static inline void poly1305_core_init(struct poly1305_state *state)
22{
23 *state = (struct poly1305_state){};
24}
25
26void poly1305_core_blocks(struct poly1305_state *state,
27 const struct poly1305_key *key, const void *src,
28 unsigned int nblocks, u32 hibit);
29void poly1305_core_emit(const struct poly1305_state *state, void *dst);
30
13/*
14 * Poly1305 core functions. These implement the ε-almost-∆-universal hash
15 * function underlying the Poly1305 MAC, i.e. they don't add an encrypted nonce
16 * ("s key") at the end. They also only support block-aligned inputs.
17 */
18void poly1305_core_setkey(struct poly1305_key *key, const u8 *raw_key);
19static inline void poly1305_core_init(struct poly1305_state *state)
20{
21 *state = (struct poly1305_state){};
22}
23
24void poly1305_core_blocks(struct poly1305_state *state,
25 const struct poly1305_key *key, const void *src,
26 unsigned int nblocks, u32 hibit);
27void poly1305_core_emit(const struct poly1305_state *state, void *dst);
28
31/* Crypto API helper functions for the Poly1305 MAC */
32int crypto_poly1305_init(struct shash_desc *desc);
33
34int crypto_poly1305_update(struct shash_desc *desc,
35 const u8 *src, unsigned int srclen);
36int crypto_poly1305_final(struct shash_desc *desc, u8 *dst);
37
38/*
39 * Poly1305 requires a unique key for each tag, which implies that we can't set
40 * it on the tfm that gets accessed by multiple users simultaneously. Instead we
41 * expect the key as the first 32 bytes in the update() call.
42 */
43static inline
44unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx,
45 const u8 *src, unsigned int srclen)

--- 22 unchanged lines hidden ---
29/*
30 * Poly1305 requires a unique key for each tag, which implies that we can't set
31 * it on the tfm that gets accessed by multiple users simultaneously. Instead we
32 * expect the key as the first 32 bytes in the update() call.
33 */
34static inline
35unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx,
36 const u8 *src, unsigned int srclen)

--- 22 unchanged lines hidden ---