ctx -> state for consistency with the high-level functions

This commit is contained in:
Frank Denis 2015-11-14 00:30:08 +01:00
parent 580c22fd21
commit 75cc7123da
3 changed files with 16 additions and 15 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;