libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / src / libsodium / crypto_box / curve25519xsalsa20poly1305 / ref / before_curve25519xsalsa20poly1305.c
blob40d4300ef6dcbd5f2805e1c8da94417863436185
1 #include "api.h"
2 #include "crypto_core_hsalsa20.h"
3 #include "crypto_scalarmult_curve25519.h"
5 static const unsigned char sigma[16] = {
6 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
7 };
8 static const unsigned char n[16] = {0};
10 int crypto_box_beforenm(
11 unsigned char *k,
12 const unsigned char *pk,
13 const unsigned char *sk
16 unsigned char s[32];
17 crypto_scalarmult_curve25519(s,sk,pk);
18 return crypto_core_hsalsa20(k,n,s,sigma);