libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / src / libsodium / crypto_stream / xsalsa20 / ref / stream_xsalsa20.c
blob50f8788739c02ec05e46ecba3bd2101df6aa2322
1 /*
2 version 20080914
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(
16 unsigned char *c,unsigned long long clen,
17 const unsigned char *n,
18 const unsigned char *k
21 unsigned char subkey[32];
22 crypto_core_hsalsa20(subkey,n,k,sigma);
23 return crypto_stream_salsa20(c,clen,n + 16,subkey);