libsodium (1.0.19)
1 #ifndef crypto_onetimeauth_poly1305_H
2 #define crypto_onetimeauth_poly1305_H
3
4 #ifdef __cplusplus
5 # ifdef __GNUC__
6 # pragma GCC diagnostic ignored "-Wlong-long"
7 # endif
8 extern "C" {
9 #endif
10
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <stdlib.h>
14
15 #include <sys/types.h>
16
17 #include "export.h"
18
19 typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
20 unsigned char opaque[256];
21 } crypto_onetimeauth_poly1305_state;
22
23 SODIUM_EXPORT
24 size_t crypto_onetimeauth_poly1305_statebytes(void);
25
26 #define crypto_onetimeauth_poly1305_BYTES 16U
27 SODIUM_EXPORT
28 size_t crypto_onetimeauth_poly1305_bytes(void);
29
30 #define crypto_onetimeauth_poly1305_KEYBYTES 32U
31 SODIUM_EXPORT
32 size_t crypto_onetimeauth_poly1305_keybytes(void);
33
34 SODIUM_EXPORT
35 int crypto_onetimeauth_poly1305(unsigned char *out,
36 const unsigned char *in,
37 unsigned long long inlen,
38 const unsigned char *k)
39 __attribute__ ((nonnull(1, 4)));
40
41 SODIUM_EXPORT
42 int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
43 const unsigned char *in,
44 unsigned long long inlen,
45 const unsigned char *k)
46 __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
47
48 SODIUM_EXPORT
49 int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
50 const unsigned char *key)
51 __attribute__ ((nonnull));
52
53 SODIUM_EXPORT
54 int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
55 const unsigned char *in,
56 unsigned long long inlen)
57 __attribute__ ((nonnull(1)));
58
59 SODIUM_EXPORT
60 int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
61 unsigned char *out)
62 __attribute__ ((nonnull));
63
64 SODIUM_EXPORT
65 void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
66 __attribute__ ((nonnull));
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif