libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / src / libsodium / sodium / compat.c
blob75db241872887604a6b563e21b3e7e42802067b2
2 #include "crypto_auth_hmacsha256.h"
3 #include "crypto_auth_hmacsha512256.h"
4 #include "crypto_box_curve25519xsalsa20poly1305.h"
5 #include "crypto_hash_sha256.h"
6 #include "crypto_hash_sha512.h"
7 #include "crypto_scalarmult_curve25519.h"
8 #include "crypto_secretbox_xsalsa20poly1305.h"
9 #include "crypto_sign_ed25519.h"
10 #include "crypto_stream_xsalsa20.h"
11 #include "crypto_verify_16.h"
12 #include "crypto_verify_32.h"
13 #include "export.h"
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
19 #undef crypto_hash_sha256_ref
20 SODIUM_EXPORT int
21 crypto_hash_sha256_ref(unsigned char *out, const unsigned char *in,
22 unsigned long long inlen)
24 return crypto_hash_sha256(out, in, inlen);
27 #undef crypto_hash_sha512_ref
28 SODIUM_EXPORT int
29 crypto_hash_sha512_ref(unsigned char *out, const unsigned char *in,
30 unsigned long long inlen)
32 return crypto_hash_sha512(out, in, inlen);
35 #undef crypto_auth_hmacsha256_ref
36 SODIUM_EXPORT int
37 crypto_auth_hmacsha256_ref(unsigned char *out, const unsigned char *in,
38 unsigned long long inlen, const unsigned char *k)
40 return crypto_auth_hmacsha256(out, in, inlen, k);
43 #undef crypto_auth_hmacsha256_ref_verify
44 SODIUM_EXPORT int
45 crypto_auth_hmacsha256_ref_verify(const unsigned char *h,
46 const unsigned char *in,
47 unsigned long long inlen,
48 const unsigned char *k)
50 return crypto_auth_hmacsha256_verify(h, in, inlen, k);
53 #undef crypto_auth_hmacsha512256_ref
54 SODIUM_EXPORT int
55 crypto_auth_hmacsha512256_ref(unsigned char *out, const unsigned char *in,
56 unsigned long long inlen, const unsigned char *k)
58 return crypto_auth_hmacsha512256(out, in, inlen, k);
61 #undef crypto_auth_hmacsha512256_ref_verify
62 SODIUM_EXPORT int
63 crypto_auth_hmacsha512256_ref_verify(const unsigned char *h,
64 const unsigned char *in,
65 unsigned long long inlen,
66 const unsigned char *k)
68 return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
71 #undef crypto_box_curve25519xsalsa20poly1305_ref_keypair
72 SODIUM_EXPORT int
73 crypto_box_curve25519xsalsa20poly1305_ref_keypair(unsigned char *pk,
74 unsigned char *sk)
76 return crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk);
79 #undef crypto_box_curve25519xsalsa20poly1305_ref_beforenm
80 SODIUM_EXPORT int
81 crypto_box_curve25519xsalsa20poly1305_ref_beforenm(unsigned char *k,
82 const unsigned char *pk,
83 const unsigned char *sk)
85 return crypto_box_curve25519xsalsa20poly1305_beforenm(k, pk, sk);
88 #undef crypto_box_curve25519xsalsa20poly1305_ref_afternm
89 SODIUM_EXPORT int
90 crypto_box_curve25519xsalsa20poly1305_ref_afternm(unsigned char *c,
91 const unsigned char *m,
92 unsigned long long mlen,
93 const unsigned char *n,
94 const unsigned char *k)
96 return crypto_box_curve25519xsalsa20poly1305_afternm(c, m, mlen, n, k);
99 #undef crypto_box_curve25519xsalsa20poly1305_ref_open_afternm
100 SODIUM_EXPORT int
101 crypto_box_curve25519xsalsa20poly1305_ref_open_afternm(unsigned char *m,
102 const unsigned char *c,
103 unsigned long long clen,
104 const unsigned char *n,
105 const unsigned char *k)
107 return crypto_box_curve25519xsalsa20poly1305_open_afternm(m, c, clen, n, k);
110 #undef crypto_box_curve25519xsalsa20poly1305_ref
111 SODIUM_EXPORT int
112 crypto_box_curve25519xsalsa20poly1305_ref(unsigned char *c,
113 const unsigned char *m,
114 unsigned long long mlen,
115 const unsigned char *n,
116 const unsigned char *pk,
117 const unsigned char *sk)
119 return crypto_box_curve25519xsalsa20poly1305(c, m, mlen, n, pk, sk);
122 #undef crypto_box_curve25519xsalsa20poly1305_ref_open
123 SODIUM_EXPORT int
124 crypto_box_curve25519xsalsa20poly1305_ref_open(unsigned char *m,
125 const unsigned char *c,
126 unsigned long long clen,
127 const unsigned char *n,
128 const unsigned char *pk,
129 const unsigned char *sk)
131 return crypto_box_curve25519xsalsa20poly1305_open(m, c, clen, n, pk, sk);
134 #undef crypto_scalarmult_curve25519_ref_base
135 SODIUM_EXPORT int
136 crypto_scalarmult_curve25519_ref_base(unsigned char *q, const unsigned char *n)
138 return crypto_scalarmult_curve25519_base(q, n);
141 #undef crypto_scalarmult_curve25519_ref
142 SODIUM_EXPORT int
143 crypto_scalarmult_curve25519_ref(unsigned char *q, const unsigned char *n,
144 const unsigned char *p)
146 return crypto_scalarmult_curve25519(q, n, p);
149 #undef crypto_secretbox_xsalsa20poly1305_ref
150 SODIUM_EXPORT int
151 crypto_secretbox_xsalsa20poly1305_ref(unsigned char *c,
152 const unsigned char *m,
153 unsigned long long mlen,
154 const unsigned char *n,
155 const unsigned char *k)
157 return crypto_secretbox_xsalsa20poly1305(c, m, mlen, n, k);
160 #undef crypto_secretbox_xsalsa20poly1305_ref_open
161 SODIUM_EXPORT int
162 crypto_secretbox_xsalsa20poly1305_ref_open(unsigned char *m,
163 const unsigned char *c,
164 unsigned long long clen,
165 const unsigned char *n,
166 const unsigned char *k)
168 return crypto_secretbox_xsalsa20poly1305_open(m, c, clen, n, k);
171 #undef crypto_sign_ed25519_ref_seed_keypair
172 SODIUM_EXPORT int
173 crypto_sign_ed25519_ref_seed_keypair(unsigned char *pk, unsigned char *sk,
174 const unsigned char *seed)
176 return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
179 #undef crypto_sign_ed25519_ref_keypair
180 SODIUM_EXPORT int
181 crypto_sign_ed25519_ref_keypair(unsigned char *pk, unsigned char *sk)
183 return crypto_sign_ed25519_keypair(pk, sk);
186 #undef crypto_sign_ed25519_ref
187 SODIUM_EXPORT int
188 crypto_sign_ed25519_ref(unsigned char *sm, unsigned long long *smlen,
189 const unsigned char *m, unsigned long long mlen,
190 const unsigned char *sk)
192 return crypto_sign_ed25519(sm, smlen, m, mlen, sk);
195 #undef crypto_sign_ed25519_ref_open
196 SODIUM_EXPORT int
197 crypto_sign_ed25519_ref_open(unsigned char *m, unsigned long long *mlen,
198 const unsigned char *sm, unsigned long long smlen,
199 const unsigned char *pk)
201 return crypto_sign_ed25519_open(m, mlen, sm, smlen, pk);
204 #undef crypto_stream_xsalsa20_ref
205 SODIUM_EXPORT int
206 crypto_stream_xsalsa20_ref(unsigned char *c, unsigned long long clen,
207 const unsigned char *n, const unsigned char *k)
209 return crypto_stream_xsalsa20(c, clen, n, k);
212 #undef crypto_stream_xsalsa20_ref_xor
213 SODIUM_EXPORT int
214 crypto_stream_xsalsa20_ref_xor(unsigned char *c, const unsigned char *m,
215 unsigned long long mlen, const unsigned char *n,
216 const unsigned char *k)
218 return crypto_stream_xsalsa20_xor(c, m, mlen, n, k);
221 #undef crypto_verify_16_ref
222 SODIUM_EXPORT int
223 crypto_verify_16_ref(const unsigned char *x, const unsigned char *y)
225 return crypto_verify_16(x, y);
228 #undef crypto_verify_32_ref
229 SODIUM_EXPORT int
230 crypto_verify_32_ref(const unsigned char *x, const unsigned char *y)
232 return crypto_verify_32(x, y);
235 #ifdef __cplusplus
237 #endif