chiark / gitweb /
Build system: Use -lnsl only if inet_ntoa is not found otherwise.
[secnet.git] / eax-serpent-test.c
1 /*
2  * eax-serpent-test.c: test harness glue for EAX-Serpent
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 files are eax-serpent-test.vectors
30  * and eax-serpentbe-test.vectors.  eax-serpent-test.vectors was
31  * provided by Mark Wooding and eax-serpentbe-test.vectors was
32  * generated by this file (in its guise as eax-serpentbe-test).  I
33  * don't believe these test vecctors are creative works that attract
34  * copyright.  -iwj.
35  */
36
37 #include "eax-test.h"
38 #include "serpent.h"
39
40 #define BLOCK_SIZE 16
41 static struct keyInstance key;
42
43 EAX_SOME_TEST;
44
45 void eaxtest_blockcipher_key_setup(const uint8_t *keydata, uint8_t bytes)
46 {
47     serpent_makekey(&key, bytes*8, keydata);
48 }
49
50 static void BLOCK_ENCRYPT(uint8_t dst[BLOCK_SIZE],
51                           const uint8_t src[BLOCK_SIZE])
52 {
53     serpent_encrypt(&key, src, dst);
54 }
55
56 #include "eax.c"