fb6eb4992a77828e818b238a0d2c5d33a74395d8
[trex.git] /
1 #ifndef crypto_onetimeauth_poly1305_H
2 #define crypto_onetimeauth_poly1305_H
3
4 #include <stddef.h>
5 #include "export.h"
6
7 #ifdef __cplusplus
8 # if __GNUC__
9 #  pragma GCC diagnostic ignored "-Wlong-long"
10 # endif
11 extern "C" {
12 #endif
13
14 #include <sys/types.h>
15
16 #include <stdint.h>
17 #include <stdio.h>
18
19 typedef struct crypto_onetimeauth_poly1305_state {
20     unsigned long long aligner;
21     unsigned char      opaque[136];
22 } crypto_onetimeauth_poly1305_state;
23
24 typedef struct crypto_onetimeauth_poly1305_implementation {
25     const char *(*implementation_name)(void);
26     int         (*onetimeauth)(unsigned char *out,
27                                const unsigned char *in,
28                                unsigned long long inlen,
29                                const unsigned char *k);
30     int         (*onetimeauth_verify)(const unsigned char *h,
31                                       const unsigned char *in,
32                                       unsigned long long inlen,
33                                       const unsigned char *k);
34     int         (*onetimeauth_init)(crypto_onetimeauth_poly1305_state *state,
35                                     const unsigned char *key);
36     int         (*onetimeauth_update)(crypto_onetimeauth_poly1305_state *state,
37                                       const unsigned char *in,
38                                       unsigned long long inlen);
39     int         (*onetimeauth_final)(crypto_onetimeauth_poly1305_state *state,
40                                      unsigned char *out);
41 } crypto_onetimeauth_poly1305_implementation;
42
43 #define crypto_onetimeauth_poly1305_BYTES 16U
44 SODIUM_EXPORT
45 size_t crypto_onetimeauth_poly1305_bytes(void);
46
47 #define crypto_onetimeauth_poly1305_KEYBYTES 32U
48 SODIUM_EXPORT
49 size_t crypto_onetimeauth_poly1305_keybytes(void);
50
51 SODIUM_EXPORT
52 const char *crypto_onetimeauth_poly1305_implementation_name(void);
53
54 SODIUM_EXPORT
55 int crypto_onetimeauth_poly1305_set_implementation(crypto_onetimeauth_poly1305_implementation *impl);
56
57 crypto_onetimeauth_poly1305_implementation *
58 crypto_onetimeauth_pick_best_implementation(void);
59
60 SODIUM_EXPORT
61 int crypto_onetimeauth_poly1305(unsigned char *out,
62                                 const unsigned char *in,
63                                 unsigned long long inlen,
64                                 const unsigned char *k);
65
66 SODIUM_EXPORT
67 int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
68                                        const unsigned char *in,
69                                        unsigned long long inlen,
70                                        const unsigned char *k);
71
72 SODIUM_EXPORT
73 int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
74                                      const unsigned char *key);
75
76 SODIUM_EXPORT
77 int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
78                                        const unsigned char *in,
79                                        unsigned long long inlen);
80
81 SODIUM_EXPORT
82 int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
83                                       unsigned char *out);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif