Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Quick & dirty crypto testing module. |
| 3 | * |
| 4 | * This will only exist until we have a better testing mechanism |
| 5 | * (e.g. a char device). |
| 6 | * |
| 7 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> |
| 8 | * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 12 | * Software Foundation; either version 2 of the License, or (at your option) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * any later version. |
| 14 | * |
Harald Welte | ebfd9bc | 2005-06-22 13:27:23 -0700 | [diff] [blame] | 15 | * 2004-08-09 Cipher speed tests by Reyk Floeter <reyk@vantronix.net> |
| 16 | * 2003-09-14 Changes by Kartikey Mahendra Bhatt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | #ifndef _CRYPTO_TCRYPT_H |
| 20 | #define _CRYPTO_TCRYPT_H |
| 21 | |
| 22 | #define MAX_DIGEST_SIZE 64 |
| 23 | #define MAX_TAP 8 |
| 24 | |
| 25 | #define MAX_KEYLEN 56 |
| 26 | #define MAX_IVLEN 32 |
| 27 | |
| 28 | struct hash_testvec { |
Atsushi Nemoto | 06b42aa | 2006-03-13 21:39:23 +1100 | [diff] [blame] | 29 | /* only used with keyed hash algorithms */ |
| 30 | char key[128] __attribute__ ((__aligned__(4))); |
Herbert Xu | c907ee7 | 2006-08-21 22:04:03 +1000 | [diff] [blame] | 31 | char plaintext[240]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | char digest[MAX_DIGEST_SIZE]; |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 33 | unsigned char tap[MAX_TAP]; |
Atsushi Nemoto | 06b42aa | 2006-03-13 21:39:23 +1100 | [diff] [blame] | 34 | unsigned char psize; |
| 35 | unsigned char np; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | unsigned char ksize; |
| 37 | }; |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | struct cipher_testvec { |
Atsushi Nemoto | 06b42aa | 2006-03-13 21:39:23 +1100 | [diff] [blame] | 40 | char key[MAX_KEYLEN] __attribute__ ((__aligned__(4))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | char iv[MAX_IVLEN]; |
Rik Snel | f3d1044 | 2006-11-29 19:01:41 +1100 | [diff] [blame] | 42 | char input[512]; |
| 43 | char result[512]; |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 44 | unsigned char tap[MAX_TAP]; |
Atsushi Nemoto | 06b42aa | 2006-03-13 21:39:23 +1100 | [diff] [blame] | 45 | int np; |
| 46 | unsigned char fail; |
| 47 | unsigned char wk; /* weak key flag */ |
| 48 | unsigned char klen; |
Rik Snel | f3d1044 | 2006-11-29 19:01:41 +1100 | [diff] [blame] | 49 | unsigned short ilen; |
| 50 | unsigned short rlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
Harald Welte | ebfd9bc | 2005-06-22 13:27:23 -0700 | [diff] [blame] | 53 | struct cipher_speed { |
| 54 | unsigned char klen; |
| 55 | unsigned int blen; |
| 56 | }; |
| 57 | |
Herbert Xu | e9d4116 | 2006-08-19 21:38:49 +1000 | [diff] [blame] | 58 | struct hash_speed { |
Michal Ludvig | e805792 | 2006-05-30 22:04:19 +1000 | [diff] [blame] | 59 | unsigned int blen; /* buffer length */ |
| 60 | unsigned int plen; /* per-update length */ |
| 61 | }; |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | /* |
| 64 | * MD4 test vectors from RFC1320 |
| 65 | */ |
| 66 | #define MD4_TEST_VECTORS 7 |
| 67 | |
| 68 | static struct hash_testvec md4_tv_template [] = { |
| 69 | { |
| 70 | .plaintext = "", |
| 71 | .digest = { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, |
| 72 | 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 }, |
| 73 | }, { |
| 74 | .plaintext = "a", |
| 75 | .psize = 1, |
| 76 | .digest = { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, |
| 77 | 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 }, |
| 78 | }, { |
| 79 | .plaintext = "abc", |
| 80 | .psize = 3, |
| 81 | .digest = { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, |
| 82 | 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d }, |
| 83 | }, { |
| 84 | .plaintext = "message digest", |
| 85 | .psize = 14, |
| 86 | .digest = { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, |
| 87 | 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b }, |
| 88 | }, { |
| 89 | .plaintext = "abcdefghijklmnopqrstuvwxyz", |
| 90 | .psize = 26, |
| 91 | .digest = { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, |
| 92 | 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 }, |
| 93 | .np = 2, |
| 94 | .tap = { 13, 13 }, |
| 95 | }, { |
| 96 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", |
| 97 | .psize = 62, |
| 98 | .digest = { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, |
| 99 | 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 }, |
| 100 | }, { |
| 101 | .plaintext = "123456789012345678901234567890123456789012345678901234567890123" |
| 102 | "45678901234567890", |
| 103 | .psize = 80, |
| 104 | .digest = { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, |
| 105 | 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 }, |
| 106 | }, |
| 107 | }; |
| 108 | |
| 109 | /* |
| 110 | * MD5 test vectors from RFC1321 |
| 111 | */ |
| 112 | #define MD5_TEST_VECTORS 7 |
| 113 | |
| 114 | static struct hash_testvec md5_tv_template[] = { |
| 115 | { |
| 116 | .digest = { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, |
| 117 | 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e }, |
| 118 | }, { |
| 119 | .plaintext = "a", |
| 120 | .psize = 1, |
| 121 | .digest = { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, |
| 122 | 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 }, |
| 123 | }, { |
| 124 | .plaintext = "abc", |
| 125 | .psize = 3, |
| 126 | .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, |
| 127 | 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 }, |
| 128 | }, { |
| 129 | .plaintext = "message digest", |
| 130 | .psize = 14, |
| 131 | .digest = { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, |
| 132 | 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 }, |
| 133 | }, { |
| 134 | .plaintext = "abcdefghijklmnopqrstuvwxyz", |
| 135 | .psize = 26, |
| 136 | .digest = { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, |
| 137 | 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b }, |
| 138 | .np = 2, |
| 139 | .tap = {13, 13} |
| 140 | }, { |
| 141 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", |
| 142 | .psize = 62, |
| 143 | .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, |
| 144 | 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f }, |
| 145 | }, { |
| 146 | .plaintext = "12345678901234567890123456789012345678901234567890123456789012" |
| 147 | "345678901234567890", |
| 148 | .psize = 80, |
| 149 | .digest = { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, |
| 150 | 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a }, |
| 151 | } |
| 152 | }; |
| 153 | |
| 154 | /* |
| 155 | * SHA1 test vectors from from FIPS PUB 180-1 |
| 156 | */ |
| 157 | #define SHA1_TEST_VECTORS 2 |
| 158 | |
| 159 | static struct hash_testvec sha1_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 160 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | .plaintext = "abc", |
| 162 | .psize = 3, |
| 163 | .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, |
| 164 | 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d }, |
| 165 | }, { |
| 166 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 167 | .psize = 56, |
| 168 | .digest = { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae, |
| 169 | 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 }, |
| 170 | .np = 2, |
| 171 | .tap = { 28, 28 } |
| 172 | } |
| 173 | }; |
| 174 | |
| 175 | /* |
| 176 | * SHA256 test vectors from from NIST |
| 177 | */ |
| 178 | #define SHA256_TEST_VECTORS 2 |
| 179 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 180 | static struct hash_testvec sha256_tv_template[] = { |
| 181 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | .plaintext = "abc", |
| 183 | .psize = 3, |
| 184 | .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, |
| 185 | 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, |
| 186 | 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, |
| 187 | 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }, |
| 188 | }, { |
| 189 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 190 | .psize = 56, |
| 191 | .digest = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, |
| 192 | 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, |
| 193 | 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, |
| 194 | 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 }, |
| 195 | .np = 2, |
| 196 | .tap = { 28, 28 } |
| 197 | }, |
| 198 | }; |
| 199 | |
| 200 | /* |
| 201 | * SHA384 test vectors from from NIST and kerneli |
| 202 | */ |
| 203 | #define SHA384_TEST_VECTORS 4 |
| 204 | |
| 205 | static struct hash_testvec sha384_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 206 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | .plaintext= "abc", |
| 208 | .psize = 3, |
| 209 | .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, |
| 210 | 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07, |
| 211 | 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, |
| 212 | 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed, |
| 213 | 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, |
| 214 | 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 }, |
| 215 | }, { |
| 216 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 217 | .psize = 56, |
| 218 | .digest = { 0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39, |
| 219 | 0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39, |
| 220 | 0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab, |
| 221 | 0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6, |
| 222 | 0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f, |
| 223 | 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b}, |
| 224 | }, { |
| 225 | .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 226 | "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | .psize = 112, |
| 228 | .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, |
| 229 | 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, |
| 230 | 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2, |
| 231 | 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12, |
| 232 | 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9, |
| 233 | 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 }, |
| 234 | }, { |
| 235 | .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd" |
| 236 | "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", |
| 237 | .psize = 104, |
| 238 | .digest = { 0x3d, 0x20, 0x89, 0x73, 0xab, 0x35, 0x08, 0xdb, |
| 239 | 0xbd, 0x7e, 0x2c, 0x28, 0x62, 0xba, 0x29, 0x0a, |
| 240 | 0xd3, 0x01, 0x0e, 0x49, 0x78, 0xc1, 0x98, 0xdc, |
| 241 | 0x4d, 0x8f, 0xd0, 0x14, 0xe5, 0x82, 0x82, 0x3a, |
| 242 | 0x89, 0xe1, 0x6f, 0x9b, 0x2a, 0x7b, 0xbc, 0x1a, |
| 243 | 0xc9, 0x38, 0xe2, 0xd1, 0x99, 0xe8, 0xbe, 0xa4 }, |
| 244 | .np = 4, |
| 245 | .tap = { 26, 26, 26, 26 } |
| 246 | }, |
| 247 | }; |
| 248 | |
| 249 | /* |
| 250 | * SHA512 test vectors from from NIST and kerneli |
| 251 | */ |
| 252 | #define SHA512_TEST_VECTORS 4 |
| 253 | |
| 254 | static struct hash_testvec sha512_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 255 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | .plaintext = "abc", |
| 257 | .psize = 3, |
| 258 | .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, |
| 259 | 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, |
| 260 | 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, |
| 261 | 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, |
| 262 | 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, |
| 263 | 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, |
| 264 | 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, |
| 265 | 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f }, |
| 266 | }, { |
| 267 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 268 | .psize = 56, |
| 269 | .digest = { 0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a, |
| 270 | 0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16, |
| 271 | 0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8, |
| 272 | 0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35, |
| 273 | 0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9, |
| 274 | 0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0, |
| 275 | 0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03, |
| 276 | 0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45 }, |
| 277 | }, { |
| 278 | .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" |
| 279 | "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", |
| 280 | .psize = 112, |
| 281 | .digest = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, |
| 282 | 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, |
| 283 | 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, |
| 284 | 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18, |
| 285 | 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4, |
| 286 | 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a, |
| 287 | 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, |
| 288 | 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 }, |
| 289 | }, { |
| 290 | .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd" |
| 291 | "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", |
| 292 | .psize = 104, |
| 293 | .digest = { 0x93, 0x0d, 0x0c, 0xef, 0xcb, 0x30, 0xff, 0x11, |
| 294 | 0x33, 0xb6, 0x89, 0x81, 0x21, 0xf1, 0xcf, 0x3d, |
| 295 | 0x27, 0x57, 0x8a, 0xfc, 0xaf, 0xe8, 0x67, 0x7c, |
| 296 | 0x52, 0x57, 0xcf, 0x06, 0x99, 0x11, 0xf7, 0x5d, |
| 297 | 0x8f, 0x58, 0x31, 0xb5, 0x6e, 0xbf, 0xda, 0x67, |
| 298 | 0xb2, 0x78, 0xe6, 0x6d, 0xff, 0x8b, 0x84, 0xfe, |
| 299 | 0x2b, 0x28, 0x70, 0xf7, 0x42, 0xa5, 0x80, 0xd8, |
| 300 | 0xed, 0xb4, 0x19, 0x87, 0x23, 0x28, 0x50, 0xc9 }, |
| 301 | .np = 4, |
| 302 | .tap = { 26, 26, 26, 26 } |
| 303 | }, |
| 304 | }; |
| 305 | |
| 306 | |
| 307 | /* |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 308 | * WHIRLPOOL test vectors from Whirlpool package |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE |
| 310 | * submission |
| 311 | */ |
| 312 | #define WP512_TEST_VECTORS 8 |
| 313 | |
| 314 | static struct hash_testvec wp512_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 315 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | .plaintext = "", |
| 317 | .psize = 0, |
| 318 | .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, |
| 319 | 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, |
| 320 | 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, |
| 321 | 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7, |
| 322 | 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB, |
| 323 | 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57, |
| 324 | 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37, |
| 325 | 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 }, |
| 326 | |
| 327 | |
| 328 | }, { |
| 329 | .plaintext = "a", |
| 330 | .psize = 1, |
| 331 | .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, |
| 332 | 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, |
| 333 | 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, |
| 334 | 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42, |
| 335 | 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6, |
| 336 | 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59, |
| 337 | 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5, |
| 338 | 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A }, |
| 339 | }, { |
| 340 | .plaintext = "abc", |
| 341 | .psize = 3, |
| 342 | .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, |
| 343 | 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, |
| 344 | 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, |
| 345 | 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C, |
| 346 | 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27, |
| 347 | 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6, |
| 348 | 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82, |
| 349 | 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 }, |
| 350 | }, { |
| 351 | .plaintext = "message digest", |
| 352 | .psize = 14, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 353 | .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, |
| 354 | 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, |
| 355 | 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, |
| 356 | 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, |
| 357 | 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, |
| 358 | 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6, |
| 359 | 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E }, |
| 361 | }, { |
| 362 | .plaintext = "abcdefghijklmnopqrstuvwxyz", |
| 363 | .psize = 26, |
| 364 | .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, |
| 365 | 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, |
| 366 | 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, |
| 367 | 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B, |
| 368 | 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A, |
| 369 | 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6, |
| 370 | 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D, |
| 371 | 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B }, |
| 372 | }, { |
| 373 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 374 | "abcdefghijklmnopqrstuvwxyz0123456789", |
| 375 | .psize = 62, |
| 376 | .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, |
| 377 | 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, |
| 378 | 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, |
| 379 | 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E, |
| 380 | 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F, |
| 381 | 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6, |
| 382 | 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21, |
| 383 | 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 }, |
| 384 | }, { |
| 385 | .plaintext = "1234567890123456789012345678901234567890" |
| 386 | "1234567890123456789012345678901234567890", |
| 387 | .psize = 80, |
| 388 | .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, |
| 389 | 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, |
| 390 | 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, |
| 391 | 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29, |
| 392 | 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5, |
| 393 | 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A, |
| 394 | 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B, |
| 395 | 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B }, |
| 396 | }, { |
| 397 | .plaintext = "abcdbcdecdefdefgefghfghighijhijk", |
| 398 | .psize = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 399 | .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, |
| 401 | 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, |
| 402 | 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, |
| 403 | 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B, |
| 404 | 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56, |
| 405 | 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6, |
| 406 | 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD }, |
| 407 | }, |
| 408 | }; |
| 409 | |
| 410 | #define WP384_TEST_VECTORS 8 |
| 411 | |
| 412 | static struct hash_testvec wp384_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 413 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | .plaintext = "", |
| 415 | .psize = 0, |
| 416 | .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, |
| 417 | 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, |
| 418 | 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, |
| 419 | 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7, |
| 420 | 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB, |
| 421 | 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57 }, |
| 422 | |
| 423 | |
| 424 | }, { |
| 425 | .plaintext = "a", |
| 426 | .psize = 1, |
| 427 | .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, |
| 428 | 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, |
| 429 | 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, |
| 430 | 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42, |
| 431 | 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6, |
| 432 | 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59 }, |
| 433 | }, { |
| 434 | .plaintext = "abc", |
| 435 | .psize = 3, |
| 436 | .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, |
| 437 | 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, |
| 438 | 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, |
| 439 | 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C, |
| 440 | 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27, |
| 441 | 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6 }, |
| 442 | }, { |
| 443 | .plaintext = "message digest", |
| 444 | .psize = 14, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 445 | .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, |
| 446 | 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, |
| 447 | 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, |
| 448 | 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, |
| 449 | 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 }, |
| 451 | }, { |
| 452 | .plaintext = "abcdefghijklmnopqrstuvwxyz", |
| 453 | .psize = 26, |
| 454 | .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, |
| 455 | 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, |
| 456 | 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, |
| 457 | 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B, |
| 458 | 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A, |
| 459 | 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6 }, |
| 460 | }, { |
| 461 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 462 | "abcdefghijklmnopqrstuvwxyz0123456789", |
| 463 | .psize = 62, |
| 464 | .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, |
| 465 | 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, |
| 466 | 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, |
| 467 | 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E, |
| 468 | 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F, |
| 469 | 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6 }, |
| 470 | }, { |
| 471 | .plaintext = "1234567890123456789012345678901234567890" |
| 472 | "1234567890123456789012345678901234567890", |
| 473 | .psize = 80, |
| 474 | .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, |
| 475 | 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, |
| 476 | 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, |
| 477 | 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29, |
| 478 | 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5, |
| 479 | 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A }, |
| 480 | }, { |
| 481 | .plaintext = "abcdbcdecdefdefgefghfghighijhijk", |
| 482 | .psize = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 483 | .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, |
| 485 | 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, |
| 486 | 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, |
| 487 | 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B, |
| 488 | 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56 }, |
| 489 | }, |
| 490 | }; |
| 491 | |
| 492 | #define WP256_TEST_VECTORS 8 |
| 493 | |
| 494 | static struct hash_testvec wp256_tv_template[] = { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 495 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | .plaintext = "", |
| 497 | .psize = 0, |
| 498 | .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, |
| 499 | 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, |
| 500 | 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, |
| 501 | 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7 }, |
| 502 | |
| 503 | |
| 504 | }, { |
| 505 | .plaintext = "a", |
| 506 | .psize = 1, |
| 507 | .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, |
| 508 | 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, |
| 509 | 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, |
| 510 | 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42 }, |
| 511 | }, { |
| 512 | .plaintext = "abc", |
| 513 | .psize = 3, |
| 514 | .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, |
| 515 | 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, |
| 516 | 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, |
| 517 | 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C }, |
| 518 | }, { |
| 519 | .plaintext = "message digest", |
| 520 | .psize = 14, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 521 | .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, |
| 522 | 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, |
| 523 | 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B }, |
| 525 | }, { |
| 526 | .plaintext = "abcdefghijklmnopqrstuvwxyz", |
| 527 | .psize = 26, |
| 528 | .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, |
| 529 | 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, |
| 530 | 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, |
| 531 | 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B }, |
| 532 | }, { |
| 533 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 534 | "abcdefghijklmnopqrstuvwxyz0123456789", |
| 535 | .psize = 62, |
| 536 | .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, |
| 537 | 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, |
| 538 | 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, |
| 539 | 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E }, |
| 540 | }, { |
| 541 | .plaintext = "1234567890123456789012345678901234567890" |
| 542 | "1234567890123456789012345678901234567890", |
| 543 | .psize = 80, |
| 544 | .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, |
| 545 | 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, |
| 546 | 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, |
| 547 | 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29 }, |
| 548 | }, { |
| 549 | .plaintext = "abcdbcdecdefdefgefghfghighijhijk", |
| 550 | .psize = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 551 | .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, |
| 553 | 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, |
| 554 | 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 }, |
| 555 | }, |
| 556 | }; |
| 557 | |
| 558 | /* |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 559 | * TIGER test vectors from Tiger website |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | */ |
| 561 | #define TGR192_TEST_VECTORS 6 |
| 562 | |
| 563 | static struct hash_testvec tgr192_tv_template[] = { |
| 564 | { |
| 565 | .plaintext = "", |
| 566 | .psize = 0, |
| 567 | .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32, |
| 568 | 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f, |
| 569 | 0xf3, 0x73, 0xde, 0x2d, 0x49, 0x58, 0x4e, 0x7a }, |
| 570 | }, { |
| 571 | .plaintext = "abc", |
| 572 | .psize = 3, |
| 573 | .digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a, |
| 574 | 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf, |
| 575 | 0x93, 0x5f, 0x7b, 0x95, 0x1c, 0x13, 0x29, 0x51 }, |
| 576 | }, { |
| 577 | .plaintext = "Tiger", |
| 578 | .psize = 5, |
| 579 | .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd, |
| 580 | 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec, |
| 581 | 0x37, 0x79, 0x0c, 0x11, 0x6f, 0x9d, 0x2b, 0xdf }, |
| 582 | }, { |
| 583 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-", |
| 584 | .psize = 64, |
| 585 | .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7, |
| 586 | 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e, |
| 587 | 0xb5, 0x86, 0x44, 0x50, 0x34, 0xa5, 0xa3, 0x86 }, |
| 588 | }, { |
| 589 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789", |
| 590 | .psize = 64, |
| 591 | .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48, |
| 592 | 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9, |
| 593 | 0x57, 0x89, 0x65, 0x65, 0x97, 0x5f, 0x91, 0x97 }, |
| 594 | }, { |
| 595 | .plaintext = "Tiger - A Fast New Hash Function, " |
| 596 | "by Ross Anderson and Eli Biham, " |
| 597 | "proceedings of Fast Software Encryption 3, " |
| 598 | "Cambridge, 1996.", |
| 599 | .psize = 125, |
| 600 | .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63, |
| 601 | 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24, |
| 602 | 0xdd, 0x68, 0x15, 0x1d, 0x50, 0x39, 0x74, 0xfc }, |
| 603 | }, |
| 604 | }; |
| 605 | |
| 606 | #define TGR160_TEST_VECTORS 6 |
| 607 | |
| 608 | static struct hash_testvec tgr160_tv_template[] = { |
| 609 | { |
| 610 | .plaintext = "", |
| 611 | .psize = 0, |
| 612 | .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32, |
| 613 | 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f, |
| 614 | 0xf3, 0x73, 0xde, 0x2d }, |
| 615 | }, { |
| 616 | .plaintext = "abc", |
| 617 | .psize = 3, |
| 618 | .digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a, |
| 619 | 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf, |
| 620 | 0x93, 0x5f, 0x7b, 0x95 }, |
| 621 | }, { |
| 622 | .plaintext = "Tiger", |
| 623 | .psize = 5, |
| 624 | .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd, |
| 625 | 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec, |
| 626 | 0x37, 0x79, 0x0c, 0x11 }, |
| 627 | }, { |
| 628 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-", |
| 629 | .psize = 64, |
| 630 | .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7, |
| 631 | 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e, |
| 632 | 0xb5, 0x86, 0x44, 0x50 }, |
| 633 | }, { |
| 634 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789", |
| 635 | .psize = 64, |
| 636 | .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48, |
| 637 | 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9, |
| 638 | 0x57, 0x89, 0x65, 0x65 }, |
| 639 | }, { |
| 640 | .plaintext = "Tiger - A Fast New Hash Function, " |
| 641 | "by Ross Anderson and Eli Biham, " |
| 642 | "proceedings of Fast Software Encryption 3, " |
| 643 | "Cambridge, 1996.", |
| 644 | .psize = 125, |
| 645 | .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63, |
| 646 | 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24, |
| 647 | 0xdd, 0x68, 0x15, 0x1d }, |
| 648 | }, |
| 649 | }; |
| 650 | |
| 651 | #define TGR128_TEST_VECTORS 6 |
| 652 | |
| 653 | static struct hash_testvec tgr128_tv_template[] = { |
| 654 | { |
| 655 | .plaintext = "", |
| 656 | .psize = 0, |
| 657 | .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32, |
| 658 | 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f }, |
| 659 | }, { |
| 660 | .plaintext = "abc", |
| 661 | .psize = 3, |
| 662 | .digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a, |
| 663 | 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf }, |
| 664 | }, { |
| 665 | .plaintext = "Tiger", |
| 666 | .psize = 5, |
| 667 | .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd, |
| 668 | 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec }, |
| 669 | }, { |
| 670 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-", |
| 671 | .psize = 64, |
| 672 | .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7, |
| 673 | 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e }, |
| 674 | }, { |
| 675 | .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789", |
| 676 | .psize = 64, |
| 677 | .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48, |
| 678 | 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9 }, |
| 679 | }, { |
| 680 | .plaintext = "Tiger - A Fast New Hash Function, " |
| 681 | "by Ross Anderson and Eli Biham, " |
| 682 | "proceedings of Fast Software Encryption 3, " |
| 683 | "Cambridge, 1996.", |
| 684 | .psize = 125, |
| 685 | .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63, |
| 686 | 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24 }, |
| 687 | }, |
| 688 | }; |
| 689 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | /* |
| 691 | * HMAC-MD5 test vectors from RFC2202 |
| 692 | * (These need to be fixed to not use strlen). |
| 693 | */ |
| 694 | #define HMAC_MD5_TEST_VECTORS 7 |
| 695 | |
Herbert Xu | e9d4116 | 2006-08-19 21:38:49 +1000 | [diff] [blame] | 696 | static struct hash_testvec hmac_md5_tv_template[] = |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 697 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | { |
| 699 | .key = { [0 ... 15] = 0x0b }, |
| 700 | .ksize = 16, |
| 701 | .plaintext = "Hi There", |
| 702 | .psize = 8, |
| 703 | .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, |
| 704 | 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d }, |
| 705 | }, { |
| 706 | .key = { 'J', 'e', 'f', 'e' }, |
| 707 | .ksize = 4, |
| 708 | .plaintext = "what do ya want for nothing?", |
| 709 | .psize = 28, |
| 710 | .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03, |
| 711 | 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 }, |
| 712 | .np = 2, |
| 713 | .tap = {14, 14} |
| 714 | }, { |
| 715 | .key = { [0 ... 15] = 0xaa }, |
| 716 | .ksize = 16, |
| 717 | .plaintext = { [0 ... 49] = 0xdd }, |
| 718 | .psize = 50, |
| 719 | .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88, |
| 720 | 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 }, |
| 721 | }, { |
| 722 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 723 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 724 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, }, |
| 725 | .ksize = 25, |
| 726 | .plaintext = { [0 ... 49] = 0xcd }, |
| 727 | .psize = 50, |
| 728 | .digest = { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea, |
| 729 | 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 }, |
| 730 | }, { |
| 731 | .key = { [0 ... 15] = 0x0c }, |
| 732 | .ksize = 16, |
| 733 | .plaintext = "Test With Truncation", |
| 734 | .psize = 20, |
| 735 | .digest = { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00, |
| 736 | 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c }, |
| 737 | }, { |
| 738 | .key = { [0 ... 79] = 0xaa }, |
| 739 | .ksize = 80, |
| 740 | .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", |
| 741 | .psize = 54, |
| 742 | .digest = { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f, |
| 743 | 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd }, |
| 744 | }, { |
| 745 | .key = { [0 ... 79] = 0xaa }, |
| 746 | .ksize = 80, |
| 747 | .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One " |
| 748 | "Block-Size Data", |
| 749 | .psize = 73, |
| 750 | .digest = { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee, |
| 751 | 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e }, |
| 752 | }, |
| 753 | }; |
| 754 | |
| 755 | /* |
| 756 | * HMAC-SHA1 test vectors from RFC2202 |
| 757 | */ |
| 758 | #define HMAC_SHA1_TEST_VECTORS 7 |
| 759 | |
Herbert Xu | e9d4116 | 2006-08-19 21:38:49 +1000 | [diff] [blame] | 760 | static struct hash_testvec hmac_sha1_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 761 | { |
| 762 | .key = { [0 ... 19] = 0x0b }, |
| 763 | .ksize = 20, |
| 764 | .plaintext = "Hi There", |
| 765 | .psize = 8, |
| 766 | .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, |
| 767 | 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1, |
| 768 | 0x46, 0xbe }, |
| 769 | }, { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 770 | .key = { 'J', 'e', 'f', 'e' }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | .ksize = 4, |
| 772 | .plaintext = "what do ya want for nothing?", |
| 773 | .psize = 28, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 774 | .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 }, |
| 776 | .np = 2, |
| 777 | .tap = { 14, 14 } |
| 778 | }, { |
| 779 | .key = { [0 ... 19] = 0xaa }, |
| 780 | .ksize = 20, |
| 781 | .plaintext = { [0 ... 49] = 0xdd }, |
| 782 | .psize = 50, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 783 | .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 784 | 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 }, |
| 785 | }, { |
| 786 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 787 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 788 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 }, |
| 789 | .ksize = 25, |
| 790 | .plaintext = { [0 ... 49] = 0xcd }, |
| 791 | .psize = 50, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 792 | .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 793 | 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda }, |
| 794 | }, { |
| 795 | .key = { [0 ... 19] = 0x0c }, |
| 796 | .ksize = 20, |
| 797 | .plaintext = "Test With Truncation", |
| 798 | .psize = 20, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 799 | .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 }, |
| 801 | }, { |
| 802 | .key = { [0 ... 79] = 0xaa }, |
| 803 | .ksize = 80, |
| 804 | .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", |
| 805 | .psize = 54, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 806 | .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 }, |
| 808 | }, { |
| 809 | .key = { [0 ... 79] = 0xaa }, |
| 810 | .ksize = 80, |
| 811 | .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One " |
| 812 | "Block-Size Data", |
| 813 | .psize = 73, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 814 | .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 815 | 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 }, |
| 816 | }, |
| 817 | }; |
| 818 | |
| 819 | /* |
| 820 | * HMAC-SHA256 test vectors from |
| 821 | * draft-ietf-ipsec-ciph-sha-256-01.txt |
| 822 | */ |
| 823 | #define HMAC_SHA256_TEST_VECTORS 10 |
| 824 | |
Herbert Xu | e9d4116 | 2006-08-19 21:38:49 +1000 | [diff] [blame] | 825 | static struct hash_testvec hmac_sha256_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 826 | { |
| 827 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 828 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 829 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 830 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20}, |
| 831 | .ksize = 32, |
| 832 | .plaintext = "abc", |
| 833 | .psize = 3, |
| 834 | .digest = { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a, |
| 835 | 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a, |
| 836 | 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66, |
| 837 | 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 }, |
| 838 | }, { |
| 839 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 840 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 841 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 842 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 }, |
| 843 | .ksize = 32, |
| 844 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 845 | .psize = 56, |
| 846 | .digest = { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08, |
| 847 | 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae, |
| 848 | 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49, |
| 849 | 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 }, |
| 850 | }, { |
| 851 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 852 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 853 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 854 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 }, |
| 855 | .ksize = 32, |
| 856 | .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" |
| 857 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
| 858 | .psize = 112, |
| 859 | .digest = { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34, |
| 860 | 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab, |
| 861 | 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5, |
| 862 | 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 }, |
| 863 | }, { |
| 864 | .key = { [0 ... 31] = 0x0b }, |
| 865 | .ksize = 32, |
| 866 | .plaintext = "Hi There", |
| 867 | .psize = 8, |
| 868 | .digest = { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6, |
| 869 | 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5, |
| 870 | 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c, |
| 871 | 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 }, |
| 872 | }, { |
| 873 | .key = "Jefe", |
| 874 | .ksize = 4, |
| 875 | .plaintext = "what do ya want for nothing?", |
| 876 | .psize = 28, |
| 877 | .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, |
| 878 | 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, |
| 879 | 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, |
| 880 | 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 }, |
| 881 | .np = 2, |
| 882 | .tap = { 14, 14 } |
| 883 | }, { |
| 884 | .key = { [0 ... 31] = 0xaa }, |
| 885 | .ksize = 32, |
| 886 | .plaintext = { [0 ... 49] = 0xdd }, |
| 887 | .psize = 50, |
| 888 | .digest = { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea, |
| 889 | 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62, |
| 890 | 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc, |
| 891 | 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 }, |
| 892 | }, { |
| 893 | .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 894 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 895 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 896 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, |
| 897 | 0x21, 0x22, 0x23, 0x24, 0x25 }, |
| 898 | .ksize = 37, |
| 899 | .plaintext = { [0 ... 49] = 0xcd }, |
| 900 | .psize = 50, |
| 901 | .digest = { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74, |
| 902 | 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55, |
| 903 | 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85, |
| 904 | 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 }, |
| 905 | }, { |
| 906 | .key = { [0 ... 31] = 0x0c }, |
| 907 | .ksize = 32, |
| 908 | .plaintext = "Test With Truncation", |
| 909 | .psize = 20, |
| 910 | .digest = { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b, |
| 911 | 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17, |
| 912 | 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27, |
| 913 | 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 }, |
| 914 | }, { |
| 915 | .key = { [0 ... 79] = 0xaa }, |
| 916 | .ksize = 80, |
| 917 | .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", |
| 918 | .psize = 54, |
| 919 | .digest = { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09, |
| 920 | 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb, |
| 921 | 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e, |
| 922 | 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f }, |
| 923 | }, { |
| 924 | .key = { [0 ... 79] = 0xaa }, |
| 925 | .ksize = 80, |
| 926 | .plaintext = "Test Using Larger Than Block-Size Key and Larger Than " |
| 927 | "One Block-Size Data", |
| 928 | .psize = 73, |
| 929 | .digest = { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3, |
| 930 | 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8, |
| 931 | 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc, |
| 932 | 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 }, |
| 933 | }, |
| 934 | }; |
| 935 | |
Kazunori MIYAZAWA | 5b2becf | 2006-10-28 13:18:53 +1000 | [diff] [blame] | 936 | #define XCBC_AES_TEST_VECTORS 6 |
| 937 | |
| 938 | static struct hash_testvec aes_xcbc128_tv_template[] = { |
| 939 | { |
| 940 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 941 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 942 | .plaintext = { [0 ... 15] = 0 }, |
| 943 | .digest = { 0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c, |
| 944 | 0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29 }, |
| 945 | .psize = 0, |
| 946 | .ksize = 16, |
| 947 | }, { |
| 948 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 949 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 950 | .plaintext = { 0x00, 0x01, 0x02 }, |
| 951 | .digest = { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf, |
| 952 | 0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f }, |
| 953 | .psize = 3, |
| 954 | .ksize = 16, |
| 955 | } , { |
| 956 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 957 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 958 | .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 959 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 960 | .digest = { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7, |
| 961 | 0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 }, |
| 962 | .psize = 16, |
| 963 | .ksize = 16, |
| 964 | }, { |
| 965 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 966 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 967 | .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 968 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 969 | 0x10, 0x11, 0x12, 0x13 }, |
| 970 | .digest = { 0x47, 0xf5, 0x1b, 0x45, 0x64, 0x96, 0x62, 0x15, |
| 971 | 0xb8, 0x98, 0x5c, 0x63, 0x05, 0x5e, 0xd3, 0x08 }, |
| 972 | .tap = { 10, 10 }, |
| 973 | .psize = 20, |
| 974 | .np = 2, |
| 975 | .ksize = 16, |
| 976 | }, { |
| 977 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 978 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 979 | .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 980 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 981 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 982 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 983 | .digest = { 0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3, |
| 984 | 0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4 }, |
| 985 | .psize = 32, |
| 986 | .ksize = 16, |
| 987 | }, { |
| 988 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 989 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 990 | .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 991 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 992 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 993 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, |
| 994 | 0x20, 0x21 }, |
| 995 | .digest = { 0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3, |
| 996 | 0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8 }, |
| 997 | .tap = { 17, 17 }, |
| 998 | .psize = 34, |
| 999 | .np = 2, |
| 1000 | .ksize = 16, |
| 1001 | } |
| 1002 | }; |
| 1003 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1004 | /* |
| 1005 | * DES test vectors. |
| 1006 | */ |
| 1007 | #define DES_ENC_TEST_VECTORS 10 |
| 1008 | #define DES_DEC_TEST_VECTORS 4 |
| 1009 | #define DES_CBC_ENC_TEST_VECTORS 5 |
| 1010 | #define DES_CBC_DEC_TEST_VECTORS 4 |
| 1011 | #define DES3_EDE_ENC_TEST_VECTORS 3 |
| 1012 | #define DES3_EDE_DEC_TEST_VECTORS 3 |
| 1013 | |
| 1014 | static struct cipher_testvec des_enc_tv_template[] = { |
| 1015 | { /* From Applied Cryptography */ |
| 1016 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1017 | .klen = 8, |
| 1018 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, |
| 1019 | .ilen = 8, |
| 1020 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, |
| 1021 | .rlen = 8, |
| 1022 | }, { /* Same key, different plaintext block */ |
| 1023 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1024 | .klen = 8, |
| 1025 | .input = { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, |
| 1026 | .ilen = 8, |
| 1027 | .result = { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, |
| 1028 | .rlen = 8, |
| 1029 | }, { /* Sbox test from NBS */ |
| 1030 | .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 }, |
| 1031 | .klen = 8, |
| 1032 | .input = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 }, |
| 1033 | .ilen = 8, |
| 1034 | .result = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, |
| 1035 | .rlen = 8, |
| 1036 | }, { /* Three blocks */ |
| 1037 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1038 | .klen = 8, |
| 1039 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1040 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, |
| 1041 | 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef }, |
| 1042 | .ilen = 24, |
| 1043 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1044 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, |
| 1045 | 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 }, |
| 1046 | .rlen = 24, |
| 1047 | }, { /* Weak key */ |
| 1048 | .fail = 1, |
| 1049 | .wk = 1, |
| 1050 | .key = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, |
| 1051 | .klen = 8, |
| 1052 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, |
| 1053 | .ilen = 8, |
| 1054 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, |
| 1055 | .rlen = 8, |
| 1056 | }, { /* Two blocks -- for testing encryption across pages */ |
| 1057 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1058 | .klen = 8, |
| 1059 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1060 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, |
| 1061 | .ilen = 16, |
| 1062 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1063 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, |
| 1064 | .rlen = 16, |
| 1065 | .np = 2, |
| 1066 | .tap = { 8, 8 } |
| 1067 | }, { /* Four blocks -- for testing encryption with chunking */ |
| 1068 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1069 | .klen = 8, |
| 1070 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1071 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, |
| 1072 | 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef, |
| 1073 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, |
| 1074 | .ilen = 32, |
| 1075 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1076 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, |
| 1077 | 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90, |
| 1078 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, |
| 1079 | .rlen = 32, |
| 1080 | .np = 3, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1081 | .tap = { 14, 10, 8 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1082 | }, { |
| 1083 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1084 | .klen = 8, |
| 1085 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1086 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, |
| 1087 | 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef }, |
| 1088 | .ilen = 24, |
| 1089 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1090 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, |
| 1091 | 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 }, |
| 1092 | .rlen = 24, |
| 1093 | .np = 4, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1094 | .tap = { 2, 1, 3, 18 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1095 | }, { |
| 1096 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1097 | .klen = 8, |
| 1098 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1099 | 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, |
| 1100 | .ilen = 16, |
| 1101 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1102 | 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, |
| 1103 | .rlen = 16, |
| 1104 | .np = 5, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1105 | .tap = { 2, 2, 2, 2, 8 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1106 | }, { |
| 1107 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1108 | .klen = 8, |
| 1109 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, |
| 1110 | .ilen = 8, |
| 1111 | .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, |
| 1112 | .rlen = 8, |
| 1113 | .np = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1114 | .tap = { 1, 1, 1, 1, 1, 1, 1, 1 } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1115 | }, |
| 1116 | }; |
| 1117 | |
| 1118 | static struct cipher_testvec des_dec_tv_template[] = { |
| 1119 | { /* From Applied Cryptography */ |
| 1120 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1121 | .klen = 8, |
| 1122 | .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, |
| 1123 | .ilen = 8, |
| 1124 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, |
| 1125 | .rlen = 8, |
| 1126 | }, { /* Sbox test from NBS */ |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1127 | .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1128 | .klen = 8, |
| 1129 | .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, |
| 1130 | .ilen = 8, |
| 1131 | .result = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 }, |
| 1132 | .rlen = 8, |
| 1133 | }, { /* Two blocks, for chunking test */ |
| 1134 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1135 | .klen = 8, |
| 1136 | .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1137 | 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, |
| 1138 | .ilen = 16, |
| 1139 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1140 | 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 }, |
| 1141 | .rlen = 16, |
| 1142 | .np = 2, |
| 1143 | .tap = { 8, 8 } |
| 1144 | }, { |
| 1145 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1146 | .klen = 8, |
| 1147 | .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, |
| 1148 | 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, |
| 1149 | .ilen = 16, |
| 1150 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, |
| 1151 | 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 }, |
| 1152 | .rlen = 16, |
| 1153 | .np = 3, |
| 1154 | .tap = { 3, 12, 1 } |
| 1155 | }, |
| 1156 | }; |
| 1157 | |
| 1158 | static struct cipher_testvec des_cbc_enc_tv_template[] = { |
| 1159 | { /* From OpenSSL */ |
| 1160 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, |
| 1161 | .klen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1162 | .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, |
| 1163 | .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, |
| 1164 | 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, |
| 1165 | 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1166 | .ilen = 24, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1167 | .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, |
| 1168 | 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, |
| 1169 | 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1170 | .rlen = 24, |
| 1171 | }, { /* FIPS Pub 81 */ |
| 1172 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1173 | .klen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1174 | .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1175 | .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 }, |
| 1176 | .ilen = 8, |
| 1177 | .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, |
| 1178 | .rlen = 8, |
| 1179 | }, { |
| 1180 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1181 | .klen = 8, |
| 1182 | .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, |
| 1183 | .input = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, |
| 1184 | .ilen = 8, |
| 1185 | .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, |
| 1186 | .rlen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1187 | }, { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1188 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1189 | .klen = 8, |
| 1190 | .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, |
| 1191 | .input = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, |
| 1192 | .ilen = 8, |
| 1193 | .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, |
| 1194 | .rlen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1195 | }, { /* Copy of openssl vector for chunk testing */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1196 | /* From OpenSSL */ |
| 1197 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, |
| 1198 | .klen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1199 | .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, |
| 1200 | .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, |
| 1201 | 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, |
| 1202 | 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1203 | .ilen = 24, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1204 | .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, |
| 1205 | 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, |
| 1206 | 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1207 | .rlen = 24, |
| 1208 | .np = 2, |
| 1209 | .tap = { 13, 11 } |
| 1210 | }, |
| 1211 | }; |
| 1212 | |
| 1213 | static struct cipher_testvec des_cbc_dec_tv_template[] = { |
| 1214 | { /* FIPS Pub 81 */ |
| 1215 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1216 | .klen = 8, |
| 1217 | .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }, |
| 1218 | .input = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, |
| 1219 | .ilen = 8, |
| 1220 | .result = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 }, |
| 1221 | .rlen = 8, |
| 1222 | }, { |
| 1223 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1224 | .klen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1225 | .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1226 | .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, |
| 1227 | .ilen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1228 | .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1229 | .rlen = 8, |
| 1230 | }, { |
| 1231 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1232 | .klen = 8, |
| 1233 | .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1234 | .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1235 | .ilen = 8, |
| 1236 | .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, |
| 1237 | .rlen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1238 | }, { /* Copy of above, for chunk testing */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1239 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1240 | .klen = 8, |
| 1241 | .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1242 | .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1243 | .ilen = 8, |
| 1244 | .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, |
| 1245 | .rlen = 8, |
| 1246 | .np = 2, |
| 1247 | .tap = { 4, 4 } |
| 1248 | }, |
| 1249 | }; |
| 1250 | |
| 1251 | /* |
| 1252 | * We really need some more test vectors, especially for DES3 CBC. |
| 1253 | */ |
| 1254 | static struct cipher_testvec des3_ede_enc_tv_template[] = { |
| 1255 | { /* These are from openssl */ |
| 1256 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1257 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, |
| 1258 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, |
| 1259 | .klen = 24, |
| 1260 | .input = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 }, |
| 1261 | .ilen = 8, |
| 1262 | .result = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 }, |
| 1263 | .rlen = 8, |
| 1264 | }, { |
| 1265 | .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17, |
| 1266 | 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98, |
| 1267 | 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 }, |
| 1268 | .klen = 24, |
| 1269 | .input = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 }, |
| 1270 | .ilen = 8, |
| 1271 | .result = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 }, |
| 1272 | .rlen = 8, |
| 1273 | }, { |
| 1274 | .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, |
| 1275 | 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, |
| 1276 | 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 }, |
| 1277 | .klen = 24, |
| 1278 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1279 | .ilen = 8, |
| 1280 | .result = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b }, |
| 1281 | .rlen = 8, |
| 1282 | }, |
| 1283 | }; |
| 1284 | |
| 1285 | static struct cipher_testvec des3_ede_dec_tv_template[] = { |
| 1286 | { /* These are from openssl */ |
| 1287 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1288 | 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, |
| 1289 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, |
| 1290 | .klen = 24, |
| 1291 | .input = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 }, |
| 1292 | .ilen = 8, |
| 1293 | .result = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 }, |
| 1294 | .rlen = 8, |
| 1295 | }, { |
| 1296 | .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17, |
| 1297 | 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98, |
| 1298 | 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 }, |
| 1299 | .klen = 24, |
| 1300 | .input = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 }, |
| 1301 | .ilen = 8, |
| 1302 | .result = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 }, |
| 1303 | .rlen = 8, |
| 1304 | }, { |
| 1305 | .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, |
| 1306 | 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, |
| 1307 | 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 }, |
| 1308 | .klen = 24, |
| 1309 | .input = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b }, |
| 1310 | .ilen = 8, |
| 1311 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1312 | .rlen = 8, |
| 1313 | }, |
| 1314 | }; |
| 1315 | |
| 1316 | /* |
| 1317 | * Blowfish test vectors. |
| 1318 | */ |
| 1319 | #define BF_ENC_TEST_VECTORS 6 |
| 1320 | #define BF_DEC_TEST_VECTORS 6 |
| 1321 | #define BF_CBC_ENC_TEST_VECTORS 1 |
| 1322 | #define BF_CBC_DEC_TEST_VECTORS 1 |
| 1323 | |
| 1324 | static struct cipher_testvec bf_enc_tv_template[] = { |
| 1325 | { /* DES test vectors from OpenSSL */ |
| 1326 | .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, |
| 1327 | .klen = 8, |
| 1328 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1329 | .ilen = 8, |
| 1330 | .result = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 }, |
| 1331 | .rlen = 8, |
| 1332 | }, { |
| 1333 | .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e }, |
| 1334 | .klen = 8, |
| 1335 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1336 | .ilen = 8, |
| 1337 | .result = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae }, |
| 1338 | .rlen = 8, |
| 1339 | }, { |
| 1340 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, |
| 1341 | .klen = 8, |
| 1342 | .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1343 | .ilen = 8, |
| 1344 | .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 }, |
| 1345 | .rlen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1346 | }, { /* Vary the keylength... */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1347 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1348 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, |
| 1349 | .klen = 16, |
| 1350 | .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1351 | .ilen = 8, |
| 1352 | .result = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c }, |
| 1353 | .rlen = 8, |
| 1354 | }, { |
| 1355 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1356 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, |
| 1357 | 0x00, 0x11, 0x22, 0x33, 0x44 }, |
| 1358 | .klen = 21, |
| 1359 | .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1360 | .ilen = 8, |
| 1361 | .result = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f }, |
| 1362 | .rlen = 8, |
| 1363 | }, { /* Generated with bf488 */ |
| 1364 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1365 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, |
| 1366 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1367 | 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, |
| 1368 | 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, |
| 1369 | 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1370 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, |
| 1371 | .klen = 56, |
| 1372 | .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1373 | .ilen = 8, |
| 1374 | .result = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 }, |
| 1375 | .rlen = 8, |
| 1376 | }, |
| 1377 | }; |
| 1378 | |
| 1379 | static struct cipher_testvec bf_dec_tv_template[] = { |
| 1380 | { /* DES test vectors from OpenSSL */ |
| 1381 | .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1382 | .klen = 8, |
| 1383 | .input = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 }, |
| 1384 | .ilen = 8, |
| 1385 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1386 | .rlen = 8, |
| 1387 | }, { |
| 1388 | .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e }, |
| 1389 | .klen = 8, |
| 1390 | .input = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae }, |
| 1391 | .ilen = 8, |
| 1392 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 1393 | .rlen = 8, |
| 1394 | }, { |
| 1395 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, |
| 1396 | .klen = 8, |
| 1397 | .input = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 }, |
| 1398 | .ilen = 8, |
| 1399 | .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1400 | .rlen = 8, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1401 | }, { /* Vary the keylength... */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1402 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1403 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, |
| 1404 | .klen = 16, |
| 1405 | .input = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c }, |
| 1406 | .ilen = 8, |
| 1407 | .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1408 | .rlen = 8, |
| 1409 | }, { |
| 1410 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1411 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, |
| 1412 | 0x00, 0x11, 0x22, 0x33, 0x44 }, |
| 1413 | .klen = 21, |
| 1414 | .input = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f }, |
| 1415 | .ilen = 8, |
| 1416 | .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1417 | .rlen = 8, |
| 1418 | }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */ |
| 1419 | .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, |
| 1420 | 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, |
| 1421 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1422 | 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, |
| 1423 | 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, |
| 1424 | 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1425 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, |
| 1426 | .klen = 56, |
| 1427 | .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 }, |
| 1428 | .ilen = 8, |
| 1429 | .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
| 1430 | .rlen = 8, |
| 1431 | }, |
| 1432 | }; |
| 1433 | |
| 1434 | static struct cipher_testvec bf_cbc_enc_tv_template[] = { |
| 1435 | { /* From OpenSSL */ |
| 1436 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1437 | 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, |
| 1438 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1439 | .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1440 | .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, |
| 1441 | 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, |
| 1442 | 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, |
| 1443 | 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 }, |
| 1444 | .ilen = 32, |
| 1445 | .result = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6, |
| 1446 | 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93, |
| 1447 | 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9, |
| 1448 | 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc }, |
| 1449 | .rlen = 32, |
| 1450 | }, |
| 1451 | }; |
| 1452 | |
| 1453 | static struct cipher_testvec bf_cbc_dec_tv_template[] = { |
| 1454 | { /* From OpenSSL */ |
| 1455 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1456 | 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, |
| 1457 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1458 | .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1459 | .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6, |
| 1460 | 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93, |
| 1461 | 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9, |
| 1462 | 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc }, |
| 1463 | .ilen = 32, |
| 1464 | .result = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, |
| 1465 | 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, |
| 1466 | 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, |
| 1467 | 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 }, |
| 1468 | .rlen = 32, |
| 1469 | }, |
| 1470 | }; |
| 1471 | |
| 1472 | /* |
| 1473 | * Twofish test vectors. |
| 1474 | */ |
| 1475 | #define TF_ENC_TEST_VECTORS 3 |
| 1476 | #define TF_DEC_TEST_VECTORS 3 |
| 1477 | #define TF_CBC_ENC_TEST_VECTORS 4 |
| 1478 | #define TF_CBC_DEC_TEST_VECTORS 4 |
| 1479 | |
| 1480 | static struct cipher_testvec tf_enc_tv_template[] = { |
| 1481 | { |
| 1482 | .key = { [0 ... 15] = 0x00 }, |
| 1483 | .klen = 16, |
| 1484 | .input = { [0 ... 15] = 0x00 }, |
| 1485 | .ilen = 16, |
| 1486 | .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1487 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
| 1488 | .rlen = 16, |
| 1489 | }, { |
| 1490 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1491 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, |
| 1492 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, |
| 1493 | .klen = 24, |
| 1494 | .input = { [0 ... 15] = 0x00 }, |
| 1495 | .ilen = 16, |
| 1496 | .result = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf, |
| 1497 | 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 }, |
| 1498 | .rlen = 16, |
| 1499 | }, { |
| 1500 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1501 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, |
| 1502 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 1503 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1504 | .klen = 32, |
| 1505 | .input = { [0 ... 15] = 0x00 }, |
| 1506 | .ilen = 16, |
| 1507 | .result = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8, |
| 1508 | 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 }, |
| 1509 | .rlen = 16, |
| 1510 | }, |
| 1511 | }; |
| 1512 | |
| 1513 | static struct cipher_testvec tf_dec_tv_template[] = { |
| 1514 | { |
| 1515 | .key = { [0 ... 15] = 0x00 }, |
| 1516 | .klen = 16, |
| 1517 | .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1518 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
| 1519 | .ilen = 16, |
| 1520 | .result = { [0 ... 15] = 0x00 }, |
| 1521 | .rlen = 16, |
| 1522 | }, { |
| 1523 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1524 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, |
| 1525 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, |
| 1526 | .klen = 24, |
| 1527 | .input = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf, |
| 1528 | 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 }, |
| 1529 | .ilen = 16, |
| 1530 | .result = { [0 ... 15] = 0x00 }, |
| 1531 | .rlen = 16, |
| 1532 | }, { |
| 1533 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 1534 | 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, |
| 1535 | 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 1536 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1537 | .klen = 32, |
| 1538 | .input = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8, |
| 1539 | 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 }, |
| 1540 | .ilen = 16, |
| 1541 | .result = { [0 ... 15] = 0x00 }, |
| 1542 | .rlen = 16, |
| 1543 | }, |
| 1544 | }; |
| 1545 | |
| 1546 | static struct cipher_testvec tf_cbc_enc_tv_template[] = { |
| 1547 | { /* Generated with Nettle */ |
| 1548 | .key = { [0 ... 15] = 0x00 }, |
| 1549 | .klen = 16, |
| 1550 | .iv = { [0 ... 15] = 0x00 }, |
| 1551 | .input = { [0 ... 15] = 0x00 }, |
| 1552 | .ilen = 16, |
| 1553 | .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1554 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
| 1555 | .rlen = 16, |
| 1556 | }, { |
| 1557 | .key = { [0 ... 15] = 0x00 }, |
| 1558 | .klen = 16, |
| 1559 | .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1560 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | .input = { [0 ... 15] = 0x00 }, |
| 1562 | .ilen = 16, |
| 1563 | .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1564 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, |
| 1565 | .rlen = 16, |
| 1566 | }, { |
| 1567 | .key = { [0 ... 15] = 0x00 }, |
| 1568 | .klen = 16, |
| 1569 | .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1570 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, |
| 1571 | .input = { [0 ... 15] = 0x00 }, |
| 1572 | .ilen = 16, |
| 1573 | .result = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, |
| 1574 | 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, |
| 1575 | .rlen = 16, |
| 1576 | }, { |
| 1577 | .key = { [0 ... 15] = 0x00 }, |
| 1578 | .klen = 16, |
| 1579 | .iv = { [0 ... 15] = 0x00 }, |
| 1580 | .input = { [0 ... 47] = 0x00 }, |
| 1581 | .ilen = 48, |
| 1582 | .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1583 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a, |
| 1584 | 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1585 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19, |
| 1586 | 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, |
| 1587 | 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, |
| 1588 | .rlen = 48, |
| 1589 | }, |
| 1590 | }; |
| 1591 | |
| 1592 | static struct cipher_testvec tf_cbc_dec_tv_template[] = { |
| 1593 | { /* Reverse of the first four above */ |
| 1594 | .key = { [0 ... 15] = 0x00 }, |
| 1595 | .klen = 16, |
| 1596 | .iv = { [0 ... 15] = 0x00 }, |
| 1597 | .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1598 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | .ilen = 16, |
| 1600 | .result = { [0 ... 15] = 0x00 }, |
| 1601 | .rlen = 16, |
| 1602 | }, { |
| 1603 | .key = { [0 ... 15] = 0x00 }, |
| 1604 | .klen = 16, |
| 1605 | .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1606 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, |
| 1607 | .input = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1608 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, |
| 1609 | .ilen = 16, |
| 1610 | .result = { [0 ... 15] = 0x00 }, |
| 1611 | .rlen = 16, |
| 1612 | }, { |
| 1613 | .key = { [0 ... 15] = 0x00 }, |
| 1614 | .klen = 16, |
| 1615 | .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1616 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, |
| 1617 | .input = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, |
| 1618 | 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, |
| 1619 | .ilen = 16, |
| 1620 | .result = { [0 ... 15] = 0x00 }, |
| 1621 | .rlen = 16, |
| 1622 | }, { |
| 1623 | .key = { [0 ... 15] = 0x00 }, |
| 1624 | .klen = 16, |
| 1625 | .iv = { [0 ... 15] = 0x00 }, |
| 1626 | .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, |
| 1627 | 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a, |
| 1628 | 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, |
| 1629 | 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19, |
| 1630 | 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, |
| 1631 | 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, |
| 1632 | .ilen = 48, |
| 1633 | .result = { [0 ... 47] = 0x00 }, |
| 1634 | .rlen = 48, |
| 1635 | }, |
| 1636 | }; |
| 1637 | |
| 1638 | /* |
| 1639 | * Serpent test vectors. These are backwards because Serpent writes |
| 1640 | * octet sequences in right-to-left mode. |
| 1641 | */ |
| 1642 | #define SERPENT_ENC_TEST_VECTORS 4 |
| 1643 | #define SERPENT_DEC_TEST_VECTORS 4 |
| 1644 | |
| 1645 | #define TNEPRES_ENC_TEST_VECTORS 4 |
| 1646 | #define TNEPRES_DEC_TEST_VECTORS 4 |
| 1647 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1648 | static struct cipher_testvec serpent_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1649 | { |
| 1650 | .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1651 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1652 | .ilen = 16, |
| 1653 | .result = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, |
| 1654 | 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 }, |
| 1655 | .rlen = 16, |
| 1656 | }, { |
| 1657 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1658 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1659 | .klen = 16, |
| 1660 | .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1661 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1662 | .ilen = 16, |
| 1663 | .result = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c, |
| 1664 | 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d }, |
| 1665 | .rlen = 16, |
| 1666 | }, { |
| 1667 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1668 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1669 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 1670 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 1671 | .klen = 32, |
| 1672 | .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1673 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1674 | .ilen = 16, |
| 1675 | .result = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8, |
| 1676 | 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c }, |
| 1677 | .rlen = 16, |
| 1678 | }, { |
| 1679 | .key = { [15] = 0x80 }, |
| 1680 | .klen = 16, |
| 1681 | .input = { [0 ... 15] = 0x00 }, |
| 1682 | .ilen = 16, |
| 1683 | .result = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c, |
| 1684 | 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49}, |
| 1685 | .rlen = 16, |
| 1686 | }, |
| 1687 | }; |
| 1688 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1689 | static struct cipher_testvec tnepres_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1690 | { /* KeySize=128, PT=0, I=1 */ |
| 1691 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1692 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1693 | .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1694 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1695 | .klen = 16, |
| 1696 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1697 | .result = { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd }, |
| 1699 | .rlen = 16, |
| 1700 | }, { /* KeySize=192, PT=0, I=1 */ |
| 1701 | .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1702 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1703 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1704 | .klen = 24, |
| 1705 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1706 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1707 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1708 | .result = { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1709 | 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 }, |
| 1710 | .rlen = 16, |
| 1711 | }, { /* KeySize=256, PT=0, I=1 */ |
| 1712 | .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1713 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1714 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1715 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1716 | .klen = 32, |
| 1717 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1718 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 1719 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1720 | .result = { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1721 | 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 }, |
| 1722 | .rlen = 16, |
| 1723 | }, { /* KeySize=256, I=257 */ |
| 1724 | .key = { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, |
| 1725 | 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, |
| 1726 | 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, |
| 1727 | 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }, |
| 1728 | .klen = 32, |
| 1729 | .input = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, |
| 1730 | 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }, |
| 1731 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1732 | .result = { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1733 | 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde }, |
| 1734 | .rlen = 16, |
| 1735 | }, |
| 1736 | }; |
| 1737 | |
| 1738 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1739 | static struct cipher_testvec serpent_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1740 | { |
| 1741 | .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, |
| 1742 | 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 }, |
| 1743 | .ilen = 16, |
| 1744 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1745 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1746 | .rlen = 16, |
| 1747 | }, { |
| 1748 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1749 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1750 | .klen = 16, |
| 1751 | .input = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c, |
| 1752 | 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d }, |
| 1753 | .ilen = 16, |
| 1754 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1755 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1756 | .rlen = 16, |
| 1757 | }, { |
| 1758 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1759 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1760 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 1761 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 1762 | .klen = 32, |
| 1763 | .input = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8, |
| 1764 | 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c }, |
| 1765 | .ilen = 16, |
| 1766 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1767 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1768 | .rlen = 16, |
| 1769 | }, { |
| 1770 | .key = { [15] = 0x80 }, |
| 1771 | .klen = 16, |
| 1772 | .input = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c, |
| 1773 | 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49}, |
| 1774 | .ilen = 16, |
| 1775 | .result = { [0 ... 15] = 0x00 }, |
| 1776 | .rlen = 16, |
| 1777 | }, |
| 1778 | }; |
| 1779 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1780 | static struct cipher_testvec tnepres_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1781 | { |
| 1782 | .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97, |
| 1783 | 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 }, |
| 1784 | .ilen = 16, |
| 1785 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1786 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1787 | .rlen = 16, |
| 1788 | }, { |
| 1789 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1790 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1791 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1792 | .input = { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1793 | 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e }, |
| 1794 | .ilen = 16, |
| 1795 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1796 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1797 | .rlen = 16, |
| 1798 | }, { |
| 1799 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1800 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1801 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 1802 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 1803 | .klen = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1804 | .input = { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1805 | 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee }, |
| 1806 | .ilen = 16, |
| 1807 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1808 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1809 | .rlen = 16, |
| 1810 | }, { /* KeySize=128, I=121 */ |
| 1811 | .key = { [15] = 0x80 }, |
| 1812 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1813 | .input = { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1814 | 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 }, |
| 1815 | .ilen = 16, |
| 1816 | .result = { [0 ... 15] = 0x00 }, |
| 1817 | .rlen = 16, |
| 1818 | }, |
| 1819 | }; |
| 1820 | |
| 1821 | |
| 1822 | /* Cast6 test vectors from RFC 2612 */ |
| 1823 | #define CAST6_ENC_TEST_VECTORS 3 |
| 1824 | #define CAST6_DEC_TEST_VECTORS 3 |
| 1825 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1826 | static struct cipher_testvec cast6_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1827 | { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1828 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1829 | 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, |
| 1830 | .klen = 16, |
| 1831 | .input = { [0 ... 15] = 0x00 }, |
| 1832 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1833 | .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1834 | 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, |
| 1835 | .rlen = 16, |
| 1836 | }, { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1837 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
| 1838 | 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1839 | 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, |
| 1840 | .klen = 24, |
| 1841 | .input = { [0 ... 15] = 0x00 }, |
| 1842 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1843 | .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1844 | 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, |
| 1845 | .rlen = 16, |
| 1846 | }, { |
| 1847 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
| 1848 | 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, |
| 1849 | 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1850 | 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1851 | .klen = 32, |
| 1852 | .input = { [0 ... 15] = 0x00 }, |
| 1853 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1854 | .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1855 | 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, |
| 1856 | .rlen = 16, |
| 1857 | }, |
| 1858 | }; |
| 1859 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1860 | static struct cipher_testvec cast6_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1861 | { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1862 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1863 | 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, |
| 1864 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1865 | .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1866 | 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, |
| 1867 | .ilen = 16, |
| 1868 | .result = { [0 ... 15] = 0x00 }, |
| 1869 | .rlen = 16, |
| 1870 | }, { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1871 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
| 1872 | 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1873 | 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, |
| 1874 | .klen = 24, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1875 | .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1876 | 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, |
| 1877 | .ilen = 16, |
| 1878 | .result = { [0 ... 15] = 0x00 }, |
| 1879 | .rlen = 16, |
| 1880 | }, { |
| 1881 | .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, |
| 1882 | 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, |
| 1883 | 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1884 | 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1885 | .klen = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1886 | .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1887 | 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, |
| 1888 | .ilen = 16, |
| 1889 | .result = { [0 ... 15] = 0x00 }, |
| 1890 | .rlen = 16, |
| 1891 | }, |
| 1892 | }; |
| 1893 | |
| 1894 | |
| 1895 | /* |
| 1896 | * AES test vectors. |
| 1897 | */ |
| 1898 | #define AES_ENC_TEST_VECTORS 3 |
| 1899 | #define AES_DEC_TEST_VECTORS 3 |
Jan Glauber | 05f29fc | 2006-01-06 00:19:19 -0800 | [diff] [blame] | 1900 | #define AES_CBC_ENC_TEST_VECTORS 2 |
| 1901 | #define AES_CBC_DEC_TEST_VECTORS 2 |
Rik Snel | f3d1044 | 2006-11-29 19:01:41 +1100 | [diff] [blame] | 1902 | #define AES_LRW_ENC_TEST_VECTORS 8 |
| 1903 | #define AES_LRW_DEC_TEST_VECTORS 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1904 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1905 | static struct cipher_testvec aes_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1906 | { /* From FIPS-197 */ |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1907 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1908 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1909 | .klen = 16, |
| 1910 | .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 1911 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1912 | .ilen = 16, |
| 1913 | .result = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, |
| 1914 | 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }, |
| 1915 | .rlen = 16, |
| 1916 | }, { |
| 1917 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1918 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1919 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, |
| 1920 | .klen = 24, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1921 | .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1922 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1923 | .ilen = 16, |
| 1924 | .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, |
| 1925 | 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }, |
| 1926 | .rlen = 16, |
| 1927 | }, { |
| 1928 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1929 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1930 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 1931 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 1932 | .klen = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1933 | .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1934 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1935 | .ilen = 16, |
| 1936 | .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, |
| 1937 | 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }, |
| 1938 | .rlen = 16, |
| 1939 | }, |
| 1940 | }; |
| 1941 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1942 | static struct cipher_testvec aes_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1943 | { /* From FIPS-197 */ |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1944 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1945 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, |
| 1946 | .klen = 16, |
| 1947 | .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, |
| 1948 | 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }, |
| 1949 | .ilen = 16, |
| 1950 | .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 1951 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1952 | .rlen = 16, |
| 1953 | }, { |
| 1954 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1955 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1956 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, |
| 1957 | .klen = 24, |
| 1958 | .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, |
| 1959 | 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }, |
| 1960 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1961 | .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 1962 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1963 | .rlen = 16, |
| 1964 | }, { |
| 1965 | .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1966 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1967 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 1968 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 1969 | .klen = 32, |
| 1970 | .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, |
| 1971 | 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }, |
| 1972 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 1973 | .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1974 | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, |
| 1975 | .rlen = 16, |
| 1976 | }, |
| 1977 | }; |
| 1978 | |
Jan Glauber | 05f29fc | 2006-01-06 00:19:19 -0800 | [diff] [blame] | 1979 | static struct cipher_testvec aes_cbc_enc_tv_template[] = { |
| 1980 | { /* From RFC 3602 */ |
| 1981 | .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, |
| 1982 | 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 }, |
| 1983 | .klen = 16, |
| 1984 | .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, |
| 1985 | 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, |
| 1986 | .input = { "Single block msg" }, |
| 1987 | .ilen = 16, |
| 1988 | .result = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8, |
| 1989 | 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }, |
| 1990 | .rlen = 16, |
| 1991 | }, { |
| 1992 | .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, |
| 1993 | 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a }, |
| 1994 | .klen = 16, |
| 1995 | .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, |
| 1996 | 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, |
| 1997 | .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 1998 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 1999 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 2000 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 2001 | .ilen = 32, |
| 2002 | .result = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, |
| 2003 | 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a, |
| 2004 | 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, |
| 2005 | 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }, |
| 2006 | .rlen = 32, |
| 2007 | }, |
| 2008 | }; |
| 2009 | |
| 2010 | static struct cipher_testvec aes_cbc_dec_tv_template[] = { |
| 2011 | { /* From RFC 3602 */ |
| 2012 | .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b, |
| 2013 | 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 }, |
| 2014 | .klen = 16, |
| 2015 | .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30, |
| 2016 | 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 }, |
| 2017 | .input = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8, |
| 2018 | 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }, |
| 2019 | .ilen = 16, |
| 2020 | .result = { "Single block msg" }, |
| 2021 | .rlen = 16, |
| 2022 | }, { |
| 2023 | .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, |
| 2024 | 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a }, |
| 2025 | .klen = 16, |
| 2026 | .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, |
| 2027 | 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }, |
| 2028 | .input = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, |
| 2029 | 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a, |
| 2030 | 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, |
| 2031 | 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }, |
| 2032 | .ilen = 32, |
| 2033 | .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 2034 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 2035 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 2036 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, |
| 2037 | .rlen = 32, |
| 2038 | }, |
| 2039 | }; |
| 2040 | |
Rik Snel | f3d1044 | 2006-11-29 19:01:41 +1100 | [diff] [blame] | 2041 | static struct cipher_testvec aes_lrw_enc_tv_template[] = { |
| 2042 | /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */ |
| 2043 | { /* LRW-32-AES 1 */ |
| 2044 | .key = { 0x45, 0x62, 0xac, 0x25, 0xf8, 0x28, 0x17, 0x6d, |
| 2045 | 0x4c, 0x26, 0x84, 0x14, 0xb5, 0x68, 0x01, 0x85, |
| 2046 | 0x25, 0x8e, 0x2a, 0x05, 0xe7, 0x3e, 0x9d, 0x03, |
| 2047 | 0xee, 0x5a, 0x83, 0x0c, 0xcc, 0x09, 0x4c, 0x87 }, |
| 2048 | .klen = 32, |
| 2049 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2050 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2051 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2052 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2053 | .ilen = 16, |
| 2054 | .result = { 0xf1, 0xb2, 0x73, 0xcd, 0x65, 0xa3, 0xdf, 0x5f, |
| 2055 | 0xe9, 0x5d, 0x48, 0x92, 0x54, 0x63, 0x4e, 0xb8 }, |
| 2056 | .rlen = 16, |
| 2057 | }, { /* LRW-32-AES 2 */ |
| 2058 | .key = { 0x59, 0x70, 0x47, 0x14, 0xf5, 0x57, 0x47, 0x8c, |
| 2059 | 0xd7, 0x79, 0xe8, 0x0f, 0x54, 0x88, 0x79, 0x44, |
| 2060 | 0x0d, 0x48, 0xf0, 0xb7, 0xb1, 0x5a, 0x53, 0xea, |
| 2061 | 0x1c, 0xaa, 0x6b, 0x29, 0xc2, 0xca, 0xfb, 0xaf |
| 2062 | }, |
| 2063 | .klen = 32, |
| 2064 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2065 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }, |
| 2066 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2067 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2068 | .ilen = 16, |
| 2069 | .result = { 0x00, 0xc8, 0x2b, 0xae, 0x95, 0xbb, 0xcd, 0xe5, |
| 2070 | 0x27, 0x4f, 0x07, 0x69, 0xb2, 0x60, 0xe1, 0x36 }, |
| 2071 | .rlen = 16, |
| 2072 | }, { /* LRW-32-AES 3 */ |
| 2073 | .key = { 0xd8, 0x2a, 0x91, 0x34, 0xb2, 0x6a, 0x56, 0x50, |
| 2074 | 0x30, 0xfe, 0x69, 0xe2, 0x37, 0x7f, 0x98, 0x47, |
| 2075 | 0xcd, 0xf9, 0x0b, 0x16, 0x0c, 0x64, 0x8f, 0xb6, |
| 2076 | 0xb0, 0x0d, 0x0d, 0x1b, 0xae, 0x85, 0x87, 0x1f }, |
| 2077 | .klen = 32, |
| 2078 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2079 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2080 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2081 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2082 | .ilen = 16, |
| 2083 | .result = { 0x76, 0x32, 0x21, 0x83, 0xed, 0x8f, 0xf1, 0x82, |
| 2084 | 0xf9, 0x59, 0x62, 0x03, 0x69, 0x0e, 0x5e, 0x01 }, |
| 2085 | .rlen = 16, |
| 2086 | }, { /* LRW-32-AES 4 */ |
| 2087 | .key = { 0x0f, 0x6a, 0xef, 0xf8, 0xd3, 0xd2, 0xbb, 0x15, |
| 2088 | 0x25, 0x83, 0xf7, 0x3c, 0x1f, 0x01, 0x28, 0x74, |
| 2089 | 0xca, 0xc6, 0xbc, 0x35, 0x4d, 0x4a, 0x65, 0x54, |
| 2090 | 0x90, 0xae, 0x61, 0xcf, 0x7b, 0xae, 0xbd, 0xcc, |
| 2091 | 0xad, 0xe4, 0x94, 0xc5, 0x4a, 0x29, 0xae, 0x70 }, |
| 2092 | .klen = 40, |
| 2093 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2094 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2095 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2096 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2097 | .ilen = 16, |
| 2098 | .result = { 0x9c, 0x0f, 0x15, 0x2f, 0x55, 0xa2, 0xd8, 0xf0, |
| 2099 | 0xd6, 0x7b, 0x8f, 0x9e, 0x28, 0x22, 0xbc, 0x41 }, |
| 2100 | .rlen = 16, |
| 2101 | }, { /* LRW-32-AES 5 */ |
| 2102 | .key = { 0x8a, 0xd4, 0xee, 0x10, 0x2f, 0xbd, 0x81, 0xff, |
| 2103 | 0xf8, 0x86, 0xce, 0xac, 0x93, 0xc5, 0xad, 0xc6, |
| 2104 | 0xa0, 0x19, 0x07, 0xc0, 0x9d, 0xf7, 0xbb, 0xdd, |
| 2105 | 0x52, 0x13, 0xb2, 0xb7, 0xf0, 0xff, 0x11, 0xd8, |
| 2106 | 0xd6, 0x08, 0xd0, 0xcd, 0x2e, 0xb1, 0x17, 0x6f }, |
| 2107 | .klen = 40, |
| 2108 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2109 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2110 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2111 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2112 | .ilen = 16, |
| 2113 | .result = { 0xd4, 0x27, 0x6a, 0x7f, 0x14, 0x91, 0x3d, 0x65, |
| 2114 | 0xc8, 0x60, 0x48, 0x02, 0x87, 0xe3, 0x34, 0x06 }, |
| 2115 | .rlen = 16, |
| 2116 | }, { /* LRW-32-AES 6 */ |
| 2117 | .key = { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c, |
| 2118 | 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d, |
| 2119 | 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21, |
| 2120 | 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89, |
| 2121 | 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1, |
| 2122 | 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e }, |
| 2123 | .klen = 48, |
| 2124 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2125 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2126 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2127 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2128 | .ilen = 16, |
| 2129 | .result = { 0xbd, 0x06, 0xb8, 0xe1, 0xdb, 0x98, 0x89, 0x9e, |
| 2130 | 0xc4, 0x98, 0xe4, 0x91, 0xcf, 0x1c, 0x70, 0x2b }, |
| 2131 | .rlen = 16, |
| 2132 | }, { /* LRW-32-AES 7 */ |
| 2133 | .key = { 0xfb, 0x76, 0x15, 0xb2, 0x3d, 0x80, 0x89, 0x1d, |
| 2134 | 0xd4, 0x70, 0x98, 0x0b, 0xc7, 0x95, 0x84, 0xc8, |
| 2135 | 0xb2, 0xfb, 0x64, 0xce, 0x60, 0x97, 0x87, 0x8d, |
| 2136 | 0x17, 0xfc, 0xe4, 0x5a, 0x49, 0xe8, 0x30, 0xb7, |
| 2137 | 0x6e, 0x78, 0x17, 0xe7, 0x2d, 0x5e, 0x12, 0xd4, |
| 2138 | 0x60, 0x64, 0x04, 0x7a, 0xf1, 0x2f, 0x9e, 0x0c }, |
| 2139 | .klen = 48, |
| 2140 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2141 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2142 | .input = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2143 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2144 | .ilen = 16, |
| 2145 | .result = { 0x5b, 0x90, 0x8e, 0xc1, 0xab, 0xdd, 0x67, 0x5f, |
| 2146 | 0x3d, 0x69, 0x8a, 0x95, 0x53, 0xc8, 0x9c, 0xe5 }, |
| 2147 | .rlen = 16, |
| 2148 | }, { |
| 2149 | /* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */ |
| 2150 | .key = { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c, |
| 2151 | 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d, |
| 2152 | 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21, |
| 2153 | 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89, |
| 2154 | 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1, |
| 2155 | 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e }, |
| 2156 | .klen = 48, |
| 2157 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2159 | .input = { 0x05, 0x11, 0xb7, 0x18, 0xab, 0xc6, 0x2d, 0xac, |
| 2160 | 0x70, 0x5d, 0xf6, 0x22, 0x94, 0xcd, 0xe5, 0x6c, |
| 2161 | 0x17, 0x6b, 0xf6, 0x1c, 0xf0, 0xf3, 0x6e, 0xf8, |
| 2162 | 0x50, 0x38, 0x1f, 0x71, 0x49, 0xb6, 0x57, 0xd6, |
| 2163 | 0x8f, 0xcb, 0x8d, 0x6b, 0xe3, 0xa6, 0x29, 0x90, |
| 2164 | 0xfe, 0x2a, 0x62, 0x82, 0xae, 0x6d, 0x8b, 0xf6, |
| 2165 | 0xad, 0x1e, 0x9e, 0x20, 0x5f, 0x38, 0xbe, 0x04, |
| 2166 | 0xda, 0x10, 0x8e, 0xed, 0xa2, 0xa4, 0x87, 0xab, |
| 2167 | 0xda, 0x6b, 0xb4, 0x0c, 0x75, 0xba, 0xd3, 0x7c, |
| 2168 | 0xc9, 0xac, 0x42, 0x31, 0x95, 0x7c, 0xc9, 0x04, |
| 2169 | 0xeb, 0xd5, 0x6e, 0x32, 0x69, 0x8a, 0xdb, 0xa6, |
| 2170 | 0x15, 0xd7, 0x3f, 0x4f, 0x2f, 0x66, 0x69, 0x03, |
| 2171 | 0x9c, 0x1f, 0x54, 0x0f, 0xde, 0x1f, 0xf3, 0x65, |
| 2172 | 0x4c, 0x96, 0x12, 0xed, 0x7c, 0x92, 0x03, 0x01, |
| 2173 | 0x6f, 0xbc, 0x35, 0x93, 0xac, 0xf1, 0x27, 0xf1, |
| 2174 | 0xb4, 0x96, 0x82, 0x5a, 0x5f, 0xb0, 0xa0, 0x50, |
| 2175 | 0x89, 0xa4, 0x8e, 0x66, 0x44, 0x85, 0xcc, 0xfd, |
| 2176 | 0x33, 0x14, 0x70, 0xe3, 0x96, 0xb2, 0xc3, 0xd3, |
| 2177 | 0xbb, 0x54, 0x5a, 0x1a, 0xf9, 0x74, 0xa2, 0xc5, |
| 2178 | 0x2d, 0x64, 0x75, 0xdd, 0xb4, 0x54, 0xe6, 0x74, |
| 2179 | 0x8c, 0xd3, 0x9d, 0x9e, 0x86, 0xab, 0x51, 0x53, |
| 2180 | 0xb7, 0x93, 0x3e, 0x6f, 0xd0, 0x4e, 0x2c, 0x40, |
| 2181 | 0xf6, 0xa8, 0x2e, 0x3e, 0x9d, 0xf4, 0x66, 0xa5, |
| 2182 | 0x76, 0x12, 0x73, 0x44, 0x1a, 0x56, 0xd7, 0x72, |
| 2183 | 0x88, 0xcd, 0x21, 0x8c, 0x4c, 0x0f, 0xfe, 0xda, |
| 2184 | 0x95, 0xe0, 0x3a, 0xa6, 0xa5, 0x84, 0x46, 0xcd, |
| 2185 | 0xd5, 0x3e, 0x9d, 0x3a, 0xe2, 0x67, 0xe6, 0x60, |
| 2186 | 0x1a, 0xe2, 0x70, 0x85, 0x58, 0xc2, 0x1b, 0x09, |
| 2187 | 0xe1, 0xd7, 0x2c, 0xca, 0xad, 0xa8, 0x8f, 0xf9, |
| 2188 | 0xac, 0xb3, 0x0e, 0xdb, 0xca, 0x2e, 0xe2, 0xb8, |
| 2189 | 0x51, 0x71, 0xd9, 0x3c, 0x6c, 0xf1, 0x56, 0xf8, |
| 2190 | 0xea, 0x9c, 0xf1, 0xfb, 0x0c, 0xe6, 0xb7, 0x10, |
| 2191 | 0x1c, 0xf8, 0xa9, 0x7c, 0xe8, 0x53, 0x35, 0xc1, |
| 2192 | 0x90, 0x3e, 0x76, 0x4a, 0x74, 0xa4, 0x21, 0x2c, |
| 2193 | 0xf6, 0x2c, 0x4e, 0x0f, 0x94, 0x3a, 0x88, 0x2e, |
| 2194 | 0x41, 0x09, 0x6a, 0x33, 0x7d, 0xf6, 0xdd, 0x3f, |
| 2195 | 0x8d, 0x23, 0x31, 0x74, 0x84, 0xeb, 0x88, 0x6e, |
| 2196 | 0xcc, 0xb9, 0xbc, 0x22, 0x83, 0x19, 0x07, 0x22, |
| 2197 | 0xa5, 0x2d, 0xdf, 0xa5, 0xf3, 0x80, 0x85, 0x78, |
| 2198 | 0x84, 0x39, 0x6a, 0x6d, 0x6a, 0x99, 0x4f, 0xa5, |
| 2199 | 0x15, 0xfe, 0x46, 0xb0, 0xe4, 0x6c, 0xa5, 0x41, |
| 2200 | 0x3c, 0xce, 0x8f, 0x42, 0x60, 0x71, 0xa7, 0x75, |
| 2201 | 0x08, 0x40, 0x65, 0x8a, 0x82, 0xbf, 0xf5, 0x43, |
| 2202 | 0x71, 0x96, 0xa9, 0x4d, 0x44, 0x8a, 0x20, 0xbe, |
| 2203 | 0xfa, 0x4d, 0xbb, 0xc0, 0x7d, 0x31, 0x96, 0x65, |
| 2204 | 0xe7, 0x75, 0xe5, 0x3e, 0xfd, 0x92, 0x3b, 0xc9, |
| 2205 | 0x55, 0xbb, 0x16, 0x7e, 0xf7, 0xc2, 0x8c, 0xa4, |
| 2206 | 0x40, 0x1d, 0xe5, 0xef, 0x0e, 0xdf, 0xe4, 0x9a, |
| 2207 | 0x62, 0x73, 0x65, 0xfd, 0x46, 0x63, 0x25, 0x3d, |
| 2208 | 0x2b, 0xaf, 0xe5, 0x64, 0xfe, 0xa5, 0x5c, 0xcf, |
| 2209 | 0x24, 0xf3, 0xb4, 0xac, 0x64, 0xba, 0xdf, 0x4b, |
| 2210 | 0xc6, 0x96, 0x7d, 0x81, 0x2d, 0x8d, 0x97, 0xf7, |
| 2211 | 0xc5, 0x68, 0x77, 0x84, 0x32, 0x2b, 0xcc, 0x85, |
| 2212 | 0x74, 0x96, 0xf0, 0x12, 0x77, 0x61, 0xb9, 0xeb, |
| 2213 | 0x71, 0xaa, 0x82, 0xcb, 0x1c, 0xdb, 0x89, 0xc8, |
| 2214 | 0xc6, 0xb5, 0xe3, 0x5c, 0x7d, 0x39, 0x07, 0x24, |
| 2215 | 0xda, 0x39, 0x87, 0x45, 0xc0, 0x2b, 0xbb, 0x01, |
| 2216 | 0xac, 0xbc, 0x2a, 0x5c, 0x7f, 0xfc, 0xe8, 0xce, |
| 2217 | 0x6d, 0x9c, 0x6f, 0xed, 0xd3, 0xc1, 0xa1, 0xd6, |
| 2218 | 0xc5, 0x55, 0xa9, 0x66, 0x2f, 0xe1, 0xc8, 0x32, |
| 2219 | 0xa6, 0x5d, 0xa4, 0x3a, 0x98, 0x73, 0xe8, 0x45, |
| 2220 | 0xa4, 0xc7, 0xa8, 0xb4, 0xf6, 0x13, 0x03, 0xf6, |
| 2221 | 0xe9, 0x2e, 0xc4, 0x29, 0x0f, 0x84, 0xdb, 0xc4, |
| 2222 | 0x21, 0xc4, 0xc2, 0x75, 0x67, 0x89, 0x37, 0x0a }, |
| 2223 | .ilen = 512, |
| 2224 | .result = { 0x1a, 0x1d, 0xa9, 0x30, 0xad, 0xf9, 0x2f, 0x9b, |
| 2225 | 0xb6, 0x1d, 0xae, 0xef, 0xf0, 0x2f, 0xf8, 0x5a, |
| 2226 | 0x39, 0x3c, 0xbf, 0x2a, 0xb2, 0x45, 0xb2, 0x23, |
| 2227 | 0x1b, 0x63, 0x3c, 0xcf, 0xaa, 0xbe, 0xcf, 0x4e, |
| 2228 | 0xfa, 0xe8, 0x29, 0xc2, 0x20, 0x68, 0x2b, 0x3c, |
| 2229 | 0x2e, 0x8b, 0xf7, 0x6e, 0x25, 0xbd, 0xe3, 0x3d, |
| 2230 | 0x66, 0x27, 0xd6, 0xaf, 0xd6, 0x64, 0x3e, 0xe3, |
| 2231 | 0xe8, 0x58, 0x46, 0x97, 0x39, 0x51, 0x07, 0xde, |
| 2232 | 0xcb, 0x37, 0xbc, 0xa9, 0xc0, 0x5f, 0x75, 0xc3, |
| 2233 | 0x0e, 0x84, 0x23, 0x1d, 0x16, 0xd4, 0x1c, 0x59, |
| 2234 | 0x9c, 0x1a, 0x02, 0x55, 0xab, 0x3a, 0x97, 0x1d, |
| 2235 | 0xdf, 0xdd, 0xc7, 0x06, 0x51, 0xd7, 0x70, 0xae, |
| 2236 | 0x23, 0xc6, 0x8c, 0xf5, 0x1e, 0xa0, 0xe5, 0x82, |
| 2237 | 0xb8, 0xb2, 0xbf, 0x04, 0xa0, 0x32, 0x8e, 0x68, |
| 2238 | 0xeb, 0xaf, 0x6e, 0x2d, 0x94, 0x22, 0x2f, 0xce, |
| 2239 | 0x4c, 0xb5, 0x59, 0xe2, 0xa2, 0x2f, 0xa0, 0x98, |
| 2240 | 0x1a, 0x97, 0xc6, 0xd4, 0xb5, 0x00, 0x59, 0xf2, |
| 2241 | 0x84, 0x14, 0x72, 0xb1, 0x9a, 0x6e, 0xa3, 0x7f, |
| 2242 | 0xea, 0x20, 0xe7, 0xcb, 0x65, 0x77, 0x3a, 0xdf, |
| 2243 | 0xc8, 0x97, 0x67, 0x15, 0xc2, 0x2a, 0x27, 0xcc, |
| 2244 | 0x18, 0x55, 0xa1, 0x24, 0x0b, 0x24, 0x24, 0xaf, |
| 2245 | 0x5b, 0xec, 0x68, 0xb8, 0xc8, 0xf5, 0xba, 0x63, |
| 2246 | 0xff, 0xed, 0x89, 0xce, 0xd5, 0x3d, 0x88, 0xf3, |
| 2247 | 0x25, 0xef, 0x05, 0x7c, 0x3a, 0xef, 0xeb, 0xd8, |
| 2248 | 0x7a, 0x32, 0x0d, 0xd1, 0x1e, 0x58, 0x59, 0x99, |
| 2249 | 0x90, 0x25, 0xb5, 0x26, 0xb0, 0xe3, 0x2b, 0x6c, |
| 2250 | 0x4c, 0xa9, 0x8b, 0x84, 0x4f, 0x5e, 0x01, 0x50, |
| 2251 | 0x41, 0x30, 0x58, 0xc5, 0x62, 0x74, 0x52, 0x1d, |
| 2252 | 0x45, 0x24, 0x6a, 0x42, 0x64, 0x4f, 0x97, 0x1c, |
| 2253 | 0xa8, 0x66, 0xb5, 0x6d, 0x79, 0xd4, 0x0d, 0x48, |
| 2254 | 0xc5, 0x5f, 0xf3, 0x90, 0x32, 0xdd, 0xdd, 0xe1, |
| 2255 | 0xe4, 0xa9, 0x9f, 0xfc, 0xc3, 0x52, 0x5a, 0x46, |
| 2256 | 0xe4, 0x81, 0x84, 0x95, 0x36, 0x59, 0x7a, 0x6b, |
| 2257 | 0xaa, 0xb3, 0x60, 0xad, 0xce, 0x9f, 0x9f, 0x28, |
| 2258 | 0xe0, 0x01, 0x75, 0x22, 0xc4, 0x4e, 0xa9, 0x62, |
| 2259 | 0x5c, 0x62, 0x0d, 0x00, 0xcb, 0x13, 0xe8, 0x43, |
| 2260 | 0x72, 0xd4, 0x2d, 0x53, 0x46, 0xb5, 0xd1, 0x16, |
| 2261 | 0x22, 0x18, 0xdf, 0x34, 0x33, 0xf5, 0xd6, 0x1c, |
| 2262 | 0xb8, 0x79, 0x78, 0x97, 0x94, 0xff, 0x72, 0x13, |
| 2263 | 0x4c, 0x27, 0xfc, 0xcb, 0xbf, 0x01, 0x53, 0xa6, |
| 2264 | 0xb4, 0x50, 0x6e, 0xde, 0xdf, 0xb5, 0x43, 0xa4, |
| 2265 | 0x59, 0xdf, 0x52, 0xf9, 0x7c, 0xe0, 0x11, 0x6f, |
| 2266 | 0x2d, 0x14, 0x8e, 0x24, 0x61, 0x2c, 0xe1, 0x17, |
| 2267 | 0xcc, 0xce, 0x51, 0x0c, 0x19, 0x8a, 0x82, 0x30, |
| 2268 | 0x94, 0xd5, 0x3d, 0x6a, 0x53, 0x06, 0x5e, 0xbd, |
| 2269 | 0xb7, 0xeb, 0xfa, 0xfd, 0x27, 0x51, 0xde, 0x85, |
| 2270 | 0x1e, 0x86, 0x53, 0x11, 0x53, 0x94, 0x00, 0xee, |
| 2271 | 0x2b, 0x8c, 0x08, 0x2a, 0xbf, 0xdd, 0xae, 0x11, |
| 2272 | 0xcb, 0x1e, 0xa2, 0x07, 0x9a, 0x80, 0xcf, 0x62, |
| 2273 | 0x9b, 0x09, 0xdc, 0x95, 0x3c, 0x96, 0x8e, 0xb1, |
| 2274 | 0x09, 0xbd, 0xe4, 0xeb, 0xdb, 0xca, 0x70, 0x7a, |
| 2275 | 0x9e, 0xfa, 0x31, 0x18, 0x45, 0x3c, 0x21, 0x33, |
| 2276 | 0xb0, 0xb3, 0x2b, 0xea, 0xf3, 0x71, 0x2d, 0xe1, |
| 2277 | 0x03, 0xad, 0x1b, 0x48, 0xd4, 0x67, 0x27, 0xf0, |
| 2278 | 0x62, 0xe4, 0x3d, 0xfb, 0x9b, 0x08, 0x76, 0xe7, |
| 2279 | 0xdd, 0x2b, 0x01, 0x39, 0x04, 0x5a, 0x58, 0x7a, |
| 2280 | 0xf7, 0x11, 0x90, 0xec, 0xbd, 0x51, 0x5c, 0x32, |
| 2281 | 0x6b, 0xd7, 0x35, 0x39, 0x02, 0x6b, 0xf2, 0xa6, |
| 2282 | 0xd0, 0x0d, 0x07, 0xe1, 0x06, 0xc4, 0x5b, 0x7d, |
| 2283 | 0xe4, 0x6a, 0xd7, 0xee, 0x15, 0x1f, 0x83, 0xb4, |
| 2284 | 0xa3, 0xa7, 0x5e, 0xc3, 0x90, 0xb7, 0xef, 0xd3, |
| 2285 | 0xb7, 0x4f, 0xf8, 0x92, 0x4c, 0xb7, 0x3c, 0x29, |
| 2286 | 0xcd, 0x7e, 0x2b, 0x5d, 0x43, 0xea, 0x42, 0xe7, |
| 2287 | 0x74, 0x3f, 0x7d, 0x58, 0x88, 0x75, 0xde, 0x3e }, |
| 2288 | .rlen = 512, |
| 2289 | } |
| 2290 | }; |
| 2291 | |
| 2292 | static struct cipher_testvec aes_lrw_dec_tv_template[] = { |
| 2293 | /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */ |
| 2294 | /* same as enc vectors with input and result reversed */ |
| 2295 | { /* LRW-32-AES 1 */ |
| 2296 | .key = { 0x45, 0x62, 0xac, 0x25, 0xf8, 0x28, 0x17, 0x6d, |
| 2297 | 0x4c, 0x26, 0x84, 0x14, 0xb5, 0x68, 0x01, 0x85, |
| 2298 | 0x25, 0x8e, 0x2a, 0x05, 0xe7, 0x3e, 0x9d, 0x03, |
| 2299 | 0xee, 0x5a, 0x83, 0x0c, 0xcc, 0x09, 0x4c, 0x87 }, |
| 2300 | .klen = 32, |
| 2301 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2303 | .input = { 0xf1, 0xb2, 0x73, 0xcd, 0x65, 0xa3, 0xdf, 0x5f, |
| 2304 | 0xe9, 0x5d, 0x48, 0x92, 0x54, 0x63, 0x4e, 0xb8 }, |
| 2305 | .ilen = 16, |
| 2306 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2307 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2308 | .rlen = 16, |
| 2309 | }, { /* LRW-32-AES 2 */ |
| 2310 | .key = { 0x59, 0x70, 0x47, 0x14, 0xf5, 0x57, 0x47, 0x8c, |
| 2311 | 0xd7, 0x79, 0xe8, 0x0f, 0x54, 0x88, 0x79, 0x44, |
| 2312 | 0x0d, 0x48, 0xf0, 0xb7, 0xb1, 0x5a, 0x53, 0xea, |
| 2313 | 0x1c, 0xaa, 0x6b, 0x29, 0xc2, 0xca, 0xfb, 0xaf |
| 2314 | }, |
| 2315 | .klen = 32, |
| 2316 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }, |
| 2318 | .input = { 0x00, 0xc8, 0x2b, 0xae, 0x95, 0xbb, 0xcd, 0xe5, |
| 2319 | 0x27, 0x4f, 0x07, 0x69, 0xb2, 0x60, 0xe1, 0x36 }, |
| 2320 | .ilen = 16, |
| 2321 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2322 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2323 | .rlen = 16, |
| 2324 | }, { /* LRW-32-AES 3 */ |
| 2325 | .key = { 0xd8, 0x2a, 0x91, 0x34, 0xb2, 0x6a, 0x56, 0x50, |
| 2326 | 0x30, 0xfe, 0x69, 0xe2, 0x37, 0x7f, 0x98, 0x47, |
| 2327 | 0xcd, 0xf9, 0x0b, 0x16, 0x0c, 0x64, 0x8f, 0xb6, |
| 2328 | 0xb0, 0x0d, 0x0d, 0x1b, 0xae, 0x85, 0x87, 0x1f }, |
| 2329 | .klen = 32, |
| 2330 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2331 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2332 | .input = { 0x76, 0x32, 0x21, 0x83, 0xed, 0x8f, 0xf1, 0x82, |
| 2333 | 0xf9, 0x59, 0x62, 0x03, 0x69, 0x0e, 0x5e, 0x01 }, |
| 2334 | .ilen = 16, |
| 2335 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2336 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2337 | .rlen = 16, |
| 2338 | }, { /* LRW-32-AES 4 */ |
| 2339 | .key = { 0x0f, 0x6a, 0xef, 0xf8, 0xd3, 0xd2, 0xbb, 0x15, |
| 2340 | 0x25, 0x83, 0xf7, 0x3c, 0x1f, 0x01, 0x28, 0x74, |
| 2341 | 0xca, 0xc6, 0xbc, 0x35, 0x4d, 0x4a, 0x65, 0x54, |
| 2342 | 0x90, 0xae, 0x61, 0xcf, 0x7b, 0xae, 0xbd, 0xcc, |
| 2343 | 0xad, 0xe4, 0x94, 0xc5, 0x4a, 0x29, 0xae, 0x70 }, |
| 2344 | .klen = 40, |
| 2345 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2346 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2347 | .input = { 0x9c, 0x0f, 0x15, 0x2f, 0x55, 0xa2, 0xd8, 0xf0, |
| 2348 | 0xd6, 0x7b, 0x8f, 0x9e, 0x28, 0x22, 0xbc, 0x41 }, |
| 2349 | .ilen = 16, |
| 2350 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2351 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2352 | .rlen = 16, |
| 2353 | }, { /* LRW-32-AES 5 */ |
| 2354 | .key = { 0x8a, 0xd4, 0xee, 0x10, 0x2f, 0xbd, 0x81, 0xff, |
| 2355 | 0xf8, 0x86, 0xce, 0xac, 0x93, 0xc5, 0xad, 0xc6, |
| 2356 | 0xa0, 0x19, 0x07, 0xc0, 0x9d, 0xf7, 0xbb, 0xdd, |
| 2357 | 0x52, 0x13, 0xb2, 0xb7, 0xf0, 0xff, 0x11, 0xd8, |
| 2358 | 0xd6, 0x08, 0xd0, 0xcd, 0x2e, 0xb1, 0x17, 0x6f }, |
| 2359 | .klen = 40, |
| 2360 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2361 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2362 | .input = { 0xd4, 0x27, 0x6a, 0x7f, 0x14, 0x91, 0x3d, 0x65, |
| 2363 | 0xc8, 0x60, 0x48, 0x02, 0x87, 0xe3, 0x34, 0x06 }, |
| 2364 | .ilen = 16, |
| 2365 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2366 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2367 | .rlen = 16, |
| 2368 | }, { /* LRW-32-AES 6 */ |
| 2369 | .key = { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c, |
| 2370 | 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d, |
| 2371 | 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21, |
| 2372 | 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89, |
| 2373 | 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1, |
| 2374 | 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e }, |
| 2375 | .klen = 48, |
| 2376 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2377 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2378 | .input = { 0xbd, 0x06, 0xb8, 0xe1, 0xdb, 0x98, 0x89, 0x9e, |
| 2379 | 0xc4, 0x98, 0xe4, 0x91, 0xcf, 0x1c, 0x70, 0x2b }, |
| 2380 | .ilen = 16, |
| 2381 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2382 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2383 | .rlen = 16, |
| 2384 | }, { /* LRW-32-AES 7 */ |
| 2385 | .key = { 0xfb, 0x76, 0x15, 0xb2, 0x3d, 0x80, 0x89, 0x1d, |
| 2386 | 0xd4, 0x70, 0x98, 0x0b, 0xc7, 0x95, 0x84, 0xc8, |
| 2387 | 0xb2, 0xfb, 0x64, 0xce, 0x60, 0x97, 0x87, 0x8d, |
| 2388 | 0x17, 0xfc, 0xe4, 0x5a, 0x49, 0xe8, 0x30, 0xb7, |
| 2389 | 0x6e, 0x78, 0x17, 0xe7, 0x2d, 0x5e, 0x12, 0xd4, |
| 2390 | 0x60, 0x64, 0x04, 0x7a, 0xf1, 0x2f, 0x9e, 0x0c }, |
| 2391 | .klen = 48, |
| 2392 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2393 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 }, |
| 2394 | .input = { 0x5b, 0x90, 0x8e, 0xc1, 0xab, 0xdd, 0x67, 0x5f, |
| 2395 | 0x3d, 0x69, 0x8a, 0x95, 0x53, 0xc8, 0x9c, 0xe5 }, |
| 2396 | .ilen = 16, |
| 2397 | .result = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 2398 | 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }, |
| 2399 | .rlen = 16, |
| 2400 | }, { |
| 2401 | /* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */ |
| 2402 | .key = { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c, |
| 2403 | 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d, |
| 2404 | 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21, |
| 2405 | 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89, |
| 2406 | 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1, |
| 2407 | 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e }, |
| 2408 | .klen = 48, |
| 2409 | .iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2410 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, |
| 2411 | .input = { 0x1a, 0x1d, 0xa9, 0x30, 0xad, 0xf9, 0x2f, 0x9b, |
| 2412 | 0xb6, 0x1d, 0xae, 0xef, 0xf0, 0x2f, 0xf8, 0x5a, |
| 2413 | 0x39, 0x3c, 0xbf, 0x2a, 0xb2, 0x45, 0xb2, 0x23, |
| 2414 | 0x1b, 0x63, 0x3c, 0xcf, 0xaa, 0xbe, 0xcf, 0x4e, |
| 2415 | 0xfa, 0xe8, 0x29, 0xc2, 0x20, 0x68, 0x2b, 0x3c, |
| 2416 | 0x2e, 0x8b, 0xf7, 0x6e, 0x25, 0xbd, 0xe3, 0x3d, |
| 2417 | 0x66, 0x27, 0xd6, 0xaf, 0xd6, 0x64, 0x3e, 0xe3, |
| 2418 | 0xe8, 0x58, 0x46, 0x97, 0x39, 0x51, 0x07, 0xde, |
| 2419 | 0xcb, 0x37, 0xbc, 0xa9, 0xc0, 0x5f, 0x75, 0xc3, |
| 2420 | 0x0e, 0x84, 0x23, 0x1d, 0x16, 0xd4, 0x1c, 0x59, |
| 2421 | 0x9c, 0x1a, 0x02, 0x55, 0xab, 0x3a, 0x97, 0x1d, |
| 2422 | 0xdf, 0xdd, 0xc7, 0x06, 0x51, 0xd7, 0x70, 0xae, |
| 2423 | 0x23, 0xc6, 0x8c, 0xf5, 0x1e, 0xa0, 0xe5, 0x82, |
| 2424 | 0xb8, 0xb2, 0xbf, 0x04, 0xa0, 0x32, 0x8e, 0x68, |
| 2425 | 0xeb, 0xaf, 0x6e, 0x2d, 0x94, 0x22, 0x2f, 0xce, |
| 2426 | 0x4c, 0xb5, 0x59, 0xe2, 0xa2, 0x2f, 0xa0, 0x98, |
| 2427 | 0x1a, 0x97, 0xc6, 0xd4, 0xb5, 0x00, 0x59, 0xf2, |
| 2428 | 0x84, 0x14, 0x72, 0xb1, 0x9a, 0x6e, 0xa3, 0x7f, |
| 2429 | 0xea, 0x20, 0xe7, 0xcb, 0x65, 0x77, 0x3a, 0xdf, |
| 2430 | 0xc8, 0x97, 0x67, 0x15, 0xc2, 0x2a, 0x27, 0xcc, |
| 2431 | 0x18, 0x55, 0xa1, 0x24, 0x0b, 0x24, 0x24, 0xaf, |
| 2432 | 0x5b, 0xec, 0x68, 0xb8, 0xc8, 0xf5, 0xba, 0x63, |
| 2433 | 0xff, 0xed, 0x89, 0xce, 0xd5, 0x3d, 0x88, 0xf3, |
| 2434 | 0x25, 0xef, 0x05, 0x7c, 0x3a, 0xef, 0xeb, 0xd8, |
| 2435 | 0x7a, 0x32, 0x0d, 0xd1, 0x1e, 0x58, 0x59, 0x99, |
| 2436 | 0x90, 0x25, 0xb5, 0x26, 0xb0, 0xe3, 0x2b, 0x6c, |
| 2437 | 0x4c, 0xa9, 0x8b, 0x84, 0x4f, 0x5e, 0x01, 0x50, |
| 2438 | 0x41, 0x30, 0x58, 0xc5, 0x62, 0x74, 0x52, 0x1d, |
| 2439 | 0x45, 0x24, 0x6a, 0x42, 0x64, 0x4f, 0x97, 0x1c, |
| 2440 | 0xa8, 0x66, 0xb5, 0x6d, 0x79, 0xd4, 0x0d, 0x48, |
| 2441 | 0xc5, 0x5f, 0xf3, 0x90, 0x32, 0xdd, 0xdd, 0xe1, |
| 2442 | 0xe4, 0xa9, 0x9f, 0xfc, 0xc3, 0x52, 0x5a, 0x46, |
| 2443 | 0xe4, 0x81, 0x84, 0x95, 0x36, 0x59, 0x7a, 0x6b, |
| 2444 | 0xaa, 0xb3, 0x60, 0xad, 0xce, 0x9f, 0x9f, 0x28, |
| 2445 | 0xe0, 0x01, 0x75, 0x22, 0xc4, 0x4e, 0xa9, 0x62, |
| 2446 | 0x5c, 0x62, 0x0d, 0x00, 0xcb, 0x13, 0xe8, 0x43, |
| 2447 | 0x72, 0xd4, 0x2d, 0x53, 0x46, 0xb5, 0xd1, 0x16, |
| 2448 | 0x22, 0x18, 0xdf, 0x34, 0x33, 0xf5, 0xd6, 0x1c, |
| 2449 | 0xb8, 0x79, 0x78, 0x97, 0x94, 0xff, 0x72, 0x13, |
| 2450 | 0x4c, 0x27, 0xfc, 0xcb, 0xbf, 0x01, 0x53, 0xa6, |
| 2451 | 0xb4, 0x50, 0x6e, 0xde, 0xdf, 0xb5, 0x43, 0xa4, |
| 2452 | 0x59, 0xdf, 0x52, 0xf9, 0x7c, 0xe0, 0x11, 0x6f, |
| 2453 | 0x2d, 0x14, 0x8e, 0x24, 0x61, 0x2c, 0xe1, 0x17, |
| 2454 | 0xcc, 0xce, 0x51, 0x0c, 0x19, 0x8a, 0x82, 0x30, |
| 2455 | 0x94, 0xd5, 0x3d, 0x6a, 0x53, 0x06, 0x5e, 0xbd, |
| 2456 | 0xb7, 0xeb, 0xfa, 0xfd, 0x27, 0x51, 0xde, 0x85, |
| 2457 | 0x1e, 0x86, 0x53, 0x11, 0x53, 0x94, 0x00, 0xee, |
| 2458 | 0x2b, 0x8c, 0x08, 0x2a, 0xbf, 0xdd, 0xae, 0x11, |
| 2459 | 0xcb, 0x1e, 0xa2, 0x07, 0x9a, 0x80, 0xcf, 0x62, |
| 2460 | 0x9b, 0x09, 0xdc, 0x95, 0x3c, 0x96, 0x8e, 0xb1, |
| 2461 | 0x09, 0xbd, 0xe4, 0xeb, 0xdb, 0xca, 0x70, 0x7a, |
| 2462 | 0x9e, 0xfa, 0x31, 0x18, 0x45, 0x3c, 0x21, 0x33, |
| 2463 | 0xb0, 0xb3, 0x2b, 0xea, 0xf3, 0x71, 0x2d, 0xe1, |
| 2464 | 0x03, 0xad, 0x1b, 0x48, 0xd4, 0x67, 0x27, 0xf0, |
| 2465 | 0x62, 0xe4, 0x3d, 0xfb, 0x9b, 0x08, 0x76, 0xe7, |
| 2466 | 0xdd, 0x2b, 0x01, 0x39, 0x04, 0x5a, 0x58, 0x7a, |
| 2467 | 0xf7, 0x11, 0x90, 0xec, 0xbd, 0x51, 0x5c, 0x32, |
| 2468 | 0x6b, 0xd7, 0x35, 0x39, 0x02, 0x6b, 0xf2, 0xa6, |
| 2469 | 0xd0, 0x0d, 0x07, 0xe1, 0x06, 0xc4, 0x5b, 0x7d, |
| 2470 | 0xe4, 0x6a, 0xd7, 0xee, 0x15, 0x1f, 0x83, 0xb4, |
| 2471 | 0xa3, 0xa7, 0x5e, 0xc3, 0x90, 0xb7, 0xef, 0xd3, |
| 2472 | 0xb7, 0x4f, 0xf8, 0x92, 0x4c, 0xb7, 0x3c, 0x29, |
| 2473 | 0xcd, 0x7e, 0x2b, 0x5d, 0x43, 0xea, 0x42, 0xe7, |
| 2474 | 0x74, 0x3f, 0x7d, 0x58, 0x88, 0x75, 0xde, 0x3e }, |
| 2475 | .ilen = 512, |
| 2476 | .result = { 0x05, 0x11, 0xb7, 0x18, 0xab, 0xc6, 0x2d, 0xac, |
| 2477 | 0x70, 0x5d, 0xf6, 0x22, 0x94, 0xcd, 0xe5, 0x6c, |
| 2478 | 0x17, 0x6b, 0xf6, 0x1c, 0xf0, 0xf3, 0x6e, 0xf8, |
| 2479 | 0x50, 0x38, 0x1f, 0x71, 0x49, 0xb6, 0x57, 0xd6, |
| 2480 | 0x8f, 0xcb, 0x8d, 0x6b, 0xe3, 0xa6, 0x29, 0x90, |
| 2481 | 0xfe, 0x2a, 0x62, 0x82, 0xae, 0x6d, 0x8b, 0xf6, |
| 2482 | 0xad, 0x1e, 0x9e, 0x20, 0x5f, 0x38, 0xbe, 0x04, |
| 2483 | 0xda, 0x10, 0x8e, 0xed, 0xa2, 0xa4, 0x87, 0xab, |
| 2484 | 0xda, 0x6b, 0xb4, 0x0c, 0x75, 0xba, 0xd3, 0x7c, |
| 2485 | 0xc9, 0xac, 0x42, 0x31, 0x95, 0x7c, 0xc9, 0x04, |
| 2486 | 0xeb, 0xd5, 0x6e, 0x32, 0x69, 0x8a, 0xdb, 0xa6, |
| 2487 | 0x15, 0xd7, 0x3f, 0x4f, 0x2f, 0x66, 0x69, 0x03, |
| 2488 | 0x9c, 0x1f, 0x54, 0x0f, 0xde, 0x1f, 0xf3, 0x65, |
| 2489 | 0x4c, 0x96, 0x12, 0xed, 0x7c, 0x92, 0x03, 0x01, |
| 2490 | 0x6f, 0xbc, 0x35, 0x93, 0xac, 0xf1, 0x27, 0xf1, |
| 2491 | 0xb4, 0x96, 0x82, 0x5a, 0x5f, 0xb0, 0xa0, 0x50, |
| 2492 | 0x89, 0xa4, 0x8e, 0x66, 0x44, 0x85, 0xcc, 0xfd, |
| 2493 | 0x33, 0x14, 0x70, 0xe3, 0x96, 0xb2, 0xc3, 0xd3, |
| 2494 | 0xbb, 0x54, 0x5a, 0x1a, 0xf9, 0x74, 0xa2, 0xc5, |
| 2495 | 0x2d, 0x64, 0x75, 0xdd, 0xb4, 0x54, 0xe6, 0x74, |
| 2496 | 0x8c, 0xd3, 0x9d, 0x9e, 0x86, 0xab, 0x51, 0x53, |
| 2497 | 0xb7, 0x93, 0x3e, 0x6f, 0xd0, 0x4e, 0x2c, 0x40, |
| 2498 | 0xf6, 0xa8, 0x2e, 0x3e, 0x9d, 0xf4, 0x66, 0xa5, |
| 2499 | 0x76, 0x12, 0x73, 0x44, 0x1a, 0x56, 0xd7, 0x72, |
| 2500 | 0x88, 0xcd, 0x21, 0x8c, 0x4c, 0x0f, 0xfe, 0xda, |
| 2501 | 0x95, 0xe0, 0x3a, 0xa6, 0xa5, 0x84, 0x46, 0xcd, |
| 2502 | 0xd5, 0x3e, 0x9d, 0x3a, 0xe2, 0x67, 0xe6, 0x60, |
| 2503 | 0x1a, 0xe2, 0x70, 0x85, 0x58, 0xc2, 0x1b, 0x09, |
| 2504 | 0xe1, 0xd7, 0x2c, 0xca, 0xad, 0xa8, 0x8f, 0xf9, |
| 2505 | 0xac, 0xb3, 0x0e, 0xdb, 0xca, 0x2e, 0xe2, 0xb8, |
| 2506 | 0x51, 0x71, 0xd9, 0x3c, 0x6c, 0xf1, 0x56, 0xf8, |
| 2507 | 0xea, 0x9c, 0xf1, 0xfb, 0x0c, 0xe6, 0xb7, 0x10, |
| 2508 | 0x1c, 0xf8, 0xa9, 0x7c, 0xe8, 0x53, 0x35, 0xc1, |
| 2509 | 0x90, 0x3e, 0x76, 0x4a, 0x74, 0xa4, 0x21, 0x2c, |
| 2510 | 0xf6, 0x2c, 0x4e, 0x0f, 0x94, 0x3a, 0x88, 0x2e, |
| 2511 | 0x41, 0x09, 0x6a, 0x33, 0x7d, 0xf6, 0xdd, 0x3f, |
| 2512 | 0x8d, 0x23, 0x31, 0x74, 0x84, 0xeb, 0x88, 0x6e, |
| 2513 | 0xcc, 0xb9, 0xbc, 0x22, 0x83, 0x19, 0x07, 0x22, |
| 2514 | 0xa5, 0x2d, 0xdf, 0xa5, 0xf3, 0x80, 0x85, 0x78, |
| 2515 | 0x84, 0x39, 0x6a, 0x6d, 0x6a, 0x99, 0x4f, 0xa5, |
| 2516 | 0x15, 0xfe, 0x46, 0xb0, 0xe4, 0x6c, 0xa5, 0x41, |
| 2517 | 0x3c, 0xce, 0x8f, 0x42, 0x60, 0x71, 0xa7, 0x75, |
| 2518 | 0x08, 0x40, 0x65, 0x8a, 0x82, 0xbf, 0xf5, 0x43, |
| 2519 | 0x71, 0x96, 0xa9, 0x4d, 0x44, 0x8a, 0x20, 0xbe, |
| 2520 | 0xfa, 0x4d, 0xbb, 0xc0, 0x7d, 0x31, 0x96, 0x65, |
| 2521 | 0xe7, 0x75, 0xe5, 0x3e, 0xfd, 0x92, 0x3b, 0xc9, |
| 2522 | 0x55, 0xbb, 0x16, 0x7e, 0xf7, 0xc2, 0x8c, 0xa4, |
| 2523 | 0x40, 0x1d, 0xe5, 0xef, 0x0e, 0xdf, 0xe4, 0x9a, |
| 2524 | 0x62, 0x73, 0x65, 0xfd, 0x46, 0x63, 0x25, 0x3d, |
| 2525 | 0x2b, 0xaf, 0xe5, 0x64, 0xfe, 0xa5, 0x5c, 0xcf, |
| 2526 | 0x24, 0xf3, 0xb4, 0xac, 0x64, 0xba, 0xdf, 0x4b, |
| 2527 | 0xc6, 0x96, 0x7d, 0x81, 0x2d, 0x8d, 0x97, 0xf7, |
| 2528 | 0xc5, 0x68, 0x77, 0x84, 0x32, 0x2b, 0xcc, 0x85, |
| 2529 | 0x74, 0x96, 0xf0, 0x12, 0x77, 0x61, 0xb9, 0xeb, |
| 2530 | 0x71, 0xaa, 0x82, 0xcb, 0x1c, 0xdb, 0x89, 0xc8, |
| 2531 | 0xc6, 0xb5, 0xe3, 0x5c, 0x7d, 0x39, 0x07, 0x24, |
| 2532 | 0xda, 0x39, 0x87, 0x45, 0xc0, 0x2b, 0xbb, 0x01, |
| 2533 | 0xac, 0xbc, 0x2a, 0x5c, 0x7f, 0xfc, 0xe8, 0xce, |
| 2534 | 0x6d, 0x9c, 0x6f, 0xed, 0xd3, 0xc1, 0xa1, 0xd6, |
| 2535 | 0xc5, 0x55, 0xa9, 0x66, 0x2f, 0xe1, 0xc8, 0x32, |
| 2536 | 0xa6, 0x5d, 0xa4, 0x3a, 0x98, 0x73, 0xe8, 0x45, |
| 2537 | 0xa4, 0xc7, 0xa8, 0xb4, 0xf6, 0x13, 0x03, 0xf6, |
| 2538 | 0xe9, 0x2e, 0xc4, 0x29, 0x0f, 0x84, 0xdb, 0xc4, |
| 2539 | 0x21, 0xc4, 0xc2, 0x75, 0x67, 0x89, 0x37, 0x0a }, |
| 2540 | .rlen = 512, |
| 2541 | } |
| 2542 | }; |
| 2543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | /* Cast5 test vectors from RFC 2144 */ |
| 2545 | #define CAST5_ENC_TEST_VECTORS 3 |
| 2546 | #define CAST5_DEC_TEST_VECTORS 3 |
| 2547 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2548 | static struct cipher_testvec cast5_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2549 | { |
| 2550 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, |
| 2551 | 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, |
| 2552 | .klen = 16, |
| 2553 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2554 | .ilen = 8, |
| 2555 | .result = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 }, |
| 2556 | .rlen = 8, |
| 2557 | }, { |
| 2558 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, |
| 2559 | 0x23, 0x45 }, |
| 2560 | .klen = 10, |
| 2561 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2562 | .ilen = 8, |
| 2563 | .result = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b }, |
| 2564 | .rlen = 8, |
| 2565 | }, { |
| 2566 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12 }, |
| 2567 | .klen = 5, |
| 2568 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2569 | .ilen = 8, |
| 2570 | .result = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e }, |
| 2571 | .rlen = 8, |
| 2572 | }, |
| 2573 | }; |
| 2574 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2575 | static struct cipher_testvec cast5_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2576 | { |
| 2577 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, |
| 2578 | 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, |
| 2579 | .klen = 16, |
| 2580 | .input = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 }, |
| 2581 | .ilen = 8, |
| 2582 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2583 | .rlen = 8, |
| 2584 | }, { |
| 2585 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, |
| 2586 | 0x23, 0x45 }, |
| 2587 | .klen = 10, |
| 2588 | .input = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b }, |
| 2589 | .ilen = 8, |
| 2590 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2591 | .rlen = 8, |
| 2592 | }, { |
| 2593 | .key = { 0x01, 0x23, 0x45, 0x67, 0x12 }, |
| 2594 | .klen = 5, |
| 2595 | .input = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e }, |
| 2596 | .ilen = 8, |
| 2597 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2598 | .rlen = 8, |
| 2599 | }, |
| 2600 | }; |
| 2601 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2602 | /* |
| 2603 | * ARC4 test vectors from OpenSSL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2604 | */ |
| 2605 | #define ARC4_ENC_TEST_VECTORS 7 |
| 2606 | #define ARC4_DEC_TEST_VECTORS 7 |
| 2607 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2608 | static struct cipher_testvec arc4_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2609 | { |
| 2610 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2611 | .klen = 8, |
| 2612 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2613 | .ilen = 8, |
| 2614 | .result = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 }, |
| 2615 | .rlen = 8, |
| 2616 | }, { |
| 2617 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2618 | .klen = 8, |
| 2619 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2620 | .ilen = 8, |
| 2621 | .result = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 }, |
| 2622 | .rlen = 8, |
| 2623 | }, { |
| 2624 | .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2625 | .klen = 8, |
| 2626 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2627 | .ilen = 8, |
| 2628 | .result = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a }, |
| 2629 | .rlen = 8, |
| 2630 | }, { |
| 2631 | .key = { 0xef, 0x01, 0x23, 0x45}, |
| 2632 | .klen = 4, |
| 2633 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2634 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2635 | 0x00, 0x00, 0x00, 0x00 }, |
| 2636 | .ilen = 20, |
| 2637 | .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, |
| 2638 | 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba, |
| 2639 | 0x36, 0xb6, 0x78, 0x58 }, |
| 2640 | .rlen = 20, |
| 2641 | }, { |
| 2642 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2643 | .klen = 8, |
| 2644 | .input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2645 | 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2646 | 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2647 | 0x12, 0x34, 0x56, 0x78 }, |
| 2648 | .ilen = 28, |
| 2649 | .result = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89, |
| 2650 | 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c, |
| 2651 | 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87, |
| 2652 | 0x40, 0x01, 0x1e, 0xcf }, |
| 2653 | .rlen = 28, |
| 2654 | }, { |
| 2655 | .key = { 0xef, 0x01, 0x23, 0x45 }, |
| 2656 | .klen = 4, |
| 2657 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2658 | 0x00, 0x00 }, |
| 2659 | .ilen = 10, |
| 2660 | .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, |
| 2661 | 0xbd, 0x61 }, |
| 2662 | .rlen = 10, |
| 2663 | }, { |
| 2664 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, |
| 2665 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2666 | .klen = 16, |
| 2667 | .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, |
| 2668 | .ilen = 8, |
| 2669 | .result = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 }, |
| 2670 | .rlen = 8, |
| 2671 | }, |
| 2672 | }; |
| 2673 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2674 | static struct cipher_testvec arc4_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2675 | { |
| 2676 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2677 | .klen = 8, |
| 2678 | .input = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 }, |
| 2679 | .ilen = 8, |
| 2680 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2681 | .rlen = 8, |
| 2682 | }, { |
| 2683 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2684 | .klen = 8, |
| 2685 | .input = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 }, |
| 2686 | .ilen = 8, |
| 2687 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2688 | .rlen = 8, |
| 2689 | }, { |
| 2690 | .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2691 | .klen = 8, |
| 2692 | .input = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a }, |
| 2693 | .ilen = 8, |
| 2694 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2695 | .rlen = 8, |
| 2696 | }, { |
| 2697 | .key = { 0xef, 0x01, 0x23, 0x45}, |
| 2698 | .klen = 4, |
| 2699 | .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, |
| 2700 | 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba, |
| 2701 | 0x36, 0xb6, 0x78, 0x58 }, |
| 2702 | .ilen = 20, |
| 2703 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2704 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2705 | 0x00, 0x00, 0x00, 0x00 }, |
| 2706 | .rlen = 20, |
| 2707 | }, { |
| 2708 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, |
| 2709 | .klen = 8, |
| 2710 | .input = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89, |
| 2711 | 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c, |
| 2712 | 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87, |
| 2713 | 0x40, 0x01, 0x1e, 0xcf }, |
| 2714 | .ilen = 28, |
| 2715 | .result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2716 | 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2717 | 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, |
| 2718 | 0x12, 0x34, 0x56, 0x78 }, |
| 2719 | .rlen = 28, |
| 2720 | }, { |
| 2721 | .key = { 0xef, 0x01, 0x23, 0x45 }, |
| 2722 | .klen = 4, |
| 2723 | .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, |
| 2724 | 0xbd, 0x61 }, |
| 2725 | .ilen = 10, |
| 2726 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 2727 | 0x00, 0x00 }, |
| 2728 | .rlen = 10, |
| 2729 | }, { |
| 2730 | .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, |
| 2731 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2732 | .klen = 16, |
| 2733 | .input = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 }, |
| 2734 | .ilen = 8, |
| 2735 | .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, |
| 2736 | .rlen = 8, |
| 2737 | }, |
| 2738 | }; |
| 2739 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2740 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2741 | * TEA test vectors |
| 2742 | */ |
| 2743 | #define TEA_ENC_TEST_VECTORS 4 |
| 2744 | #define TEA_DEC_TEST_VECTORS 4 |
| 2745 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2746 | static struct cipher_testvec tea_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2747 | { |
| 2748 | .key = { [0 ... 15] = 0x00 }, |
| 2749 | .klen = 16, |
| 2750 | .input = { [0 ... 8] = 0x00 }, |
| 2751 | .ilen = 8, |
| 2752 | .result = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 }, |
| 2753 | .rlen = 8, |
| 2754 | }, { |
| 2755 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 2756 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 2757 | .klen = 16, |
| 2758 | .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 2759 | .ilen = 8, |
| 2760 | .result = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 }, |
| 2761 | .rlen = 8, |
| 2762 | }, { |
| 2763 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 2764 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 2765 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2766 | .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2767 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 2768 | .ilen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2769 | .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2770 | 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, |
| 2771 | .rlen = 16, |
| 2772 | }, { |
| 2773 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 2774 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 2775 | .klen = 16, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2776 | .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 2777 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 2778 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2779 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 2780 | .ilen = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2781 | .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, |
| 2782 | 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, |
| 2783 | 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2784 | 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, |
| 2785 | .rlen = 32, |
| 2786 | } |
| 2787 | }; |
| 2788 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2789 | static struct cipher_testvec tea_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2790 | { |
| 2791 | .key = { [0 ... 15] = 0x00 }, |
| 2792 | .klen = 16, |
| 2793 | .input = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 }, |
| 2794 | .ilen = 8, |
| 2795 | .result = { [0 ... 8] = 0x00 }, |
| 2796 | .rlen = 8, |
| 2797 | }, { |
| 2798 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 2799 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 2800 | .klen = 16, |
| 2801 | .input = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 }, |
| 2802 | .ilen = 8, |
| 2803 | .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 2804 | .rlen = 8, |
| 2805 | }, { |
| 2806 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 2807 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 2808 | .klen = 16, |
| 2809 | .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2810 | 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, |
| 2811 | .ilen = 16, |
| 2812 | .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2813 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 2814 | .rlen = 16, |
| 2815 | }, { |
| 2816 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 2817 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 2818 | .klen = 16, |
| 2819 | .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2820 | 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, |
| 2821 | 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, |
| 2822 | 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2823 | .ilen = 32, |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2824 | .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 2825 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 2826 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2827 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 2828 | .rlen = 32, |
| 2829 | } |
| 2830 | }; |
| 2831 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2832 | /* |
| 2833 | * XTEA test vectors |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2834 | */ |
| 2835 | #define XTEA_ENC_TEST_VECTORS 4 |
| 2836 | #define XTEA_DEC_TEST_VECTORS 4 |
| 2837 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2838 | static struct cipher_testvec xtea_enc_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2839 | { |
| 2840 | .key = { [0 ... 15] = 0x00 }, |
| 2841 | .klen = 16, |
| 2842 | .input = { [0 ... 8] = 0x00 }, |
| 2843 | .ilen = 8, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2844 | .result = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2845 | .rlen = 8, |
| 2846 | }, { |
| 2847 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 2848 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 2849 | .klen = 16, |
| 2850 | .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 2851 | .ilen = 8, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2852 | .result = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2853 | .rlen = 8, |
| 2854 | }, { |
| 2855 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 2856 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 2857 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2858 | .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2859 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 2860 | .ilen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2861 | .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2862 | 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, |
| 2863 | .rlen = 16, |
| 2864 | }, { |
| 2865 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 2866 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 2867 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2868 | .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 2869 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 2870 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2871 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 2872 | .ilen = 32, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2873 | .result = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a, |
| 2874 | 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07, |
| 2875 | 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4, |
| 2876 | 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2877 | .rlen = 32, |
| 2878 | } |
| 2879 | }; |
| 2880 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2881 | static struct cipher_testvec xtea_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2882 | { |
| 2883 | .key = { [0 ... 15] = 0x00 }, |
| 2884 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2885 | .input = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2886 | .ilen = 8, |
| 2887 | .result = { [0 ... 8] = 0x00 }, |
| 2888 | .rlen = 8, |
| 2889 | }, { |
| 2890 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 2891 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 2892 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2893 | .input = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2894 | .ilen = 8, |
| 2895 | .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 2896 | .rlen = 8, |
| 2897 | }, { |
| 2898 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 2899 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 2900 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2901 | .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d, |
| 2902 | 0x77, 0x4d, 0xd4, 0xb4, 0x87, 0x24, 0xe3, 0x9a }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2903 | .ilen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2904 | .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2905 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 2906 | .rlen = 16, |
| 2907 | }, { |
| 2908 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 2909 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 2910 | .klen = 16, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2911 | .input = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a, |
| 2912 | 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07, |
| 2913 | 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4, |
| 2914 | 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2915 | .ilen = 32, |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 2916 | .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 2917 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 2918 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2919 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 2920 | .rlen = 32, |
| 2921 | } |
| 2922 | }; |
| 2923 | |
| 2924 | /* |
| 2925 | * KHAZAD test vectors. |
| 2926 | */ |
| 2927 | #define KHAZAD_ENC_TEST_VECTORS 5 |
| 2928 | #define KHAZAD_DEC_TEST_VECTORS 5 |
| 2929 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2930 | static struct cipher_testvec khazad_enc_tv_template[] = { |
| 2931 | { |
| 2932 | .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2933 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2934 | .klen = 16, |
| 2935 | .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2936 | .ilen = 8, |
| 2937 | .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f }, |
| 2938 | .rlen = 8, |
| 2939 | }, { |
| 2940 | .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, |
| 2941 | 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, |
| 2942 | .klen = 16, |
| 2943 | .input = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, |
| 2944 | .ilen = 8, |
| 2945 | .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 }, |
| 2946 | .rlen = 8, |
| 2947 | }, { |
| 2948 | .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, |
| 2949 | 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, |
| 2950 | .klen = 16, |
| 2951 | .input = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, |
| 2952 | .ilen = 8, |
| 2953 | .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c }, |
| 2954 | .rlen = 8, |
| 2955 | }, { |
| 2956 | .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, |
| 2957 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 2958 | .klen = 16, |
| 2959 | .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 2960 | .ilen = 8, |
| 2961 | .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, |
| 2962 | .rlen = 8, |
| 2963 | }, { |
| 2964 | .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, |
| 2965 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 2966 | .klen = 16, |
| 2967 | .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f , |
| 2968 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 2969 | .ilen = 16, |
| 2970 | .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 , |
| 2971 | 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, |
| 2972 | .rlen = 16, |
| 2973 | }, |
| 2974 | }; |
| 2975 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2976 | static struct cipher_testvec khazad_dec_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2977 | { |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 2978 | .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2979 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2980 | .klen = 16, |
| 2981 | .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f }, |
| 2982 | .ilen = 8, |
| 2983 | .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 2984 | .rlen = 8, |
| 2985 | }, { |
| 2986 | .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, |
| 2987 | 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, |
| 2988 | .klen = 16, |
| 2989 | .input = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 }, |
| 2990 | .ilen = 8, |
| 2991 | .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, |
| 2992 | .rlen = 8, |
| 2993 | }, { |
| 2994 | .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, |
| 2995 | 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, |
| 2996 | .klen = 16, |
| 2997 | .input = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c }, |
| 2998 | .ilen = 8, |
| 2999 | .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, |
| 3000 | .rlen = 8, |
| 3001 | }, { |
| 3002 | .key = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, |
| 3003 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 3004 | .klen = 16, |
| 3005 | .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, |
| 3006 | .ilen = 8, |
| 3007 | .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 3008 | .rlen = 8, |
| 3009 | }, { |
| 3010 | .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, |
| 3011 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 3012 | .klen = 16, |
| 3013 | .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 , |
| 3014 | 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, |
| 3015 | .ilen = 16, |
| 3016 | .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f , |
| 3017 | 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, |
| 3018 | .rlen = 16, |
| 3019 | }, |
| 3020 | }; |
| 3021 | |
| 3022 | /* |
| 3023 | * Anubis test vectors. |
| 3024 | */ |
| 3025 | |
| 3026 | #define ANUBIS_ENC_TEST_VECTORS 5 |
| 3027 | #define ANUBIS_DEC_TEST_VECTORS 5 |
| 3028 | #define ANUBIS_CBC_ENC_TEST_VECTORS 2 |
| 3029 | #define ANUBIS_CBC_DEC_TEST_VECTORS 2 |
| 3030 | |
| 3031 | static struct cipher_testvec anubis_enc_tv_template[] = { |
| 3032 | { |
| 3033 | .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3034 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3035 | .klen = 16, |
| 3036 | .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3037 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3038 | .ilen = 16, |
| 3039 | .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, |
| 3040 | 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 }, |
| 3041 | .rlen = 16, |
| 3042 | }, { |
| 3043 | |
| 3044 | .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3045 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3046 | 0x03, 0x03, 0x03, 0x03 }, |
| 3047 | .klen = 20, |
| 3048 | .input = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3049 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }, |
| 3050 | .ilen = 16, |
| 3051 | .result = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49, |
| 3052 | 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae }, |
| 3053 | .rlen = 16, |
| 3054 | }, { |
| 3055 | .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3056 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3057 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3058 | 0x24, 0x24, 0x24, 0x24 }, |
| 3059 | .klen = 28, |
| 3060 | .input = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3061 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 }, |
| 3062 | .ilen = 16, |
| 3063 | .result = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d, |
| 3064 | 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde }, |
| 3065 | .rlen = 16, |
| 3066 | }, { |
| 3067 | .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3068 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3069 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3070 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, |
| 3071 | .klen = 32, |
| 3072 | .input = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3073 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, |
| 3074 | .ilen = 16, |
| 3075 | .result = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4, |
| 3076 | 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe }, |
| 3077 | .rlen = 16, |
| 3078 | }, { |
| 3079 | .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3080 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3081 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3082 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3083 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3084 | .klen = 40, |
| 3085 | .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3086 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3087 | .ilen = 16, |
| 3088 | .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, |
| 3089 | 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee }, |
| 3090 | .rlen = 16, |
| 3091 | }, |
| 3092 | }; |
| 3093 | |
| 3094 | static struct cipher_testvec anubis_dec_tv_template[] = { |
| 3095 | { |
| 3096 | .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3097 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3098 | .klen = 16, |
| 3099 | .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, |
| 3100 | 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 }, |
| 3101 | .ilen = 16, |
| 3102 | .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3103 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3104 | .rlen = 16, |
| 3105 | }, { |
| 3106 | |
| 3107 | .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3108 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3109 | 0x03, 0x03, 0x03, 0x03 }, |
| 3110 | .klen = 20, |
| 3111 | .input = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49, |
| 3112 | 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae }, |
| 3113 | .ilen = 16, |
| 3114 | .result = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, |
| 3115 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }, |
| 3116 | .rlen = 16, |
| 3117 | }, { |
| 3118 | .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3119 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3120 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3121 | 0x24, 0x24, 0x24, 0x24 }, |
| 3122 | .klen = 28, |
| 3123 | .input = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d, |
| 3124 | 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde }, |
| 3125 | .ilen = 16, |
| 3126 | .result = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 3127 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 }, |
| 3128 | .rlen = 16, |
| 3129 | }, { |
| 3130 | .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3131 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3132 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3133 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, |
| 3134 | .klen = 32, |
| 3135 | .input = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4, |
| 3136 | 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe }, |
| 3137 | .ilen = 16, |
| 3138 | .result = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 3139 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, |
| 3140 | .rlen = 16, |
| 3141 | }, { |
| 3142 | .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3143 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3144 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3145 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3146 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3147 | .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, |
| 3148 | 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee }, |
| 3149 | .klen = 40, |
| 3150 | .ilen = 16, |
| 3151 | .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3152 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3153 | .rlen = 16, |
| 3154 | }, |
| 3155 | }; |
| 3156 | |
| 3157 | static struct cipher_testvec anubis_cbc_enc_tv_template[] = { |
| 3158 | { |
| 3159 | .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3160 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3161 | .klen = 16, |
| 3162 | .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3163 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3164 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3165 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3166 | .ilen = 32, |
| 3167 | .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, |
| 3168 | 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90, |
| 3169 | 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66, |
| 3170 | 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe }, |
| 3171 | .rlen = 32, |
| 3172 | }, { |
| 3173 | .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3174 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3175 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3176 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3177 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3178 | .klen = 40, |
| 3179 | .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3180 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3181 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3182 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3183 | .ilen = 32, |
| 3184 | .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, |
| 3185 | 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee, |
| 3186 | 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75, |
| 3187 | 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 }, |
| 3188 | .rlen = 32, |
| 3189 | }, |
| 3190 | }; |
| 3191 | |
| 3192 | static struct cipher_testvec anubis_cbc_dec_tv_template[] = { |
| 3193 | { |
| 3194 | .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3195 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3196 | .klen = 16, |
| 3197 | .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, |
| 3198 | 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90, |
| 3199 | 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66, |
| 3200 | 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe }, |
| 3201 | .ilen = 32, |
| 3202 | .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3203 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3204 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, |
| 3205 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, |
| 3206 | .rlen = 32, |
| 3207 | }, { |
| 3208 | .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3209 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3210 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3211 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3212 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3213 | .klen = 40, |
| 3214 | .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, |
| 3215 | 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee, |
| 3216 | 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75, |
| 3217 | 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 }, |
| 3218 | .ilen = 32, |
| 3219 | .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3220 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3221 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, |
| 3222 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, |
| 3223 | .rlen = 32, |
| 3224 | }, |
| 3225 | }; |
| 3226 | |
Aaron Grothe | fb4f10e | 2005-09-01 17:42:46 -0700 | [diff] [blame] | 3227 | /* |
| 3228 | * XETA test vectors |
| 3229 | */ |
| 3230 | #define XETA_ENC_TEST_VECTORS 4 |
| 3231 | #define XETA_DEC_TEST_VECTORS 4 |
| 3232 | |
| 3233 | static struct cipher_testvec xeta_enc_tv_template[] = { |
| 3234 | { |
| 3235 | .key = { [0 ... 15] = 0x00 }, |
| 3236 | .klen = 16, |
| 3237 | .input = { [0 ... 8] = 0x00 }, |
| 3238 | .ilen = 8, |
| 3239 | .result = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 }, |
| 3240 | .rlen = 8, |
| 3241 | }, { |
| 3242 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 3243 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 3244 | .klen = 16, |
| 3245 | .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 3246 | .ilen = 8, |
| 3247 | .result = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 }, |
| 3248 | .rlen = 8, |
| 3249 | }, { |
| 3250 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 3251 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 3252 | .klen = 16, |
| 3253 | .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, |
| 3254 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 3255 | .ilen = 16, |
| 3256 | .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, |
| 3257 | 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, |
| 3258 | .rlen = 16, |
| 3259 | }, { |
| 3260 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 3261 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 3262 | .klen = 16, |
| 3263 | .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 3264 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 3265 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
| 3266 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 3267 | .ilen = 32, |
| 3268 | .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, |
| 3269 | 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, |
| 3270 | 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, |
| 3271 | 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, |
| 3272 | .rlen = 32, |
| 3273 | } |
| 3274 | }; |
| 3275 | |
| 3276 | static struct cipher_testvec xeta_dec_tv_template[] = { |
| 3277 | { |
| 3278 | .key = { [0 ... 15] = 0x00 }, |
| 3279 | .klen = 16, |
| 3280 | .input = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 }, |
| 3281 | .ilen = 8, |
| 3282 | .result = { [0 ... 8] = 0x00 }, |
| 3283 | .rlen = 8, |
| 3284 | }, { |
| 3285 | .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, |
| 3286 | 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, |
| 3287 | .klen = 16, |
| 3288 | .input = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 }, |
| 3289 | .ilen = 8, |
| 3290 | .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, |
| 3291 | .rlen = 8, |
| 3292 | }, { |
| 3293 | .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, |
| 3294 | 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, |
| 3295 | .klen = 16, |
| 3296 | .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, |
| 3297 | 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, |
| 3298 | .ilen = 16, |
| 3299 | .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, |
| 3300 | 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, |
| 3301 | .rlen = 16, |
| 3302 | }, { |
| 3303 | .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, |
| 3304 | 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, |
| 3305 | .klen = 16, |
| 3306 | .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, |
| 3307 | 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, |
| 3308 | 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, |
| 3309 | 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, |
| 3310 | .ilen = 32, |
| 3311 | .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, |
| 3312 | 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, |
| 3313 | 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, |
| 3314 | 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, |
| 3315 | .rlen = 32, |
| 3316 | } |
| 3317 | }; |
| 3318 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3319 | /* |
| 3320 | * Compression stuff. |
| 3321 | */ |
| 3322 | #define COMP_BUF_SIZE 512 |
| 3323 | |
| 3324 | struct comp_testvec { |
| 3325 | int inlen, outlen; |
| 3326 | char input[COMP_BUF_SIZE]; |
| 3327 | char output[COMP_BUF_SIZE]; |
| 3328 | }; |
| 3329 | |
| 3330 | /* |
| 3331 | * Deflate test vectors (null-terminated strings). |
| 3332 | * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. |
| 3333 | */ |
| 3334 | #define DEFLATE_COMP_TEST_VECTORS 2 |
| 3335 | #define DEFLATE_DECOMP_TEST_VECTORS 2 |
| 3336 | |
| 3337 | static struct comp_testvec deflate_comp_tv_template[] = { |
| 3338 | { |
| 3339 | .inlen = 70, |
| 3340 | .outlen = 38, |
| 3341 | .input = "Join us now and share the software " |
| 3342 | "Join us now and share the software ", |
| 3343 | .output = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56, |
| 3344 | 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51, |
| 3345 | 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9, |
| 3346 | 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07, |
| 3347 | 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 }, |
| 3348 | }, { |
| 3349 | .inlen = 191, |
| 3350 | .outlen = 122, |
| 3351 | .input = "This document describes a compression method based on the DEFLATE" |
| 3352 | "compression algorithm. This document defines the application of " |
| 3353 | "the DEFLATE algorithm to the IP Payload Compression Protocol.", |
| 3354 | .output = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04, |
| 3355 | 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09, |
| 3356 | 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8, |
| 3357 | 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49, |
| 3358 | 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27, |
| 3359 | 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2, |
| 3360 | 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad, |
| 3361 | 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4, |
| 3362 | 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b, |
| 3363 | 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f, |
| 3364 | 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf, |
| 3365 | 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02, |
| 3366 | 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98, |
| 3367 | 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a, |
| 3368 | 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79, |
| 3369 | 0xfa, 0x02 }, |
| 3370 | }, |
| 3371 | }; |
| 3372 | |
| 3373 | static struct comp_testvec deflate_decomp_tv_template[] = { |
| 3374 | { |
| 3375 | .inlen = 122, |
| 3376 | .outlen = 191, |
| 3377 | .input = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04, |
| 3378 | 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09, |
| 3379 | 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8, |
| 3380 | 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49, |
| 3381 | 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27, |
| 3382 | 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2, |
| 3383 | 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad, |
| 3384 | 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4, |
| 3385 | 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b, |
| 3386 | 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f, |
| 3387 | 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf, |
| 3388 | 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02, |
| 3389 | 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98, |
| 3390 | 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a, |
| 3391 | 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79, |
| 3392 | 0xfa, 0x02 }, |
| 3393 | .output = "This document describes a compression method based on the DEFLATE" |
| 3394 | "compression algorithm. This document defines the application of " |
| 3395 | "the DEFLATE algorithm to the IP Payload Compression Protocol.", |
| 3396 | }, { |
| 3397 | .inlen = 38, |
| 3398 | .outlen = 70, |
| 3399 | .input = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56, |
| 3400 | 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51, |
| 3401 | 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9, |
| 3402 | 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07, |
| 3403 | 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 }, |
| 3404 | .output = "Join us now and share the software " |
| 3405 | "Join us now and share the software ", |
| 3406 | }, |
| 3407 | }; |
| 3408 | |
| 3409 | /* |
| 3410 | * Michael MIC test vectors from IEEE 802.11i |
| 3411 | */ |
| 3412 | #define MICHAEL_MIC_TEST_VECTORS 6 |
| 3413 | |
Herbert Xu | ef2736f | 2005-06-22 13:26:03 -0700 | [diff] [blame] | 3414 | static struct hash_testvec michael_mic_tv_template[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3415 | { |
| 3416 | .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
| 3417 | .ksize = 8, |
| 3418 | .plaintext = { }, |
| 3419 | .psize = 0, |
| 3420 | .digest = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 } |
| 3421 | }, |
| 3422 | { |
| 3423 | .key = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }, |
| 3424 | .ksize = 8, |
| 3425 | .plaintext = { 'M' }, |
| 3426 | .psize = 1, |
| 3427 | .digest = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f } |
| 3428 | }, |
| 3429 | { |
| 3430 | .key = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }, |
| 3431 | .ksize = 8, |
| 3432 | .plaintext = { 'M', 'i' }, |
| 3433 | .psize = 2, |
| 3434 | .digest = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 } |
| 3435 | }, |
| 3436 | { |
| 3437 | .key = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }, |
| 3438 | .ksize = 8, |
| 3439 | .plaintext = { 'M', 'i', 'c' }, |
| 3440 | .psize = 3, |
| 3441 | .digest = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb } |
| 3442 | }, |
| 3443 | { |
| 3444 | .key = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }, |
| 3445 | .ksize = 8, |
| 3446 | .plaintext = { 'M', 'i', 'c', 'h' }, |
| 3447 | .psize = 4, |
| 3448 | .digest = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 } |
| 3449 | }, |
| 3450 | { |
| 3451 | .key = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }, |
| 3452 | .ksize = 8, |
| 3453 | .plaintext = { 'M', 'i', 'c', 'h', 'a', 'e', 'l' }, |
| 3454 | .psize = 7, |
| 3455 | .digest = { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 }, |
| 3456 | } |
| 3457 | }; |
| 3458 | |
Harald Welte | ebfd9bc | 2005-06-22 13:27:23 -0700 | [diff] [blame] | 3459 | /* |
Herbert Xu | c907ee7 | 2006-08-21 22:04:03 +1000 | [diff] [blame] | 3460 | * CRC32C test vectors |
| 3461 | */ |
| 3462 | #define CRC32C_TEST_VECTORS 14 |
| 3463 | |
| 3464 | static struct hash_testvec crc32c_tv_template[] = { |
| 3465 | { |
| 3466 | .psize = 0, |
| 3467 | .digest = { 0x00, 0x00, 0x00, 0x00 } |
| 3468 | }, |
| 3469 | { |
| 3470 | .key = { 0x87, 0xa9, 0xcb, 0xed }, |
| 3471 | .ksize = 4, |
| 3472 | .psize = 0, |
| 3473 | .digest = { 0x78, 0x56, 0x34, 0x12 }, |
| 3474 | }, |
| 3475 | { |
| 3476 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3477 | .ksize = 4, |
| 3478 | .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 3479 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 3480 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 3481 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, |
| 3482 | 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28 }, |
| 3483 | .psize = 40, |
| 3484 | .digest = { 0x7f, 0x15, 0x2c, 0x0e } |
| 3485 | }, |
| 3486 | { |
| 3487 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3488 | .ksize = 4, |
| 3489 | .plaintext = { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, |
| 3490 | 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, |
| 3491 | 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, |
| 3492 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
| 3493 | 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 }, |
| 3494 | .psize = 40, |
| 3495 | .digest = { 0xf6, 0xeb, 0x80, 0xe9 } |
| 3496 | }, |
| 3497 | { |
| 3498 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3499 | .ksize = 4, |
| 3500 | .plaintext = { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
| 3501 | 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, |
| 3502 | 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, |
| 3503 | 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, |
| 3504 | 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 }, |
| 3505 | .psize = 40, |
| 3506 | .digest = { 0xed, 0xbd, 0x74, 0xde } |
| 3507 | }, |
| 3508 | { |
| 3509 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3510 | .ksize = 4, |
| 3511 | .plaintext = { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, |
| 3512 | 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, |
| 3513 | 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, |
| 3514 | 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, |
| 3515 | 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 }, |
| 3516 | .psize = 40, |
| 3517 | .digest = { 0x62, 0xc8, 0x79, 0xd5 } |
| 3518 | }, |
| 3519 | { |
| 3520 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3521 | .ksize = 4, |
| 3522 | .plaintext = { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, |
| 3523 | 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, |
| 3524 | 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, |
| 3525 | 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, |
| 3526 | 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 }, |
| 3527 | .psize = 40, |
| 3528 | .digest = { 0xd0, 0x9a, 0x97, 0xba } |
| 3529 | }, |
| 3530 | { |
| 3531 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3532 | .ksize = 4, |
| 3533 | .plaintext = { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, |
| 3534 | 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, |
| 3535 | 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, |
| 3536 | 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, |
| 3537 | 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 }, |
| 3538 | .psize = 40, |
| 3539 | .digest = { 0x13, 0xd9, 0x29, 0x2b } |
| 3540 | }, |
| 3541 | { |
| 3542 | .key = { 0x80, 0xea, 0xd3, 0xf1 }, |
| 3543 | .ksize = 4, |
| 3544 | .plaintext = { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, |
| 3545 | 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, |
| 3546 | 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, |
| 3547 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
| 3548 | 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 }, |
| 3549 | .psize = 40, |
| 3550 | .digest = { 0x0c, 0xb5, 0xe2, 0xa2 } |
| 3551 | }, |
| 3552 | { |
| 3553 | .key = { 0xf3, 0x4a, 0x1d, 0x5d }, |
| 3554 | .ksize = 4, |
| 3555 | .plaintext = { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
| 3556 | 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, |
| 3557 | 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, |
| 3558 | 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, |
| 3559 | 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 }, |
| 3560 | .psize = 40, |
| 3561 | .digest = { 0xd1, 0x7f, 0xfb, 0xa6 } |
| 3562 | }, |
| 3563 | { |
| 3564 | .key = { 0x2e, 0x80, 0x04, 0x59 }, |
| 3565 | .ksize = 4, |
| 3566 | .plaintext = { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, |
| 3567 | 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, |
| 3568 | 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, |
| 3569 | 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, |
| 3570 | 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 }, |
| 3571 | .psize = 40, |
| 3572 | .digest = { 0x59, 0x33, 0xe6, 0x7a } |
| 3573 | }, |
| 3574 | { |
| 3575 | .key = { 0xa6, 0xcc, 0x19, 0x85 }, |
| 3576 | .ksize = 4, |
| 3577 | .plaintext = { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, |
| 3578 | 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, |
| 3579 | 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, |
| 3580 | 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, |
| 3581 | 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 }, |
| 3582 | .psize = 40, |
| 3583 | .digest = { 0xbe, 0x03, 0x01, 0xd2 } |
| 3584 | }, |
| 3585 | { |
| 3586 | .key = { 0x41, 0xfc, 0xfe, 0x2d }, |
| 3587 | .ksize = 4, |
| 3588 | .plaintext = { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, |
| 3589 | 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, |
| 3590 | 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, |
| 3591 | 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, |
| 3592 | 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 }, |
| 3593 | .psize = 40, |
| 3594 | .digest = { 0x75, 0xd3, 0xc5, 0x24 } |
| 3595 | }, |
| 3596 | { |
| 3597 | .key = { 0xff, 0xff, 0xff, 0xff }, |
| 3598 | .ksize = 4, |
| 3599 | .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
| 3600 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, |
| 3601 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, |
| 3602 | 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, |
| 3603 | 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, |
| 3604 | 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, |
| 3605 | 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, |
| 3606 | 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, |
| 3607 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
| 3608 | 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, |
| 3609 | 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
| 3610 | 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, |
| 3611 | 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, |
| 3612 | 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, |
| 3613 | 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, |
| 3614 | 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, |
| 3615 | 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, |
| 3616 | 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, |
| 3617 | 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, |
| 3618 | 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, |
| 3619 | 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, |
| 3620 | 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, |
| 3621 | 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, |
| 3622 | 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, |
| 3623 | 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, |
| 3624 | 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, |
| 3625 | 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, |
| 3626 | 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, |
| 3627 | 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, |
| 3628 | 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 }, |
| 3629 | .psize = 240, |
| 3630 | .digest = { 0x75, 0xd3, 0xc5, 0x24 }, |
| 3631 | .np = 2, |
| 3632 | .tap = { 31, 209 } |
| 3633 | }, |
| 3634 | }; |
| 3635 | |
| 3636 | /* |
Harald Welte | ebfd9bc | 2005-06-22 13:27:23 -0700 | [diff] [blame] | 3637 | * Cipher speed tests |
| 3638 | */ |
| 3639 | static struct cipher_speed aes_speed_template[] = { |
| 3640 | { .klen = 16, .blen = 16, }, |
| 3641 | { .klen = 16, .blen = 64, }, |
| 3642 | { .klen = 16, .blen = 256, }, |
| 3643 | { .klen = 16, .blen = 1024, }, |
| 3644 | { .klen = 16, .blen = 8192, }, |
| 3645 | { .klen = 24, .blen = 16, }, |
| 3646 | { .klen = 24, .blen = 64, }, |
| 3647 | { .klen = 24, .blen = 256, }, |
| 3648 | { .klen = 24, .blen = 1024, }, |
| 3649 | { .klen = 24, .blen = 8192, }, |
| 3650 | { .klen = 32, .blen = 16, }, |
| 3651 | { .klen = 32, .blen = 64, }, |
| 3652 | { .klen = 32, .blen = 256, }, |
| 3653 | { .klen = 32, .blen = 1024, }, |
| 3654 | { .klen = 32, .blen = 8192, }, |
| 3655 | |
| 3656 | /* End marker */ |
| 3657 | { .klen = 0, .blen = 0, } |
| 3658 | }; |
| 3659 | |
Rik Snel | f3d1044 | 2006-11-29 19:01:41 +1100 | [diff] [blame] | 3660 | static struct cipher_speed aes_lrw_speed_template[] = { |
| 3661 | { .klen = 32, .blen = 16, }, |
| 3662 | { .klen = 32, .blen = 64, }, |
| 3663 | { .klen = 32, .blen = 256, }, |
| 3664 | { .klen = 32, .blen = 1024, }, |
| 3665 | { .klen = 32, .blen = 8192, }, |
| 3666 | { .klen = 40, .blen = 16, }, |
| 3667 | { .klen = 40, .blen = 64, }, |
| 3668 | { .klen = 40, .blen = 256, }, |
| 3669 | { .klen = 40, .blen = 1024, }, |
| 3670 | { .klen = 40, .blen = 8192, }, |
| 3671 | { .klen = 48, .blen = 16, }, |
| 3672 | { .klen = 48, .blen = 64, }, |
| 3673 | { .klen = 48, .blen = 256, }, |
| 3674 | { .klen = 48, .blen = 1024, }, |
| 3675 | { .klen = 48, .blen = 8192, }, |
| 3676 | |
| 3677 | /* End marker */ |
| 3678 | { .klen = 0, .blen = 0, } |
| 3679 | }; |
| 3680 | |
Harald Welte | ebfd9bc | 2005-06-22 13:27:23 -0700 | [diff] [blame] | 3681 | static struct cipher_speed des3_ede_speed_template[] = { |
| 3682 | { .klen = 24, .blen = 16, }, |
| 3683 | { .klen = 24, .blen = 64, }, |
| 3684 | { .klen = 24, .blen = 256, }, |
| 3685 | { .klen = 24, .blen = 1024, }, |
| 3686 | { .klen = 24, .blen = 8192, }, |
| 3687 | |
| 3688 | /* End marker */ |
| 3689 | { .klen = 0, .blen = 0, } |
| 3690 | }; |
| 3691 | |
| 3692 | static struct cipher_speed twofish_speed_template[] = { |
| 3693 | { .klen = 16, .blen = 16, }, |
| 3694 | { .klen = 16, .blen = 64, }, |
| 3695 | { .klen = 16, .blen = 256, }, |
| 3696 | { .klen = 16, .blen = 1024, }, |
| 3697 | { .klen = 16, .blen = 8192, }, |
| 3698 | { .klen = 24, .blen = 16, }, |
| 3699 | { .klen = 24, .blen = 64, }, |
| 3700 | { .klen = 24, .blen = 256, }, |
| 3701 | { .klen = 24, .blen = 1024, }, |
| 3702 | { .klen = 24, .blen = 8192, }, |
| 3703 | { .klen = 32, .blen = 16, }, |
| 3704 | { .klen = 32, .blen = 64, }, |
| 3705 | { .klen = 32, .blen = 256, }, |
| 3706 | { .klen = 32, .blen = 1024, }, |
| 3707 | { .klen = 32, .blen = 8192, }, |
| 3708 | |
| 3709 | /* End marker */ |
| 3710 | { .klen = 0, .blen = 0, } |
| 3711 | }; |
| 3712 | |
| 3713 | static struct cipher_speed blowfish_speed_template[] = { |
| 3714 | /* Don't support blowfish keys > 256 bit in this test */ |
| 3715 | { .klen = 8, .blen = 16, }, |
| 3716 | { .klen = 8, .blen = 64, }, |
| 3717 | { .klen = 8, .blen = 256, }, |
| 3718 | { .klen = 8, .blen = 1024, }, |
| 3719 | { .klen = 8, .blen = 8192, }, |
| 3720 | { .klen = 32, .blen = 16, }, |
| 3721 | { .klen = 32, .blen = 64, }, |
| 3722 | { .klen = 32, .blen = 256, }, |
| 3723 | { .klen = 32, .blen = 1024, }, |
| 3724 | { .klen = 32, .blen = 8192, }, |
| 3725 | |
| 3726 | /* End marker */ |
| 3727 | { .klen = 0, .blen = 0, } |
| 3728 | }; |
| 3729 | |
| 3730 | static struct cipher_speed des_speed_template[] = { |
| 3731 | { .klen = 8, .blen = 16, }, |
| 3732 | { .klen = 8, .blen = 64, }, |
| 3733 | { .klen = 8, .blen = 256, }, |
| 3734 | { .klen = 8, .blen = 1024, }, |
| 3735 | { .klen = 8, .blen = 8192, }, |
| 3736 | |
| 3737 | /* End marker */ |
| 3738 | { .klen = 0, .blen = 0, } |
| 3739 | }; |
| 3740 | |
Michal Ludvig | e805792 | 2006-05-30 22:04:19 +1000 | [diff] [blame] | 3741 | /* |
| 3742 | * Digest speed tests |
| 3743 | */ |
Herbert Xu | e9d4116 | 2006-08-19 21:38:49 +1000 | [diff] [blame] | 3744 | static struct hash_speed generic_hash_speed_template[] = { |
Michal Ludvig | e805792 | 2006-05-30 22:04:19 +1000 | [diff] [blame] | 3745 | { .blen = 16, .plen = 16, }, |
| 3746 | { .blen = 64, .plen = 16, }, |
| 3747 | { .blen = 64, .plen = 64, }, |
| 3748 | { .blen = 256, .plen = 16, }, |
| 3749 | { .blen = 256, .plen = 64, }, |
| 3750 | { .blen = 256, .plen = 256, }, |
| 3751 | { .blen = 1024, .plen = 16, }, |
| 3752 | { .blen = 1024, .plen = 256, }, |
| 3753 | { .blen = 1024, .plen = 1024, }, |
| 3754 | { .blen = 2048, .plen = 16, }, |
| 3755 | { .blen = 2048, .plen = 256, }, |
| 3756 | { .blen = 2048, .plen = 1024, }, |
| 3757 | { .blen = 2048, .plen = 2048, }, |
| 3758 | { .blen = 4096, .plen = 16, }, |
| 3759 | { .blen = 4096, .plen = 256, }, |
| 3760 | { .blen = 4096, .plen = 1024, }, |
| 3761 | { .blen = 4096, .plen = 4096, }, |
| 3762 | { .blen = 8192, .plen = 16, }, |
| 3763 | { .blen = 8192, .plen = 256, }, |
| 3764 | { .blen = 8192, .plen = 1024, }, |
| 3765 | { .blen = 8192, .plen = 4096, }, |
| 3766 | { .blen = 8192, .plen = 8192, }, |
| 3767 | |
| 3768 | /* End marker */ |
| 3769 | { .blen = 0, .plen = 0, } |
| 3770 | }; |
| 3771 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3772 | #endif /* _CRYPTO_TCRYPT_H */ |