fix missing newline at end of src/test/Makefile
[fw/altos] / src / test / ao_aes_test.c
1 /*
2  * Copyright © 2013 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #define __pdata
19 #define __data
20 #define __xdata
21 #define __code
22 #define __reentrant
23
24 #include <string.h>
25 #include <stdio.h>
26
27 #define AO_AES_TEST     1
28
29 #include "../aes/ao_aes_tables.c"
30 #include "../aes/ao_aes.c"
31
32 static uint8_t key[16];
33 static uint8_t text[16];
34 static uint8_t cbc[16];
35
36 int
37 main (int argc, char **argv)
38 {
39         int i;
40
41         ao_aes_init();
42         ao_aes_set_mode(ao_aes_mode_cbc_mac);
43         ao_aes_set_key(key);
44         ao_aes_zero_iv();
45         ao_aes_run(text, cbc);
46
47         printf ("CBC");
48         for (i = 0; i < sizeof (cbc); i++)
49                 printf (" %02x", cbc[i]);
50         printf ("\n");
51         return 0;
52 }