1*0ac341f1SConrad Meyer
2*0ac341f1SConrad Meyer #define TEST_NAME "stream2"
3*0ac341f1SConrad Meyer #include "cmptest.h"
4*0ac341f1SConrad Meyer
5*0ac341f1SConrad Meyer static unsigned char secondkey[32] = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44,
6*0ac341f1SConrad Meyer 0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20,
7*0ac341f1SConrad Meyer 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21,
8*0ac341f1SConrad Meyer 0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e,
9*0ac341f1SConrad Meyer 0x66, 0x25, 0x6c, 0xe4 };
10*0ac341f1SConrad Meyer
11*0ac341f1SConrad Meyer static unsigned char noncesuffix[8] = { 0x82, 0x19, 0xe0, 0x03,
12*0ac341f1SConrad Meyer 0x6b, 0x7a, 0x0b, 0x37 };
13*0ac341f1SConrad Meyer
14*0ac341f1SConrad Meyer static unsigned char output[4194304];
15*0ac341f1SConrad Meyer
16*0ac341f1SConrad Meyer static unsigned char h[32];
17*0ac341f1SConrad Meyer
18*0ac341f1SConrad Meyer int
main(void)19*0ac341f1SConrad Meyer main(void)
20*0ac341f1SConrad Meyer {
21*0ac341f1SConrad Meyer int i;
22*0ac341f1SConrad Meyer crypto_stream_salsa20(output, sizeof output, noncesuffix, secondkey);
23*0ac341f1SConrad Meyer crypto_hash_sha256(h, output, sizeof output);
24*0ac341f1SConrad Meyer for (i = 0; i < 32; ++i)
25*0ac341f1SConrad Meyer printf("%02x", h[i]);
26*0ac341f1SConrad Meyer printf("\n");
27*0ac341f1SConrad Meyer
28*0ac341f1SConrad Meyer assert(sizeof output > 4000);
29*0ac341f1SConrad Meyer
30*0ac341f1SConrad Meyer crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 0U,
31*0ac341f1SConrad Meyer secondkey);
32*0ac341f1SConrad Meyer for (i = 0; i < 4000; ++i)
33*0ac341f1SConrad Meyer assert(output[i] == 0);
34*0ac341f1SConrad Meyer
35*0ac341f1SConrad Meyer crypto_stream_salsa20_xor_ic(output, output, 4000, noncesuffix, 1U,
36*0ac341f1SConrad Meyer secondkey);
37*0ac341f1SConrad Meyer crypto_hash_sha256(h, output, sizeof output);
38*0ac341f1SConrad Meyer for (i = 0; i < 32; ++i)
39*0ac341f1SConrad Meyer printf("%02x", h[i]);
40*0ac341f1SConrad Meyer printf("\n");
41*0ac341f1SConrad Meyer
42*0ac341f1SConrad Meyer assert(crypto_stream_salsa20_keybytes() > 0U);
43*0ac341f1SConrad Meyer assert(crypto_stream_salsa20_noncebytes() > 0U);
44*0ac341f1SConrad Meyer assert(crypto_stream_salsa20_messagebytes_max() > 0U);
45*0ac341f1SConrad Meyer
46*0ac341f1SConrad Meyer return 0;
47*0ac341f1SConrad Meyer }
48