libsodium: updated to 1.0.10
[tomato.git] / release / src / router / libsodium / src / libsodium / crypto_stream / xsalsa20 / ref / stream_xsalsa20.c
blob1e6513a8e5561fd8aa51ad1973552fe1b49f787c
1 /*
2 version 20080914
3 D. J. Bernstein
4 Public domain.
5 */
7 #include "crypto_core_hsalsa20.h"
8 #include "crypto_stream_salsa20.h"
9 #include "crypto_stream_xsalsa20.h"
10 #include "utils.h"
12 int crypto_stream_xsalsa20(
13 unsigned char *c,unsigned long long clen,
14 const unsigned char *n,
15 const unsigned char *k
18 unsigned char subkey[32];
19 int ret;
20 crypto_core_hsalsa20(subkey,n,k,NULL);
21 ret = crypto_stream_salsa20(c,clen,n + 16,subkey);
22 sodium_memzero(subkey, sizeof subkey);
23 return ret;