diff --git a/src/headers/tomcrypt_mac.h b/src/headers/tomcrypt_mac.h index e2b4a9f..4adc7c0 100644 --- a/src/headers/tomcrypt_mac.h +++ b/src/headers/tomcrypt_mac.h @@ -104,11 +104,11 @@ typedef struct { unsigned long leftover; unsigned char buffer[16]; int final; -} poly_state; +} poly1305_state; -int poly1305_init(poly_state *st, const unsigned char *key, unsigned long keylen); -int poly1305_process(poly_state *st, const unsigned char *in, unsigned long inlen); -int poly1305_done(poly_state *st, unsigned char *mac, unsigned long *maclen); +int poly1305_init(poly1305_state *st, const unsigned char *key, unsigned long keylen); +int poly1305_process(poly1305_state *st, const unsigned char *in, unsigned long inlen); +int poly1305_done(poly1305_state *st, unsigned char *mac, unsigned long *maclen); int poly1305_test(void); int poly1305_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen); int poly1305_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...); @@ -500,7 +500,7 @@ int f9_test(void); #ifdef LTC_CHACHA20POLY1305_MODE typedef struct { - poly_state poly; + poly1305_state poly; chacha_state chacha; ulong64 aadlen; ulong64 ctlen; diff --git a/src/mac/poly1305/poly1305.c b/src/mac/poly1305/poly1305.c index abb0f33..369341b 100644 --- a/src/mac/poly1305/poly1305.c +++ b/src/mac/poly1305/poly1305.c @@ -17,7 +17,7 @@ #ifdef LTC_POLY1305 /* internal only */ -static void _poly1305_block(poly_state *st, const unsigned char *in, unsigned long inlen) +static void _poly1305_block(poly1305_state *st, const unsigned char *in, unsigned long inlen) { const unsigned long hibit = (st->final) ? 0 : (1UL << 24); /* 1 << 128 */ ulong32 r0,r1,r2,r3,r4; @@ -86,7 +86,7 @@ static void _poly1305_block(poly_state *st, const unsigned char *in, unsigned lo @param keylen The length of the secret key (octets) @return CRYPT_OK if successful */ -int poly1305_init(poly_state *st, const unsigned char *key, unsigned long keylen) +int poly1305_init(poly1305_state *st, const unsigned char *key, unsigned long keylen) { LTC_ARGCHK(st != NULL); LTC_ARGCHK(key != NULL); @@ -124,7 +124,7 @@ int poly1305_init(poly_state *st, const unsigned char *key, unsigned long keylen @param inlen The length of the data to HMAC (octets) @return CRYPT_OK if successful */ -int poly1305_process(poly_state *st, const unsigned char *in, unsigned long inlen) +int poly1305_process(poly1305_state *st, const unsigned char *in, unsigned long inlen) { unsigned long i; @@ -168,7 +168,7 @@ int poly1305_process(poly_state *st, const unsigned char *in, unsigned long inle @param outlen [in/out] The max size and resulting size of the POLY1305 authentication tag @return CRYPT_OK if successful */ -int poly1305_done(poly_state *st, unsigned char *mac, unsigned long *maclen) +int poly1305_done(poly1305_state *st, unsigned char *mac, unsigned long *maclen) { ulong32 h0,h1,h2,h3,h4,c; ulong32 g0,g1,g2,g3,g4; diff --git a/src/mac/poly1305/poly1305_file.c b/src/mac/poly1305/poly1305_file.c index f11854e..92ff2aa 100644 --- a/src/mac/poly1305/poly1305_file.c +++ b/src/mac/poly1305/poly1305_file.c @@ -30,7 +30,7 @@ int poly1305_file(const char *fname, const unsigned char *key, unsigned long key #ifdef LTC_NO_FILE return CRYPT_NOP; #else - poly_state st; + poly1305_state st; FILE *in; unsigned char *buf; size_t x; @@ -60,7 +60,7 @@ int poly1305_file(const char *fname, const unsigned char *key, unsigned long key LBL_ERR: #ifdef LTC_CLEAN_STACK - zeromem(&st, sizeof(poly_state)); + zeromem(&st, sizeof(poly1305_state)); #endif XFREE(buf); return err; diff --git a/src/mac/poly1305/poly1305_memory.c b/src/mac/poly1305/poly1305_memory.c index 4ff2fe1..2f7a8e0 100644 --- a/src/mac/poly1305/poly1305_memory.c +++ b/src/mac/poly1305/poly1305_memory.c @@ -28,7 +28,7 @@ */ int poly1305_memory(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *mac, unsigned long *maclen) { - poly_state st; + poly1305_state st; int err; LTC_ARGCHK(key != NULL); @@ -41,7 +41,7 @@ int poly1305_memory(const unsigned char *key, unsigned long keylen, const unsign err = poly1305_done(&st, mac, maclen); LBL_ERR: #ifdef LTC_CLEAN_STACK - zeromem(&st, sizeof(poly_state)); + zeromem(&st, sizeof(poly1305_state)); #endif return err; }; diff --git a/src/mac/poly1305/poly1305_memory_multi.c b/src/mac/poly1305/poly1305_memory_multi.c index a8daec8..047f5fd 100644 --- a/src/mac/poly1305/poly1305_memory_multi.c +++ b/src/mac/poly1305/poly1305_memory_multi.c @@ -30,7 +30,7 @@ */ int poly1305_memory_multi(const unsigned char *key, unsigned long keylen, unsigned char *mac, unsigned long *maclen, const unsigned char *in, unsigned long inlen, ...) { - poly_state st; + poly1305_state st; int err; va_list args; const unsigned char *curptr; @@ -54,7 +54,7 @@ int poly1305_memory_multi(const unsigned char *key, unsigned long keylen, unsign err = poly1305_done(&st, mac, maclen); LBL_ERR: #ifdef LTC_CLEAN_STACK - zeromem(&st, sizeof(poly_state)); + zeromem(&st, sizeof(poly1305_state)); #endif va_end(args); return err; diff --git a/src/mac/poly1305/poly1305_test.c b/src/mac/poly1305/poly1305_test.c index 218ee2e..8f7c1e2 100644 --- a/src/mac/poly1305/poly1305_test.c +++ b/src/mac/poly1305/poly1305_test.c @@ -27,7 +27,7 @@ int poly1305_test(void) char m[] = "Cryptographic Forum Research Group"; unsigned long len = 16, mlen = strlen(m); unsigned char out[1000]; - poly_state st; + poly1305_state st; /* process piece by piece */ poly1305_init(&st, k, 32); poly1305_process(&st, (unsigned char*)m, 5);