1 
2 #include "crypto_onetimeauth.h"
3 #include "randombytes.h"
4 
5 size_t
6 crypto_onetimeauth_statebytes(void)
7 {
8     return sizeof(crypto_onetimeauth_state);
9 }
10 
11 size_t
12 crypto_onetimeauth_bytes(void)
13 {
14     return crypto_onetimeauth_BYTES;
15 }
16 
17 size_t
18 crypto_onetimeauth_keybytes(void)
19 {
20     return crypto_onetimeauth_KEYBYTES;
21 }
22 
23 int
24 crypto_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 
30 int
31 crypto_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 
37 int
38 crypto_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 
45 int
46 crypto_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 
54 int
55 crypto_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 
62 const char *
63 crypto_onetimeauth_primitive(void)
64 {
65     return crypto_onetimeauth_PRIMITIVE;
66 }
67 
68 void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
69 {
70     randombytes_buf(k, crypto_onetimeauth_KEYBYTES);
71 }
72