1 #include <ccan/crypto/xtea/xtea.h>
2 /* Include the C files directly. */
3 #include <ccan/crypto/xtea/xtea.c>
4 #include <ccan/tap/tap.h>
12 /* This is how many tests you plan to run */
15 memset(&s, 1, sizeof(s));
17 for (v = 1; v; v <<= 1) {
18 e = xtea_encipher(&s, v);
19 ok1(xtea_decipher(&s, e) == v);
22 /* The only 32-iteration from the "test vectors" at
23 * http://www.cix.co.uk/~klockstone/teavect.htm:
24 * in=af20a390547571aa, N=32, k=27f917b1c1da899360e2acaaa6eb923d, out=d26428af0a202283
26 v = 0xaf20a390547571aaULL;
27 s.u.u32[0] = 0x27f917b1;
28 s.u.u32[1] = 0xc1da8993;
29 s.u.u32[2] = 0x60e2acaa;
30 s.u.u32[3] = 0xa6eb923d;
31 e = xtea_encipher(&s, v);
32 ok1(e == 0xd26428af0a202283ULL);
33 ok1(xtea_decipher(&s, e) == v);
35 /* This exits depending on whether all tests passed */