status update, probably last commit
[rofl0r-kripto.git] / test / block / skipjack.c
blobe92df315a0f93f05f592a140caa18a3579052c4d
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>
17 #include <kripto/block/skipjack.h>
19 int main(void)
21 kripto_block *s;
22 unsigned int i;
23 uint8_t t[8];
24 const uint8_t k[10] =
26 0x00, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
28 const uint8_t pt[8] =
30 0x33, 0x22, 0x11, 0x00, 0xDD, 0xCC, 0xBB, 0xAA
32 const uint8_t ct[8] =
34 0x25, 0x87, 0xCA, 0xE2, 0x7A, 0x12, 0xD3, 0x00
37 puts("kripto_block_skipjack");
39 s = kripto_block_create(kripto_block_skipjack, 0, k, 10);
40 if(!s) puts("error");
42 kripto_block_encrypt(s, pt, t);
43 for(i = 0; i < 8; i++) if(t[i] != ct[i])
45 puts("encrypt: FAIL");
46 break;
48 if(i == 8) puts("encrypt: OK");
50 kripto_block_decrypt(s, ct, t);
51 for(i = 0; i < 8; i++) if(t[i] != pt[i])
53 puts("decrypt: FAIL");
54 break;
56 if(i == 8) puts("decrypt: OK");
58 kripto_block_destroy(s);
60 return 0;