chiark / gitweb /
changelog: Retrospectively some items missing from 0.4.1
[secnet.git] / eax-aes-test.c
1 /*
2  * eax-aes-test.c: test harness glue for EAX-AES (EAX-Rijndael)
3  */
4 /*
5  * This file is Free Software.  It was originally written for secnet.
6  *
7  * Copyright 2013 Ian Jackson
8  *
9  * You may redistribute secnet as a whole and/or modify it under the
10  * terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 3, or (at your option) any
12  * later version.
13  *
14  * You may redistribute this file and/or modify it under the terms of
15  * the GNU General Public License as published by the Free Software
16  * Foundation; either version 2, or (at your option) any later
17  * version.
18  *
19  * This software is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this software; if not, see
26  * https://www.gnu.org/licenses/gpl.html.
27  */
28 /*
29  * The corresponding test vector file is eax-aes-test.vectors.  It was
30  * copied out of the AES (Rijndael) paper.  I don't believe it is a
31  * creative work that attracts copyright.  -iwj.
32  */
33
34 #include "eax-test.h"
35 #include "aes.h"
36
37 #define BLOCK_SIZE AES_BLOCK_SIZE
38 static AES_KEY key;
39
40 EAX_SOME_TEST;
41
42 void eaxtest_blockcipher_key_setup(const uint8_t *keydata, uint8_t bytes)
43 {
44     AES_set_encrypt_key(keydata, bytes*8, &key);
45 }
46
47 static void BLOCK_ENCRYPT(uint8_t dst[BLOCK_SIZE],
48                           const uint8_t src[BLOCK_SIZE])
49 {
50     AES_encrypt((const void*)src, (void*)dst, &key);
51 }
52
53 #include "eax.c"