added 2 des test vectors
[strongswan.git] / src / libstrongswan / plugins / test_vectors / test_vectors / des.c
1 /*
2 * Copyright (C) 2009 Andreas Steffen
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the Licenseor (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be usefulbut
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include <crypto/crypto_tester.h>
17
18 /**
19 * All testvectors from https://www.cosic.esat.kuleuven.be/nessie/testvectors/
20 */
21
22 /**
23 * DES 56 bit: set 8, vector #0
24 */
25 crypter_test_vector_t des_ecb1 = {
26 .alg = ENCR_DES_ECB, .key_size = 8, .len = 8,
27 .key = "\x00\x01\x02\x03\x04\x05\x06\x07",
28 .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
29 .plain = "\x41\xAD\x06\x85\x48\x80\x9D\x02",
30 .cipher = "\x00\x11\x22\x33\x44\x55\x66\x77"
31 };
32
33 /**
34 * DES 56 bit: set 8, vector #1
35 */
36 crypter_test_vector_t des_ecb2 = {
37 .alg = ENCR_DES_ECB, .key_size = 8, .len = 8,
38 .key = "\x2B\xD6\x45\x9F\x82\xC5\xB3\x00",
39 .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
40 .plain = "\xB1\x0F\x84\x30\x97\xA0\xF9\x32",
41 .cipher = "\xEA\x02\x47\x14\xAD\x5C\x4D\x84"
42 };
43
44 /**
45 * DES 56 bit: set 8, vector #0
46 */
47 crypter_test_vector_t des_cbc1 = {
48 .alg = ENCR_DES, .key_size = 8, .len = 8,
49 .key = "\x00\x01\x02\x03\x04\x05\x06\x07",
50 .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
51 .plain = "\x41\xAD\x06\x85\x48\x80\x9D\x02",
52 .cipher = "\x00\x11\x22\x33\x44\x55\x66\x77"
53 };
54
55 /**
56 * DES 56 bit: set 8, vector #1
57 */
58 crypter_test_vector_t des_cbc2 = {
59 .alg = ENCR_DES, .key_size = 8, .len = 8,
60 .key = "\x2B\xD6\x45\x9F\x82\xC5\xB3\x00",
61 .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
62 .plain = "\xB1\x0F\x84\x30\x97\xA0\xF9\x32",
63 .cipher = "\xEA\x02\x47\x14\xAD\x5C\x4D\x84"
64 };
65