linux/include/crypto/nhpoly1305.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Common values and helper functions for the NHPoly1305 hash function.
 */

#ifndef _NHPOLY1305_H
#define _NHPOLY1305_H

#include <crypto/hash.h>
#include <crypto/internal/poly1305.h>

/* NH parameterization: */

/* Endianness: little */
/* Word size: 32 bits (works well on NEON, SSE2, AVX2) */

/* Stride: 2 words (optimal on ARM32 NEON; works okay on other CPUs too) */
#define NH_PAIR_STRIDE
#define NH_MESSAGE_UNIT

/* Num passes (Toeplitz iteration count): 4, to give ε = 2^{-128} */
#define NH_NUM_PASSES
#define NH_HASH_BYTES

/* Max message size: 1024 bytes (32x compression factor) */
#define NH_NUM_STRIDES
#define NH_MESSAGE_WORDS
#define NH_MESSAGE_BYTES
#define NH_KEY_WORDS
#define NH_KEY_BYTES

#define NHPOLY1305_KEY_SIZE

struct nhpoly1305_key {};

struct nhpoly1305_state {};

nh_t;

int crypto_nhpoly1305_setkey(struct crypto_shash *tfm,
			     const u8 *key, unsigned int keylen);

int crypto_nhpoly1305_init(struct shash_desc *desc);
int crypto_nhpoly1305_update(struct shash_desc *desc,
			     const u8 *src, unsigned int srclen);
int crypto_nhpoly1305_update_helper(struct shash_desc *desc,
				    const u8 *src, unsigned int srclen,
				    nh_t nh_fn);
int crypto_nhpoly1305_final(struct shash_desc *desc, u8 *dst);
int crypto_nhpoly1305_final_helper(struct shash_desc *desc, u8 *dst,
				   nh_t nh_fn);

#endif /* _NHPOLY1305_H */