diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
commit | e2967396ac73cb7410787886cdaf072a184ffc49 (patch) | |
tree | 527a74d25a4a0705fc641994fd35bfab22662034 /nacl/crypto_stream/xsalsa20/ref/stream.c | |
parent | 8928c817df345f29aa0b194743595aa11bd6a8ba (diff) |
Added NaCl crypto library.
Diffstat (limited to 'nacl/crypto_stream/xsalsa20/ref/stream.c')
-rw-r--r-- | nacl/crypto_stream/xsalsa20/ref/stream.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nacl/crypto_stream/xsalsa20/ref/stream.c b/nacl/crypto_stream/xsalsa20/ref/stream.c new file mode 100644 index 00000000..2d710709 --- /dev/null +++ b/nacl/crypto_stream/xsalsa20/ref/stream.c | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | version 20080914 | ||
3 | D. J. Bernstein | ||
4 | Public domain. | ||
5 | */ | ||
6 | |||
7 | #include "crypto_core_hsalsa20.h" | ||
8 | #include "crypto_stream_salsa20.h" | ||
9 | #include "crypto_stream.h" | ||
10 | |||
11 | static const unsigned char sigma[16] = "expand 32-byte k"; | ||
12 | |||
13 | int crypto_stream( | ||
14 | unsigned char *c,unsigned long long clen, | ||
15 | const unsigned char *n, | ||
16 | const unsigned char *k | ||
17 | ) | ||
18 | { | ||
19 | unsigned char subkey[32]; | ||
20 | crypto_core_hsalsa20(subkey,n,k,sigma); | ||
21 | return crypto_stream_salsa20(c,clen,n + 16,subkey); | ||
22 | } | ||