From 75cc7123daeb63804bb55bae3712a583b3af1521 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 14 Nov 2015 00:30:08 +0100 Subject: [PATCH] ctx -> state for consistency with the high-level functions --- .../poly1305/donna/auth_poly1305_donna.c | 15 ++++++++------- .../poly1305/donna/poly1305_donna32.h | 8 ++++---- .../poly1305/donna/poly1305_donna64.h | 8 ++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c b/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c index 6febd6c6..26ad57cb 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c @@ -10,9 +10,10 @@ #include "../onetimeauth_poly1305.h" static void -poly1305_update(crypto_onetimeauth_poly1305_state *ctx, const unsigned char *m, - unsigned long long bytes) { - poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx; +poly1305_update(crypto_onetimeauth_poly1305_state *state, const unsigned char *m, + unsigned long long bytes) +{ + poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)state; unsigned long long i; /* handle leftover */ @@ -52,10 +53,10 @@ crypto_onetimeauth_poly1305_donna(unsigned char *out, const unsigned char *m, unsigned long long inlen, const unsigned char *key) { - crypto_onetimeauth_poly1305_state ctx; - poly1305_init(&ctx, key); - poly1305_update(&ctx, m, inlen); - poly1305_finish(&ctx, out); + crypto_onetimeauth_poly1305_state state; + poly1305_init(&state, key); + poly1305_update(&state, m, inlen); + poly1305_finish(&state, out); return 0; } diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h index bac6f1c0..a76a91d2 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h @@ -42,8 +42,8 @@ U32TO8(unsigned char *p, unsigned long v) { } static void -poly1305_init(crypto_onetimeauth_poly1305_state *ctx, const unsigned char key[32]) { - poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx; +poly1305_init(crypto_onetimeauth_poly1305_state *state, const unsigned char key[32]) { + poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)state; /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ st->r[0] = (U8TO32(&key[ 0]) ) & 0x3ffffff; @@ -131,8 +131,8 @@ poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m, unsigned } static POLY1305_NOINLINE void -poly1305_finish(crypto_onetimeauth_poly1305_state *ctx, unsigned char mac[16]) { - poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx; +poly1305_finish(crypto_onetimeauth_poly1305_state *state, unsigned char mac[16]) { + poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)state; unsigned long h0,h1,h2,h3,h4,c; unsigned long g0,g1,g2,g3,g4; unsigned long long f; diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h index 014164ec..7a757bcf 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h @@ -56,8 +56,8 @@ U64TO8(unsigned char *p, unsigned long long v) { } static void -poly1305_init(crypto_onetimeauth_poly1305_state *ctx, const unsigned char key[32]) { - poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx; +poly1305_init(crypto_onetimeauth_poly1305_state *state, const unsigned char key[32]) { + poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)state; unsigned long long t0,t1; /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ @@ -135,8 +135,8 @@ poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m, unsigned static POLY1305_NOINLINE void -poly1305_finish(crypto_onetimeauth_poly1305_state *ctx, unsigned char mac[16]) { - poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)ctx; +poly1305_finish(crypto_onetimeauth_poly1305_state *state, unsigned char mac[16]) { + poly1305_state_internal_t *st = (poly1305_state_internal_t *)(void *)state; unsigned long long h0,h1,h2,c; unsigned long long g0,g1,g2; unsigned long long t0,t1;