From 2d04b79f5c2e7515ffcd25988c9ed44d2a26cff3 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 1 Nov 2015 12:35:49 +0100 Subject: [PATCH] Merge auth_poly1305_donna.c and verify_poly1305_donna.c --- src/libsodium/Makefile.am | 1 - .../poly1305/donna/auth_poly1305_donna.c | 13 +++++++++++++ .../poly1305/donna/verify_poly1305_donna.c | 15 --------------- 3 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index e5bb8138..ece7ba67 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -56,7 +56,6 @@ libsodium_la_SOURCES = \ crypto_onetimeauth/poly1305/donna/poly1305_donna32.h \ crypto_onetimeauth/poly1305/donna/poly1305_donna64.h \ 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.h \ crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ 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 cb23c90b..4c70a813 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c @@ -1,4 +1,5 @@ +#include "crypto_verify_16.h" #include "utils.h" #include "poly1305_donna.h" #ifdef HAVE_TI_MODE @@ -87,6 +88,18 @@ crypto_onetimeauth_poly1305_donna_final(crypto_onetimeauth_poly1305_state *state 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 crypto_onetimeauth_poly1305_donna_implementation = { SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna, diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c b/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c deleted file mode 100644 index e0598423..00000000 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +++ /dev/null @@ -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); -}