libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / src / libsodium / crypto_stream / xsalsa20 / ref / xor_xsalsa20.c
blob14cce18a5190e1a74642ac414ed8ea1d2b41a5eb
1 /*
2 version 20080913
3 D. J. Bernstein
4 Public domain.
5 */
7 #include "api.h"
8 #include "crypto_core_hsalsa20.h"
9 #include "crypto_stream_salsa20.h"
11 static const unsigned char sigma[16] = {
12 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
15 int crypto_stream_xor(
16 unsigned char *c,
17 const unsigned char *m,unsigned long long mlen,
18 const unsigned char *n,
19 const unsigned char *k
22 unsigned char subkey[32];
23 crypto_core_hsalsa20(subkey,n,k,sigma);
24 return crypto_stream_salsa20_xor(c,m,mlen,n + 16,subkey);