Merge auth_poly1305_donna.c and verify_poly1305_donna.c

This commit is contained in:
Frank Denis 2015-11-01 12:35:49 +01:00
parent 19308c5d5b
commit 2d04b79f5c
3 changed files with 13 additions and 16 deletions

View File

@ -56,7 +56,6 @@ libsodium_la_SOURCES = \
crypto_onetimeauth/poly1305/donna/poly1305_donna32.h \ crypto_onetimeauth/poly1305/donna/poly1305_donna32.h \
crypto_onetimeauth/poly1305/donna/poly1305_donna64.h \ crypto_onetimeauth/poly1305/donna/poly1305_donna64.h \
crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c \ crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c \
crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c \
crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \ crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \
crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \ crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \
crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \

View File

@ -1,4 +1,5 @@
#include "crypto_verify_16.h"
#include "utils.h" #include "utils.h"
#include "poly1305_donna.h" #include "poly1305_donna.h"
#ifdef HAVE_TI_MODE #ifdef HAVE_TI_MODE
@ -87,6 +88,18 @@ crypto_onetimeauth_poly1305_donna_final(crypto_onetimeauth_poly1305_state *state
return 0; return 0;
} }
static int
crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
const unsigned char *in,
unsigned long long inlen,
const unsigned char *k)
{
unsigned char correct[16];
crypto_onetimeauth_poly1305_donna(correct,in,inlen,k);
return crypto_verify_16(h,correct);
}
struct crypto_onetimeauth_poly1305_implementation struct crypto_onetimeauth_poly1305_implementation
crypto_onetimeauth_poly1305_donna_implementation = { crypto_onetimeauth_poly1305_donna_implementation = {
SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna, SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna,

View File

@ -1,15 +0,0 @@
#include "crypto_onetimeauth_poly1305.h"
#include "crypto_verify_16.h"
#include "poly1305_donna.h"
int
crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
const unsigned char *in,
unsigned long long inlen,
const unsigned char *k)
{
unsigned char correct[16];
crypto_onetimeauth_poly1305_donna(correct,in,inlen,k);
return crypto_verify_16(h,correct);
}