More api.h removal
This commit is contained in:
parent
fd0c47025f
commit
16f12c1af3
@ -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 \
|
||||
|
@ -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
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user