2 #define TEST_NAME "core3"
5 static unsigned char SECONDKEY[32] = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44,
6 0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20,
7 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21,
8 0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e,
9 0x66, 0x25, 0x6c, 0xe4 };
11 static unsigned char NONCESUFFIX[8] = { 0x82, 0x19, 0xe0, 0x03,
12 0x6b, 0x7a, 0x0b, 0x37 };
14 static unsigned char C[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
15 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
20 unsigned char *secondkey;
22 unsigned char *noncesuffix;
24 unsigned char *output;
26 size_t output_len = 64 * 256 * 256;
31 secondkey = (unsigned char *) sodium_malloc(32);
32 memcpy(secondkey, SECONDKEY, 32);
33 noncesuffix = (unsigned char *) sodium_malloc(8);
34 memcpy(noncesuffix, NONCESUFFIX, 8);
35 c = (unsigned char *) sodium_malloc(16);
37 in = (unsigned char *) sodium_malloc(16);
38 output = (unsigned char *) sodium_malloc(output_len);
39 h = (unsigned char *) sodium_malloc(32);
41 for (i = 0; i < 8; i++) {
42 in[i] = noncesuffix[i];
49 crypto_core_salsa20(output + pos, in, secondkey, c);
56 crypto_hash_sha256(h, output, output_len);
58 for (i = 0; i < 32; ++i) {
63 #ifndef SODIUM_LIBRARY_MINIMAL
67 crypto_core_salsa2012(output + pos, in, secondkey, c);
74 crypto_hash_sha256(h, output, output_len);
76 for (i = 0; i < 32; ++i) {
84 crypto_core_salsa208(output + pos, in, secondkey, c);
91 crypto_hash_sha256(h, output, output_len);
93 for (i = 0; i < 32; ++i) {
98 printf("a4e3147dddd2ba7775939b50208a22eb3277d4e4bad8a1cfbc999c6bd392b638\n"
99 "017421baa9959cbe894bd003ec87938254f47c1e757eb66cf89c353d0c2b68de\n");
106 sodium_free(noncesuffix);
107 sodium_free(secondkey);
109 assert(crypto_core_salsa20_outputbytes() == crypto_core_salsa20_OUTPUTBYTES);
110 assert(crypto_core_salsa20_inputbytes() == crypto_core_salsa20_INPUTBYTES);
111 assert(crypto_core_salsa20_keybytes() == crypto_core_salsa20_KEYBYTES);
112 assert(crypto_core_salsa20_constbytes() == crypto_core_salsa20_CONSTBYTES);