Commit 2e08dc07 authored by Niels Möller's avatar Niels Möller

Generate Salsa20 intermediate values.

parent c5e15342
......@@ -40,6 +40,28 @@
#include "macros.h"
#ifndef SALSA20_DEBUG
# define SALSA20_DEBUG 0
#endif
#if SALSA20_DEBUG
# include <stdio.h>
# define DEBUG(i) do { \
unsigned debug_j; \
for (debug_j = 0; debug_j < 16; debug_j++) \
{ \
if (debug_j == 0) \
fprintf(stderr, "%2d:", (i)); \
else if (debug_j % 4 == 0) \
fprintf(stderr, "\n "); \
fprintf(stderr, " %8x", x[debug_j]); \
} \
fprintf(stderr, "\n"); \
} while (0)
#else
# define DEBUG(i)
#endif
#ifdef WORDS_BIGENDIAN
#define LE_SWAP32(v) \
((ROTL32(8, v) & 0x00FF00FFUL) | \
......@@ -66,16 +88,19 @@ _salsa20_core(uint32_t *dst, const uint32_t *src, unsigned rounds)
memcpy (x, src, sizeof(x));
for (i = 0; i < rounds;i += 2)
{
DEBUG (i);
QROUND(x[0], x[4], x[8], x[12]);
QROUND(x[5], x[9], x[13], x[1]);
QROUND(x[10], x[14], x[2], x[6]);
QROUND(x[15], x[3], x[7], x[11]);
DEBUG (i+1);
QROUND(x[0], x[1], x[2], x[3]);
QROUND(x[5], x[6], x[7], x[4]);
QROUND(x[10], x[11], x[8], x[9]);
QROUND(x[15], x[12], x[13], x[14]);
}
DEBUG (i);
for (i = 0; i < _SALSA20_INPUT_LENGTH; i++)
{
......
......@@ -259,3 +259,90 @@ test_main(void)
"637C7CA2B78B116F83AFF46E40F8F71D"
"4CD6D2E1B750D5E011D1DF2E80F7210A"));
}
/* Intermediate values for the first test case.
0: 61707865 80 0 0
0 3120646e 0 0
0 0 79622d36 80
0 0 0 6b206574
1: 50e6ebaf 3093463d f190e454 9032fa35
b83c32b0 7fdf3d47 eff21454 a6bf53f6
59562a33 90327718 9bc1ab3d 49c5665e
4b9c6232 a5b70d82 b1169b3c 8273a766
2: 877140ed bc61b44d 60af1c4e 8a219997
dfa36b55 9dc00f65 e245efc8 ece54d32
72a63aac c0dc93d7 a1cd6536 b3d44ccb
8ebd332b c4022fa0 5d4ff16b 65f222e
3: 26693f1 c7ef1593 549a3a3 9396e54a
c899675e 1f815f3 47c648d ebbc01
67f6ac0c d03d4afa 810d422e e7fd3e5b
8cd07539 3eb6917b 54e58e29 ef2c818d
4: 1dff67e3 39538859 717137d4 b935012
f279ff60 26098b57 4cc2cc68 752f0a9c
f62fef8b a3028de7 74c726e7 42bbaa73
85d7ae1b 36e9c191 791019b1 82263e6a
5: 5058d8b0 d3e44dcf 10bb47b1 7b673ef0
19f30031 111e4716 ec0295bc 6fd5bf67
12ffc7e4 d8b55c8 170d410 dd715714
dcd50b85 1f2bfff6 bde9be51 dbcb0b76
6: bc9cffbc 33ef9daa 8057f2b9 896b4878
705ae8b d14227c3 64a13629 112fc18c
bfe180ad eaf359a0 68467f43 a365bb13
6b1e849 e6cc8032 70e6c3fe cb0a55bb
7: 8d90ced2 54d545b4 85be446e b1632f4f
a071ac6a 90e0a919 33e1e736 ca25d574
a2b9cc17 7211ef22 c6d499c3 83fdd462
69a1c02c 4ee14ab4 33c7598 6c536d35
8: 27885144 2d2a552b f3f9bf1b 33ebeb6b
104b8b7a a96110e 9acb26ae 9dba5b23
be384f78 4cdf3afc ef04b59d f0b9a6fe
ae50a69b 6c6ea81 f11fe33a 5abcb2ae
9: 3b2388b1 a820e0d9 1f008910 88c73d4e
fc306490 8188ba2d d0cae010 9a65a2e4
cf53e73f acec2667 4b870ab0 6cbfe29b
27295feb 2a801ee 16f1c6fe 4f40ae38
10: 6d52785f 5d421f38 d44f5a20 a7ec3b7c
c6a5c6cb f2a38eca c45beae 69415ff
93bbc87e cad09b7b c4627081 55276967
3e13c4d8 aa4e20f4 2a485bf2 bcdbfc61
11: 5136a836 dd9db9bc 50366ca5 a65edf75
75bb5d1e 6bd4e822 cb52477c 7323b939
881133b8 38079a5c 14e61ea3 632aa57
ac091b61 fc1c6ca1 7e5fcc1a 329a1938
12: 5e0ca897 175e6c47 7a1e9674 609ad5a
ac25229b 49de7bae 370e70c f8bde5e7
21f81ab3 e6130800 9e2a3e8f 70eed5f1
d0fbb239 d78a8ea6 b644390a 2c582e03
13: 99fc90d3 f3e42871 78784440 a5885714
28084a8c 27900f47 e453b985 39b7ca44
81e5dbf 7860f2b0 693f4da0 74c5ce19
5f2d43d a9563322 7bd6f4da 4d2e97f5
14: 25571a99 3197dbee 50a1c7d7 91f0e753
2528837d 56153f81 287f5022 270918e4
42764fa3 fea16e5b 9ec649fe a4e5e669
8734b3d9 6fc1ae8a b79a8a04 af160a85
15: 34b906a6 3f56196a 6b690cbf 6c08907a
60cfba2b 819592a7 3c9b803a 1a3ce6d2
fdfc6af 282cd998 ad20e9ec a0c76a1
772ffdcc ebf39c76 15579a67 dada9ba0
16: 3d87b380 5f9d893a c676cd97 e6d2b4b8
7d6ca34a 1dc97a79 e3de94b bccb03cd
12e2a81b 23b00e62 74d433a6 acedb4cb
6e34fe34 f4c034e4 b3349639 f6ac0473
17: e014e81d 916efb68 d833f0c9 2a0e2be9
a334791f 71573537 d5c5cb06 c8abbb8c
6abb97da 9031d7dc 9bea8440 90030a9c
6c2bdf8a 2649fbf 3a3aeef8 ee0d66c8
18: e9fb1dd3 80e4f86d 2bf2e408 d1809e73
20872c8d d93bc116 9012e00c 1c813d8e
45aa03ae 7136cba6 a6b85fc3 9e2d048a
48013f9e 1f2853d3 854c21d b9cdfb3c
19: 3d47db86 8392cea8 2cf87621 2cff7d58
dea99415 5800a055 e3661354 86701443
cc9d23f 616a0a0b 836c1eb9 6c1e72e7
24cba2f0 54be11a6 6dcb2586 a5663106
20: e6ee81e8 a03ea19d 2002319a 36998550
eefc52da e4e51bb3 b67c264f 7ffd5c5f
e0974f2b 4a9216ff 1bc4b21c 70a1095
bc60e4f9 da95ef65 b740f758 3f90765d
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment