8 #include "crypto_core_salsa20.h"
11 #ifndef HAVE_AMD64_ASM
13 typedef unsigned int uint32;
15 static const unsigned char sigma[16] = {
16 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
20 unsigned char *c,unsigned long long clen,
21 const unsigned char *n,
22 const unsigned char *k
26 unsigned char block[64];
27 unsigned char kcopy[32];
33 for (i = 0;i < 32;++i) kcopy[i] = k[i];
34 for (i = 0;i < 8;++i) in[i] = n[i];
35 for (i = 8;i < 16;++i) in[i] = 0;
38 crypto_core_salsa20(c,in,kcopy,sigma);
41 for (i = 8;i < 16;++i) {
42 u += (unsigned int) in[i];
52 crypto_core_salsa20(block,in,kcopy,sigma);
53 for (i = 0;i < (unsigned int) clen;++i) c[i] = block[i];
55 sodium_memzero(block, sizeof block);
56 sodium_memzero(kcopy, sizeof kcopy);