1 2#include "crypto_onetimeauth.h" 3#include "randombytes.h" 4 5size_t 6crypto_onetimeauth_statebytes(void) 7{ 8 return sizeof(crypto_onetimeauth_state); 9} 10 11size_t 12crypto_onetimeauth_bytes(void) 13{ 14 return crypto_onetimeauth_BYTES; 15} 16 17size_t 18crypto_onetimeauth_keybytes(void) 19{ 20 return crypto_onetimeauth_KEYBYTES; 21} 22 23int 24crypto_onetimeauth(unsigned char *out, const unsigned char *in, 25 unsigned long long inlen, const unsigned char *k) 26{ 27 return crypto_onetimeauth_poly1305(out, in, inlen, k); 28} 29 30int 31crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, 32 unsigned long long inlen, const unsigned char *k) 33{ 34 return crypto_onetimeauth_poly1305_verify(h, in, inlen, k); 35} 36 37int 38crypto_onetimeauth_init(crypto_onetimeauth_state *state, 39 const unsigned char *key) 40{ 41 return crypto_onetimeauth_poly1305_init 42 ((crypto_onetimeauth_poly1305_state *) state, key); 43} 44 45int 46crypto_onetimeauth_update(crypto_onetimeauth_state *state, 47 const unsigned char *in, 48 unsigned long long inlen) 49{ 50 return crypto_onetimeauth_poly1305_update 51 ((crypto_onetimeauth_poly1305_state *) state, in, inlen); 52} 53 54int 55crypto_onetimeauth_final(crypto_onetimeauth_state *state, 56 unsigned char *out) 57{ 58 return crypto_onetimeauth_poly1305_final 59 ((crypto_onetimeauth_poly1305_state *) state, out); 60} 61 62const char * 63crypto_onetimeauth_primitive(void) 64{ 65 return crypto_onetimeauth_PRIMITIVE; 66} 67 68void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES]) 69{ 70 randombytes_buf(k, crypto_onetimeauth_KEYBYTES); 71} 72