-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhaclnacl.h
145 lines (111 loc) · 4.87 KB
/
haclnacl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <inttypes.h>
/* NaCl-like API */
int crypto_onetimeauth(uint8_t *output, uint8_t *input, uint64_t input_len, uint8_t *key);
int crypto_onetimeauth_verify(uint8_t *output, uint8_t *input, uint64_t input_len, uint8_t *key);
int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
const unsigned char *sk)
__attribute__ ((warn_unused_result));
int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
int crypto_scalarmult(unsigned char *q, const unsigned char *n,
const unsigned char *p)
__attribute__ ((warn_unused_result));
int crypto_sign(uint8_t *signed_msg, long long unsigned int *signed_len, uint8_t *msg, uint64_t msg_len,
uint8_t *sk);
int crypto_sign_open(uint8_t *unsigned_msg, long long unsigned int *unsigned_msg_len,
uint8_t *msg, uint64_t msg_len, uint8_t *pk);
int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[32]);
int crypto_sign_secret_to_public(uint8_t *pk, uint8_t *sk);
int crypto_box(uint8_t *cipher, uint8_t *message, uint64_t msg_len, uint8_t *nonce, uint8_t *pk, uint8_t *sk);
int crypto_box_open(uint8_t *msg, uint8_t *cipher, uint64_t cipher_len, uint8_t *nonce, uint8_t *pk, uint8_t *sk);
int crypto_box_afternm(uint8_t *cipher, uint8_t *msg, uint64_t msg_len, uint8_t *nonce, uint8_t *key);
int crypto_box_open_afternm(uint8_t *msg, uint8_t *cipher, uint64_t cipher_len, uint8_t *nonce, uint8_t *key);
int crypto_secretbox(uint8_t *cipher, uint8_t *msg, uint64_t msg_len, uint8_t *nonce, uint8_t *key);
int crypto_secretbox_open(uint8_t *msg, uint8_t *cipher, uint64_t cipher_len, uint8_t *nonce, uint8_t *key);
int crypto_stream(uint8_t *cipher, uint64_t cipher_len, uint8_t *nonce, uint8_t *key);
int crypto_stream_xor(uint8_t *cipher, uint8_t *msg, uint64_t cipher_len, uint8_t *nonce, uint8_t *key);
void chacha20(uint8_t *output, uint8_t *plain, uint32_t plain_len, uint8_t *key, uint8_t *nonce, uint32_t ctr);
uint32_t aead_chacha20_poly1305_encrypt(uint8_t *cipher, uint8_t *mac, uint8_t *msg, uint32_t msg_len, uint8_t *aad, uint32_t aad_len, uint8_t *key, uint8_t *nonce);
uint32_t aead_chacha20_poly1305_decrypt(uint8_t *msg, uint8_t *cipher, uint32_t msg_len, uint8_t *mac, uint8_t *aad, uint32_t aad_len, uint8_t *key, uint8_t *nonce);
/* Other API (mix between NaCl's original API and LibSodium's API) */
/* int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m, */
/* unsigned long long mlen, const unsigned char *n, */
/* const unsigned char *k); */
/* int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c, */
/* unsigned long long clen, const unsigned char *n, */
/* const unsigned char *k) */
/* __attribute__ ((warn_unused_result)); */
/* int crypto_box_easy(unsigned char *c, const unsigned char *m, */
/* unsigned long long mlen, const unsigned char *n, */
/* const unsigned char *pk, const unsigned char *sk) */
/* __attribute__ ((warn_unused_result)); */
/* int crypto_box_open_easy(unsigned char *m, const unsigned char *c, */
/* unsigned long long clen, const unsigned char *n, */
/* const unsigned char *pk, const unsigned char *sk) */
/* __attribute__ ((warn_unused_result)); */
/* uint32_t */
/* crypto_box_detached_afternm( */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint8_t *m, */
/* uint64_t mlen, */
/* uint8_t *n1, */
/* uint8_t *k1 */
/* ); */
/* uint32_t */
/* crypto_box_detached( */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint8_t *m, */
/* uint64_t mlen, */
/* uint8_t *n1, */
/* uint8_t *pk, */
/* uint8_t *sk */
/* ); */
/* uint32_t */
/* crypto_box_open_detached( */
/* uint8_t *m, */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint64_t mlen, */
/* uint8_t *n1, */
/* uint8_t *pk, */
/* uint8_t *sk */
/* ); */
/* uint32_t */
/* crypto_box_open_detached_afternm( */
/* uint8_t *m, */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint64_t mlen, */
/* uint8_t *n1, */
/* uint8_t *k1 */
/* ); */
/* uint32_t */
/* crypto_secretbox_detached( */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint8_t *m, */
/* uint64_t mlen, */
/* uint8_t *n1, */
/* uint8_t *k1 */
/* ); */
/* uint32_t */
/* crypto_secretbox_open_detached( */
/* uint8_t *m, */
/* uint8_t *c, */
/* uint8_t *mac, */
/* uint64_t clen, */
/* uint8_t *n1, */
/* uint8_t *k1 */
/* ); */
/* uint32_t */
/* crypto_secretbox_easy(uint8_t *c, uint8_t *m, uint64_t mlen, uint8_t *n1, uint8_t *k1); */
/* uint32_t */
/* crypto_secretbox_open_easy( */
/* uint8_t *m, */
/* uint8_t *c, */
/* uint64_t clen, */
/* uint8_t *n1, */
/* uint8_t *k1 */
/* ); */