added MD5 test vectors
[strongswan.git] / src / libstrongswan / plugins / test_vectors / test_vectors / aes_xcbc.c
1 /*
2 * Copyright (C) 2009 Martin Willi
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 * RFC 3566 Test Case #1: AES-XCBC-MAC-96 with 0-byte input
20 */
21 signer_test_vector_t aes_xcbc_s1 = {
22 .alg = AUTH_AES_XCBC_96, .len = 0,
23 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
24 .data = "",
25 .mac = "\x75\xf0\x25\x1d\x52\x8a\xc0\x1c\x45\x73\xdf\xd5"
26 };
27
28 prf_test_vector_t aes_xcbc_p1 = {
29 .alg = PRF_AES128_XCBC, .key_size = 16, .len = 0,
30 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
31 .seed = "",
32 .out = "\x75\xf0\x25\x1d\x52\x8a\xc0\x1c\x45\x73\xdf\xd5\x84\xd7\x9f\x29"
33 };
34
35 /**
36 * RFC 3566 Test Case #2: AES-XCBC-MAC-96 with 3-byte input
37 */
38 signer_test_vector_t aes_xcbc_s2 = {
39 .alg = AUTH_AES_XCBC_96, .len = 3,
40 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
41 .data = "\x00\x01\x02",
42 .mac = "\x5b\x37\x65\x80\xae\x2f\x19\xaf\xe7\x21\x9c\xee"
43 };
44
45 prf_test_vector_t aes_xcbc_p2 = {
46 .alg = PRF_AES128_XCBC, .key_size = 16, .len = 3,
47 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
48 .seed = "\x00\x01\x02",
49 .out = "\x5b\x37\x65\x80\xae\x2f\x19\xaf\xe7\x21\x9c\xee\xf1\x72\x75\x6f"
50 };
51
52 /**
53 * RFC 3566 Test Case #3: AES-XCBC-MAC-96 with 16-byte input
54 */
55 signer_test_vector_t aes_xcbc_s3 = {
56 .alg = AUTH_AES_XCBC_96, .len = 16,
57 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
58 .data = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
59 .mac = "\xd2\xa2\x46\xfa\x34\x9b\x68\xa7\x99\x98\xa4\x39"
60 };
61
62 prf_test_vector_t aes_xcbc_p3 = {
63 .alg = PRF_AES128_XCBC, .key_size = 16, .len = 16,
64 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
65 .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
66 .out = "\xd2\xa2\x46\xfa\x34\x9b\x68\xa7\x99\x98\xa4\x39\x4f\xf7\xa2\x63"
67 };
68
69 /**
70 * RFC 3566 Test Case #4: AES-XCBC-MAC-96 with 20-byte input
71 */
72 signer_test_vector_t aes_xcbc_s4 = {
73 .alg = AUTH_AES_XCBC_96, .len = 20,
74 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
75 .data = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
76 "\x10\x11\x12\x13",
77 .mac = "\x47\xf5\x1b\x45\x64\x96\x62\x15\xb8\x98\x5c\x63"
78 };
79
80 prf_test_vector_t aes_xcbc_p4 = {
81 .alg = PRF_AES128_XCBC, .key_size = 16, .len = 20,
82 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
83 .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
84 "\x10\x11\x12\x13",
85 .out = "\x47\xf5\x1b\x45\x64\x96\x62\x15\xb8\x98\x5c\x63\x05\x5e\xd3\x08"
86 };
87
88 /**
89 * RFC 3566 Test Case #5: AES-XCBC-MAC-96 with 32-byte input
90 */
91 signer_test_vector_t aes_xcbc_s5 = {
92 .alg = AUTH_AES_XCBC_96, .len = 32,
93 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
94 .data = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
95 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
96 .mac = "\xf5\x4f\x0e\xc8\xd2\xb9\xf3\xd3\x68\x07\x73\x4b"
97 };
98
99 prf_test_vector_t aes_xcbc_p5 = {
100 .alg = PRF_AES128_XCBC, .key_size = 16, .len = 32,
101 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
102 .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
103 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
104 .out = "\xf5\x4f\x0e\xc8\xd2\xb9\xf3\xd3\x68\x07\x73\x4b\xd5\x28\x3f\xd4"
105 };
106
107 /**
108 * RFC4434 Test Case: AES-XCBC-PRF-128 with 20-byte input, 10 byte key
109 */
110 prf_test_vector_t aes_xcbc_p6 = {
111 .alg = PRF_AES128_XCBC, .key_size = 10, .len = 20,
112 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09",
113 .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
114 "\x10\x11\x12\x13",
115 .out = "\x0f\xa0\x87\xaf\x7d\x86\x6e\x76\x53\x43\x4e\x60\x2f\xdd\xe8\x35"
116 };
117
118 /**
119 * RFC4434 Test Case: AES-XCBC-PRF-128 with 20-byte input, 18 byte key
120 */
121 prf_test_vector_t aes_xcbc_p7 = {
122 .alg = PRF_AES128_XCBC, .key_size = 18, .len = 20,
123 .key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
124 "\xed\xcb",
125 .seed = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
126 "\x10\x11\x12\x13",
127 .out = "\x8c\xd3\xc9\x3a\xe5\x98\xa9\x80\x30\x06\xff\xb6\x7c\x40\xe9\xe4"
128 };
129