26 #ifndef WOLF_CRYPT_POLY1305_H 27 #define WOLF_CRYPT_POLY1305_H 38 #if defined(__SIZEOF_INT128__) && defined(__LP64__) 39 #define WC_HAS_SIZEOF_INT128_64BIT 42 #if defined(_MSC_VER) && defined(_M_X64) 43 #define WC_HAS_MSVC_64BIT 46 #if (defined(__GNUC__) && defined(__LP64__) && \ 47 ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)))) 48 #define WC_HAS_GCC_4_4_64BIT 51 #ifdef USE_INTEL_SPEEDUP 52 #elif (defined(WC_HAS_SIZEOF_INT128_64BIT) || defined(WC_HAS_MSVC_64BIT) || \ 53 defined(WC_HAS_GCC_4_4_64BIT)) 61 POLY1305_BLOCK_SIZE = 16,
62 POLY1305_DIGEST_SIZE = 16,
65 #define WC_POLY1305_PAD_SZ 16 66 #define WC_POLY1305_MAC_SZ 16 70 #ifdef USE_INTEL_SPEEDUP 80 unsigned char buffer[8*POLY1305_BLOCK_SIZE];
82 unsigned char finished;
83 unsigned char started;
85 #if defined(WOLFSSL_ARMASM) && defined(__aarch64__) 87 ALIGN128 word32 r_2[5];
88 ALIGN128 word32 r_4[5];
93 #if defined(POLY130564) 104 unsigned char buffer[POLY1305_BLOCK_SIZE];
105 unsigned char finished;
117 WOLFSSL_API
int wc_Poly1305_Pad(
Poly1305* ctx, word32 lenToPad);
118 WOLFSSL_API
int wc_Poly1305_EncodeSizes(
Poly1305* ctx, word32 aadSz, word32 dataSz);
120 byte* input, word32 sz, byte* tag, word32 tagSz);
122 void poly1305_block(
Poly1305* ctx,
const unsigned char *m);
123 void poly1305_blocks(
Poly1305* ctx,
const unsigned char *m,
Definition: poly1305.h:69
WOLFSSL_API int wc_Poly1305Update(Poly1305 *poly1305, const byte *, word32)
This function updates the message to hash with the Poly1305 structure.
Definition: poly1305.c:662
WOLFSSL_API int wc_Poly1305Final(Poly1305 *poly1305, byte *tag)
This function calculates the hash of the input messages and stores the result in mac. After this is called, the key should be reset.
Definition: poly1305.c:479
WOLFSSL_API int wc_Poly1305SetKey(Poly1305 *poly1305, const byte *key, word32 kySz)
This function sets the key for a Poly1305 context structure, initializing it for hashing. Note: A new key should be set after generating a message hash with wc_Poly1305Final to ensure security.
Definition: poly1305.c:393
WOLFSSL_API int wc_Poly1305_MAC(Poly1305 *ctx, byte *additional, word32 addSz, byte *input, word32 sz, byte *tag, word32 tagSz)
Takes in an initialized Poly1305 struct that has a key loaded and creates a MAC (tag) using recent TL...
Definition: poly1305.c:822