status update, probably last commit
[rofl0r-kripto.git] / test / block / 3way.c
blob9a49e7e3a94d13335529d08a25a66579e1deccf6
1 /*
2 * Written in 2013 by Gregor Pintar <grpintar@gmail.com>
4 * To the extent possible under law, the author(s) have dedicated
5 * all copyright and related and neighboring rights to this software
6 * to the public domain worldwide.
7 *
8 * This software is distributed without any warranty.
10 * You should have received a copy of the CC0 Public Domain Dedication.
11 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
14 #include <stdint.h>
15 #include <stdio.h>
16 #include <string.h>
18 #include <kripto/block/3way.h>
20 int main(void)
22 kripto_block *s;
23 uint8_t t[12];
24 const uint8_t k[12] =
26 0xD2, 0xF0, 0x5B, 0x5E, 0xD6, 0x14,
27 0x41, 0x38, 0xCA, 0xB9, 0x20, 0xCD
29 const uint8_t pt[12] =
31 0x40, 0x59, 0xC7, 0x6E, 0x83, 0xAE,
32 0x9D, 0xC4, 0xAD, 0x21, 0xEC, 0xF7
34 const uint8_t ct[12] =
36 0x47, 0x8E, 0xA8, 0x71, 0x6B, 0x13,
37 0xF1, 0x7C, 0x15, 0xB1, 0x55, 0xED
40 puts("kripto_block_3way");
42 /* 96-bit key */
43 s = kripto_block_create(kripto_block_3way, 0, k, 12);
44 if(!s) puts("error");
46 kripto_block_encrypt(s, pt, t);
47 if(memcmp(t, ct, 12)) puts("96-bit key encrypt: FAIL");
48 else puts("96-bit key encrypt: OK");
50 kripto_block_decrypt(s, ct, t);
51 if(memcmp(t, pt, 12)) puts("96-bit key decrypt: FAIL");
52 else puts("96-bit key decrypt: OK");
54 kripto_block_destroy(s);
56 return 0;