Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Common values for the Poly1305 algorithm
0004  */
0005 
0006 #ifndef _CRYPTO_INTERNAL_POLY1305_H
0007 #define _CRYPTO_INTERNAL_POLY1305_H
0008 
0009 #include <asm/unaligned.h>
0010 #include <linux/types.h>
0011 #include <crypto/poly1305.h>
0012 
0013 /*
0014  * Poly1305 core functions.  These only accept whole blocks; the caller must
0015  * handle any needed block buffering and padding.  'hibit' must be 1 for any
0016  * full blocks, or 0 for the final block if it had to be padded.  If 'nonce' is
0017  * non-NULL, then it's added at the end to compute the Poly1305 MAC.  Otherwise,
0018  * only the ε-almost-∆-universal hash function (not the full MAC) is computed.
0019  */
0020 
0021 void poly1305_core_setkey(struct poly1305_core_key *key,
0022               const u8 raw_key[POLY1305_BLOCK_SIZE]);
0023 static inline void poly1305_core_init(struct poly1305_state *state)
0024 {
0025     *state = (struct poly1305_state){};
0026 }
0027 
0028 void poly1305_core_blocks(struct poly1305_state *state,
0029               const struct poly1305_core_key *key, const void *src,
0030               unsigned int nblocks, u32 hibit);
0031 void poly1305_core_emit(const struct poly1305_state *state, const u32 nonce[4],
0032             void *dst);
0033 
0034 #endif