More api.h removal

This commit is contained in:
Frank Denis 2015-11-21 12:35:02 +01:00
parent fd0c47025f
commit 16f12c1af3
10 changed files with 23 additions and 53 deletions

View File

@ -5,15 +5,12 @@ libsodium_la_SOURCES = \
crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
crypto_auth/crypto_auth.c \
crypto_auth/hmacsha256/auth_hmacsha256_api.c \
crypto_auth/hmacsha256/cp/api.h \
crypto_auth/hmacsha256/cp/hmac_hmacsha256.c \
crypto_auth/hmacsha256/cp/verify_hmacsha256.c \
crypto_auth/hmacsha512/auth_hmacsha512_api.c \
crypto_auth/hmacsha512/cp/api.h \
crypto_auth/hmacsha512/cp/hmac_hmacsha512.c \
crypto_auth/hmacsha512/cp/verify_hmacsha512.c \
crypto_auth/hmacsha512256/auth_hmacsha512256_api.c \
crypto_auth/hmacsha512256/cp/api.h \
crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c \
crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c \
crypto_box/crypto_box.c \

View File

@ -1,9 +0,0 @@
#include "crypto_auth_hmacsha256.h"
#define crypto_auth crypto_auth_hmacsha256
#define crypto_auth_verify crypto_auth_hmacsha256_verify
#define crypto_auth_BYTES crypto_auth_hmacsha256_BYTES
#define crypto_auth_KEYBYTES crypto_auth_hmacsha256_KEYBYTES
#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha256_IMPLEMENTATION
#define crypto_auth_VERSION crypto_auth_hmacsha256_VERSION

View File

@ -26,7 +26,6 @@
*
*/
#include "api.h"
#include "crypto_auth_hmacsha256.h"
#include "crypto_hash_sha256.h"
#include "utils.h"
@ -98,12 +97,12 @@ crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
}
int
crypto_auth(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
crypto_auth_hmacsha256(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
{
crypto_auth_hmacsha256_state state;
crypto_auth_hmacsha256_init(&state, k, crypto_auth_KEYBYTES);
crypto_auth_hmacsha256_init(&state, k, crypto_auth_hmacsha256_KEYBYTES);
crypto_auth_hmacsha256_update(&state, in, inlen);
crypto_auth_hmacsha256_final(&state, out);

View File

@ -1,11 +1,11 @@
#include "api.h"
#include "crypto_auth_hmacsha256.h"
#include "crypto_verify_32.h"
#include "utils.h"
int crypto_auth_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k)
int crypto_auth_hmacsha256_verify(const unsigned char *h,const unsigned char *in,unsigned long long inlen,const unsigned char *k)
{
unsigned char correct[32];
crypto_auth(correct,in,inlen,k);
crypto_auth_hmacsha256(correct,in,inlen,k);
return crypto_verify_32(h,correct) | (-(h == correct)) |
sodium_memcmp(correct,h,32);
}

View File

@ -1,9 +0,0 @@
#include "crypto_auth_hmacsha512.h"
#define crypto_auth crypto_auth_hmacsha512
#define crypto_auth_verify crypto_auth_hmacsha512_verify
#define crypto_auth_BYTES crypto_auth_hmacsha512_BYTES
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512_KEYBYTES
#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512_IMPLEMENTATION
#define crypto_auth_VERSION crypto_auth_hmacsha512_VERSION

View File

@ -26,7 +26,6 @@
*
*/
#include "api.h"
#include "crypto_auth_hmacsha512.h"
#include "crypto_hash_sha512.h"
#include "utils.h"
@ -98,12 +97,12 @@ crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
}
int
crypto_auth(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
crypto_auth_hmacsha512(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
{
crypto_auth_hmacsha512_state state;
crypto_auth_hmacsha512_init(&state, k, crypto_auth_KEYBYTES);
crypto_auth_hmacsha512_init(&state, k, crypto_auth_hmacsha512_KEYBYTES);
crypto_auth_hmacsha512_update(&state, in, inlen);
crypto_auth_hmacsha512_final(&state, out);

View File

@ -1,12 +1,12 @@
#include "api.h"
#include "crypto_auth_hmacsha512.h"
#include "crypto_verify_64.h"
#include "utils.h"
int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
int crypto_auth_hmacsha512_verify(const unsigned char *h, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
{
unsigned char correct[64];
crypto_auth(correct,in,inlen,k);
crypto_auth_hmacsha512(correct,in,inlen,k);
return crypto_verify_64(h,correct) | (-(h == correct)) |
sodium_memcmp(correct,h,64);
}

View File

@ -1,9 +0,0 @@
#include "crypto_auth_hmacsha512256.h"
#define crypto_auth crypto_auth_hmacsha512256
#define crypto_auth_verify crypto_auth_hmacsha512256_verify
#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
#define crypto_auth_IMPLEMENTATION crypto_auth_hmacsha512256_IMPLEMENTATION
#define crypto_auth_VERSION crypto_auth_hmacsha512256_VERSION

View File

@ -1,5 +1,4 @@
#include "api.h"
#include "crypto_auth_hmacsha512256.h"
#include "crypto_auth_hmacsha512.h"
#include "crypto_hash_sha512.h"
@ -41,12 +40,13 @@ crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
}
int
crypto_auth(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
crypto_auth_hmacsha512256(unsigned char *out, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
{
crypto_auth_hmacsha512256_state state;
crypto_auth_hmacsha512256_init(&state, k, crypto_auth_KEYBYTES);
crypto_auth_hmacsha512256_init(&state, k,
crypto_auth_hmacsha512256_KEYBYTES);
crypto_auth_hmacsha512256_update(&state, in, inlen);
crypto_auth_hmacsha512256_final(&state, out);

View File

@ -1,12 +1,14 @@
#include "api.h"
#include "crypto_auth_hmacsha512256.h"
#include "crypto_verify_32.h"
#include "utils.h"
int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
unsigned long long inlen, const unsigned char *k)
int crypto_auth_hmacsha512256_verify(const unsigned char *h,
const unsigned char *in,
unsigned long long inlen,
const unsigned char *k)
{
unsigned char correct[32];
crypto_auth(correct,in,inlen,k);
crypto_auth_hmacsha512256(correct,in,inlen,k);
return crypto_verify_32(h,correct) | (-(h == correct)) |
sodium_memcmp(correct,h,32);
}