1
2 #include "crypto_auth.h"
3 #include "randombytes.h"
4
5 size_t
crypto_auth_bytes(void)6 crypto_auth_bytes(void)
7 {
8 return crypto_auth_BYTES;
9 }
10
11 size_t
crypto_auth_keybytes(void)12 crypto_auth_keybytes(void)
13 {
14 return crypto_auth_KEYBYTES;
15 }
16
17 const char *
crypto_auth_primitive(void)18 crypto_auth_primitive(void)
19 {
20 return crypto_auth_PRIMITIVE;
21 }
22
23 int
crypto_auth(unsigned char * out,const unsigned char * in,unsigned long long inlen,const unsigned char * k)24 crypto_auth(unsigned char *out, const unsigned char *in,
25 unsigned long long inlen, const unsigned char *k)
26 {
27 return crypto_auth_hmacsha512256(out, in, inlen, k);
28 }
29
30 int
crypto_auth_verify(const unsigned char * h,const unsigned char * in,unsigned long long inlen,const unsigned char * k)31 crypto_auth_verify(const unsigned char *h, const unsigned char *in,
32 unsigned long long inlen,const unsigned char *k)
33 {
34 return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
35 }
36
37 void
crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])38 crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
39 {
40 randombytes_buf(k, crypto_auth_KEYBYTES);
41 }
42