1 /* SPDX-License-Identifier: GPL-2.0-or-later * << 2 /* 1 /* 3 * Quick & dirty crypto testing module. 2 * Quick & dirty crypto testing module. 4 * 3 * 5 * This will only exist until we have a better 4 * This will only exist until we have a better testing mechanism 6 * (e.g. a char device). 5 * (e.g. a char device). 7 * 6 * 8 * Copyright (c) 2002 James Morris <jmorris@in 7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 9 * Copyright (c) 2002 Jean-Francois Dive <jef@ 8 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org> 10 * Copyright (c) 2007 Nokia Siemens Networks !! 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 >> 12 * Software Foundation; either version 2 of the License, or (at your option) >> 13 * any later version. >> 14 * >> 15 * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt >> 16 * 11 */ 17 */ 12 #ifndef _CRYPTO_TCRYPT_H 18 #ifndef _CRYPTO_TCRYPT_H 13 #define _CRYPTO_TCRYPT_H 19 #define _CRYPTO_TCRYPT_H 14 20 15 struct cipher_speed_template { !! 21 #define MAX_DIGEST_SIZE 64 16 const char *key; !! 22 #define MAX_TAP 8 17 unsigned int klen; !! 23 >> 24 #define MAX_KEYLEN 56 >> 25 #define MAX_IVLEN 32 >> 26 >> 27 struct hash_testvec { >> 28 char plaintext[128]; >> 29 unsigned char psize; >> 30 char digest[MAX_DIGEST_SIZE]; >> 31 unsigned char np; >> 32 unsigned char tap[MAX_TAP]; >> 33 char key[128]; /* only used with keyed hash algorithms */ >> 34 unsigned char ksize; >> 35 }; >> 36 >> 37 struct hmac_testvec { >> 38 char key[128]; >> 39 unsigned char ksize; >> 40 char plaintext[128]; >> 41 unsigned char psize; >> 42 char digest[MAX_DIGEST_SIZE]; >> 43 unsigned char np; >> 44 unsigned char tap[MAX_TAP]; >> 45 }; >> 46 >> 47 struct cipher_testvec { >> 48 unsigned char fail; >> 49 unsigned char wk; /* weak key flag */ >> 50 char key[MAX_KEYLEN]; >> 51 unsigned char klen; >> 52 char iv[MAX_IVLEN]; >> 53 char input[48]; >> 54 unsigned char ilen; >> 55 char result[48]; >> 56 unsigned char rlen; >> 57 int np; >> 58 unsigned char tap[MAX_TAP]; >> 59 }; >> 60 >> 61 /* >> 62 * MD4 test vectors from RFC1320 >> 63 */ >> 64 #define MD4_TEST_VECTORS 7 >> 65 >> 66 struct hash_testvec md4_tv_template [] = { >> 67 { >> 68 .plaintext = "", >> 69 .digest = { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, >> 70 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 }, >> 71 }, { >> 72 .plaintext = "a", >> 73 .psize = 1, >> 74 .digest = { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, >> 75 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 }, >> 76 }, { >> 77 .plaintext = "abc", >> 78 .psize = 3, >> 79 .digest = { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, >> 80 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d }, >> 81 }, { >> 82 .plaintext = "message digest", >> 83 .psize = 14, >> 84 .digest = { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8, >> 85 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b }, >> 86 }, { >> 87 .plaintext = "abcdefghijklmnopqrstuvwxyz", >> 88 .psize = 26, >> 89 .digest = { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, >> 90 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 }, >> 91 .np = 2, >> 92 .tap = { 13, 13 }, >> 93 }, { >> 94 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", >> 95 .psize = 62, >> 96 .digest = { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35, >> 97 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 }, >> 98 }, { >> 99 .plaintext = "123456789012345678901234567890123456789012345678901234567890123" >> 100 "45678901234567890", >> 101 .psize = 80, >> 102 .digest = { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19, >> 103 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 }, >> 104 }, >> 105 }; >> 106 >> 107 /* >> 108 * MD5 test vectors from RFC1321 >> 109 */ >> 110 #define MD5_TEST_VECTORS 7 >> 111 >> 112 struct hash_testvec md5_tv_template[] = { >> 113 { >> 114 .digest = { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, >> 115 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e }, >> 116 }, { >> 117 .plaintext = "a", >> 118 .psize = 1, >> 119 .digest = { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, >> 120 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 }, >> 121 }, { >> 122 .plaintext = "abc", >> 123 .psize = 3, >> 124 .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, >> 125 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 }, >> 126 }, { >> 127 .plaintext = "message digest", >> 128 .psize = 14, >> 129 .digest = { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, >> 130 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 }, >> 131 }, { >> 132 .plaintext = "abcdefghijklmnopqrstuvwxyz", >> 133 .psize = 26, >> 134 .digest = { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, >> 135 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b }, >> 136 .np = 2, >> 137 .tap = {13, 13} >> 138 }, { >> 139 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", >> 140 .psize = 62, >> 141 .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, >> 142 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f }, >> 143 }, { >> 144 .plaintext = "12345678901234567890123456789012345678901234567890123456789012" >> 145 "345678901234567890", >> 146 .psize = 80, >> 147 .digest = { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, >> 148 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a }, >> 149 } >> 150 }; >> 151 >> 152 /* >> 153 * SHA1 test vectors from from FIPS PUB 180-1 >> 154 */ >> 155 #define SHA1_TEST_VECTORS 2 >> 156 >> 157 struct hash_testvec sha1_tv_template[] = { >> 158 { >> 159 .plaintext = "abc", >> 160 .psize = 3, >> 161 .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, >> 162 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d }, >> 163 }, { >> 164 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 165 .psize = 56, >> 166 .digest = { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae, >> 167 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 }, >> 168 .np = 2, >> 169 .tap = { 28, 28 } >> 170 } >> 171 }; >> 172 >> 173 /* >> 174 * SHA256 test vectors from from NIST >> 175 */ >> 176 #define SHA256_TEST_VECTORS 2 >> 177 >> 178 struct hash_testvec sha256_tv_template[] = { >> 179 { >> 180 .plaintext = "abc", >> 181 .psize = 3, >> 182 .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, >> 183 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, >> 184 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, >> 185 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }, >> 186 }, { >> 187 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 188 .psize = 56, >> 189 .digest = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, >> 190 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, >> 191 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, >> 192 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 }, >> 193 .np = 2, >> 194 .tap = { 28, 28 } >> 195 }, >> 196 }; >> 197 >> 198 /* >> 199 * SHA384 test vectors from from NIST and kerneli >> 200 */ >> 201 #define SHA384_TEST_VECTORS 4 >> 202 >> 203 struct hash_testvec sha384_tv_template[] = { >> 204 { >> 205 .plaintext= "abc", >> 206 .psize = 3, >> 207 .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, >> 208 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07, >> 209 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, >> 210 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed, >> 211 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, >> 212 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 }, >> 213 }, { >> 214 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 215 .psize = 56, >> 216 .digest = { 0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39, >> 217 0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39, >> 218 0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab, >> 219 0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6, >> 220 0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f, >> 221 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b}, >> 222 }, { >> 223 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" >> 224 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", >> 225 .psize = 112, >> 226 .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, >> 227 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, >> 228 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2, >> 229 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12, >> 230 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9, >> 231 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 }, >> 232 }, { >> 233 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd" >> 234 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", >> 235 .psize = 104, >> 236 .digest = { 0x3d, 0x20, 0x89, 0x73, 0xab, 0x35, 0x08, 0xdb, >> 237 0xbd, 0x7e, 0x2c, 0x28, 0x62, 0xba, 0x29, 0x0a, >> 238 0xd3, 0x01, 0x0e, 0x49, 0x78, 0xc1, 0x98, 0xdc, >> 239 0x4d, 0x8f, 0xd0, 0x14, 0xe5, 0x82, 0x82, 0x3a, >> 240 0x89, 0xe1, 0x6f, 0x9b, 0x2a, 0x7b, 0xbc, 0x1a, >> 241 0xc9, 0x38, 0xe2, 0xd1, 0x99, 0xe8, 0xbe, 0xa4 }, >> 242 .np = 4, >> 243 .tap = { 26, 26, 26, 26 } >> 244 }, 18 }; 245 }; 19 246 20 struct aead_speed_template { !! 247 /* 21 const char *key; !! 248 * SHA512 test vectors from from NIST and kerneli 22 unsigned int klen; !! 249 */ >> 250 #define SHA512_TEST_VECTORS 4 >> 251 >> 252 struct hash_testvec sha512_tv_template[] = { >> 253 { >> 254 .plaintext = "abc", >> 255 .psize = 3, >> 256 .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, >> 257 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, >> 258 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, >> 259 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, >> 260 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, >> 261 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, >> 262 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, >> 263 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f }, >> 264 }, { >> 265 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 266 .psize = 56, >> 267 .digest = { 0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a, >> 268 0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16, >> 269 0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8, >> 270 0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35, >> 271 0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9, >> 272 0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0, >> 273 0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03, >> 274 0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45 }, >> 275 }, { >> 276 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" >> 277 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", >> 278 .psize = 112, >> 279 .digest = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, >> 280 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, >> 281 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, >> 282 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18, >> 283 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4, >> 284 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a, >> 285 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, >> 286 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 }, >> 287 }, { >> 288 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd" >> 289 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", >> 290 .psize = 104, >> 291 .digest = { 0x93, 0x0d, 0x0c, 0xef, 0xcb, 0x30, 0xff, 0x11, >> 292 0x33, 0xb6, 0x89, 0x81, 0x21, 0xf1, 0xcf, 0x3d, >> 293 0x27, 0x57, 0x8a, 0xfc, 0xaf, 0xe8, 0x67, 0x7c, >> 294 0x52, 0x57, 0xcf, 0x06, 0x99, 0x11, 0xf7, 0x5d, >> 295 0x8f, 0x58, 0x31, 0xb5, 0x6e, 0xbf, 0xda, 0x67, >> 296 0xb2, 0x78, 0xe6, 0x6d, 0xff, 0x8b, 0x84, 0xfe, >> 297 0x2b, 0x28, 0x70, 0xf7, 0x42, 0xa5, 0x80, 0xd8, >> 298 0xed, 0xb4, 0x19, 0x87, 0x23, 0x28, 0x50, 0xc9 }, >> 299 .np = 4, >> 300 .tap = { 26, 26, 26, 26 } >> 301 }, 23 }; 302 }; 24 303 25 struct hash_speed { !! 304 #ifdef CONFIG_CRYPTO_HMAC 26 unsigned int blen; /* buffer leng !! 305 /* 27 unsigned int plen; /* per-update !! 306 * HMAC-MD5 test vectors from RFC2202 >> 307 * (These need to be fixed to not use strlen). >> 308 */ >> 309 #define HMAC_MD5_TEST_VECTORS 7 >> 310 >> 311 struct hmac_testvec hmac_md5_tv_template[] = >> 312 { >> 313 { >> 314 .key = { [0 ... 15] = 0x0b }, >> 315 .ksize = 16, >> 316 .plaintext = "Hi There", >> 317 .psize = 8, >> 318 .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, >> 319 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d }, >> 320 }, { >> 321 .key = { 'J', 'e', 'f', 'e' }, >> 322 .ksize = 4, >> 323 .plaintext = "what do ya want for nothing?", >> 324 .psize = 28, >> 325 .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03, >> 326 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 }, >> 327 .np = 2, >> 328 .tap = {14, 14} >> 329 }, { >> 330 .key = { [0 ... 15] = 0xaa }, >> 331 .ksize = 16, >> 332 .plaintext = { [0 ... 49] = 0xdd }, >> 333 .psize = 50, >> 334 .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88, >> 335 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 }, >> 336 }, { >> 337 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 338 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 339 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, }, >> 340 .ksize = 25, >> 341 .plaintext = { [0 ... 49] = 0xcd }, >> 342 .psize = 50, >> 343 .digest = { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea, >> 344 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 }, >> 345 }, { >> 346 .key = { [0 ... 15] = 0x0c }, >> 347 .ksize = 16, >> 348 .plaintext = "Test With Truncation", >> 349 .psize = 20, >> 350 .digest = { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00, >> 351 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c }, >> 352 }, { >> 353 .key = { [0 ... 79] = 0xaa }, >> 354 .ksize = 80, >> 355 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", >> 356 .psize = 54, >> 357 .digest = { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f, >> 358 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd }, >> 359 }, { >> 360 .key = { [0 ... 79] = 0xaa }, >> 361 .ksize = 80, >> 362 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One " >> 363 "Block-Size Data", >> 364 .psize = 73, >> 365 .digest = { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee, >> 366 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e }, >> 367 }, >> 368 }; >> 369 >> 370 /* >> 371 * HMAC-SHA1 test vectors from RFC2202 >> 372 */ >> 373 #define HMAC_SHA1_TEST_VECTORS 7 >> 374 >> 375 struct hmac_testvec hmac_sha1_tv_template[] = { >> 376 { >> 377 .key = { [0 ... 19] = 0x0b }, >> 378 .ksize = 20, >> 379 .plaintext = "Hi There", >> 380 .psize = 8, >> 381 .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, >> 382 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1, >> 383 0x46, 0xbe }, >> 384 }, { >> 385 .key = { 'J', 'e', 'f', 'e' }, >> 386 .ksize = 4, >> 387 .plaintext = "what do ya want for nothing?", >> 388 .psize = 28, >> 389 .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74, >> 390 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 }, >> 391 .np = 2, >> 392 .tap = { 14, 14 } >> 393 }, { >> 394 .key = { [0 ... 19] = 0xaa }, >> 395 .ksize = 20, >> 396 .plaintext = { [0 ... 49] = 0xdd }, >> 397 .psize = 50, >> 398 .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, >> 399 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 }, >> 400 }, { >> 401 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 402 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 403 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 }, >> 404 .ksize = 25, >> 405 .plaintext = { [0 ... 49] = 0xcd }, >> 406 .psize = 50, >> 407 .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84, >> 408 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda }, >> 409 }, { >> 410 .key = { [0 ... 19] = 0x0c }, >> 411 .ksize = 20, >> 412 .plaintext = "Test With Truncation", >> 413 .psize = 20, >> 414 .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2, >> 415 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 }, >> 416 }, { >> 417 .key = { [0 ... 79] = 0xaa }, >> 418 .ksize = 80, >> 419 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", >> 420 .psize = 54, >> 421 .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70, >> 422 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 }, >> 423 }, { >> 424 .key = { [0 ... 79] = 0xaa }, >> 425 .ksize = 80, >> 426 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One " >> 427 "Block-Size Data", >> 428 .psize = 73, >> 429 .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b, >> 430 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 }, >> 431 }, >> 432 }; >> 433 >> 434 /* >> 435 * HMAC-SHA256 test vectors from >> 436 * draft-ietf-ipsec-ciph-sha-256-01.txt >> 437 */ >> 438 #define HMAC_SHA256_TEST_VECTORS 10 >> 439 >> 440 struct hmac_testvec hmac_sha256_tv_template[] = { >> 441 { >> 442 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 443 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 444 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, >> 445 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20}, >> 446 .ksize = 32, >> 447 .plaintext = "abc", >> 448 .psize = 3, >> 449 .digest = { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a, >> 450 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a, >> 451 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66, >> 452 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 }, >> 453 }, { >> 454 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 455 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 456 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, >> 457 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 }, >> 458 .ksize = 32, >> 459 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 460 .psize = 56, >> 461 .digest = { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08, >> 462 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae, >> 463 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49, >> 464 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 }, >> 465 }, { >> 466 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 467 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 468 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, >> 469 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 }, >> 470 .ksize = 32, >> 471 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" >> 472 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", >> 473 .psize = 112, >> 474 .digest = { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34, >> 475 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab, >> 476 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5, >> 477 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 }, >> 478 }, { >> 479 .key = { [0 ... 31] = 0x0b }, >> 480 .ksize = 32, >> 481 .plaintext = "Hi There", >> 482 .psize = 8, >> 483 .digest = { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6, >> 484 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5, >> 485 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c, >> 486 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 }, >> 487 }, { >> 488 .key = "Jefe", >> 489 .ksize = 4, >> 490 .plaintext = "what do ya want for nothing?", >> 491 .psize = 28, >> 492 .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, >> 493 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, >> 494 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, >> 495 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 }, >> 496 .np = 2, >> 497 .tap = { 14, 14 } >> 498 }, { >> 499 .key = { [0 ... 31] = 0xaa }, >> 500 .ksize = 32, >> 501 .plaintext = { [0 ... 49] = 0xdd }, >> 502 .psize = 50, >> 503 .digest = { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea, >> 504 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62, >> 505 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc, >> 506 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 }, >> 507 }, { >> 508 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, >> 509 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, >> 510 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, >> 511 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, >> 512 0x21, 0x22, 0x23, 0x24, 0x25 }, >> 513 .ksize = 37, >> 514 .plaintext = { [0 ... 49] = 0xcd }, >> 515 .psize = 50, >> 516 .digest = { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74, >> 517 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55, >> 518 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85, >> 519 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 }, >> 520 }, { >> 521 .key = { [0 ... 31] = 0x0c }, >> 522 .ksize = 32, >> 523 .plaintext = "Test With Truncation", >> 524 .psize = 20, >> 525 .digest = { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b, >> 526 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17, >> 527 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27, >> 528 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 }, >> 529 }, { >> 530 .key = { [0 ... 79] = 0xaa }, >> 531 .ksize = 80, >> 532 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", >> 533 .psize = 54, >> 534 .digest = { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09, >> 535 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb, >> 536 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e, >> 537 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f }, >> 538 }, { >> 539 .key = { [0 ... 79] = 0xaa }, >> 540 .ksize = 80, >> 541 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than " >> 542 "One Block-Size Data", >> 543 .psize = 73, >> 544 .digest = { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3, >> 545 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8, >> 546 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc, >> 547 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 }, >> 548 }, >> 549 }; >> 550 >> 551 #endif /* CONFIG_CRYPTO_HMAC */ >> 552 >> 553 /* >> 554 * WHIRLPOOL test vectors from Whirlpool package >> 555 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE >> 556 * submission >> 557 */ >> 558 #define WP512_TEST_VECTORS 8 >> 559 >> 560 struct hash_testvec wp512_tv_template[] = { >> 561 { >> 562 .plaintext = "", >> 563 .psize = 0, >> 564 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, >> 565 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, >> 566 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, >> 567 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7, >> 568 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB, >> 569 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57, >> 570 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37, >> 571 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 }, >> 572 >> 573 >> 574 }, { >> 575 .plaintext = "a", >> 576 .psize = 1, >> 577 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, >> 578 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, >> 579 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, >> 580 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42, >> 581 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6, >> 582 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59, >> 583 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5, >> 584 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A }, >> 585 }, { >> 586 .plaintext = "abc", >> 587 .psize = 3, >> 588 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, >> 589 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, >> 590 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, >> 591 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C, >> 592 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27, >> 593 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6, >> 594 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82, >> 595 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 }, >> 596 }, { >> 597 .plaintext = "message digest", >> 598 .psize = 14, >> 599 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, >> 600 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, >> 601 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, >> 602 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, >> 603 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, >> 604 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6, >> 605 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33, >> 606 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E }, >> 607 }, { >> 608 .plaintext = "abcdefghijklmnopqrstuvwxyz", >> 609 .psize = 26, >> 610 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, >> 611 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, >> 612 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, >> 613 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B, >> 614 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A, >> 615 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6, >> 616 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D, >> 617 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B }, >> 618 }, { >> 619 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >> 620 "abcdefghijklmnopqrstuvwxyz0123456789", >> 621 .psize = 62, >> 622 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, >> 623 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, >> 624 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, >> 625 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E, >> 626 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F, >> 627 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6, >> 628 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21, >> 629 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 }, >> 630 }, { >> 631 .plaintext = "1234567890123456789012345678901234567890" >> 632 "1234567890123456789012345678901234567890", >> 633 .psize = 80, >> 634 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, >> 635 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, >> 636 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, >> 637 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29, >> 638 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5, >> 639 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A, >> 640 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B, >> 641 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B }, >> 642 }, { >> 643 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", >> 644 .psize = 32, >> 645 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, >> 646 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, >> 647 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, >> 648 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, >> 649 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B, >> 650 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56, >> 651 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6, >> 652 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD }, >> 653 }, >> 654 }; >> 655 >> 656 #define WP384_TEST_VECTORS 8 >> 657 >> 658 struct hash_testvec wp384_tv_template[] = { >> 659 { >> 660 .plaintext = "", >> 661 .psize = 0, >> 662 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, >> 663 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, >> 664 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, >> 665 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7, >> 666 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB, >> 667 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57 }, >> 668 >> 669 >> 670 }, { >> 671 .plaintext = "a", >> 672 .psize = 1, >> 673 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, >> 674 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, >> 675 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, >> 676 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42, >> 677 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6, >> 678 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59 }, >> 679 }, { >> 680 .plaintext = "abc", >> 681 .psize = 3, >> 682 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, >> 683 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, >> 684 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, >> 685 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C, >> 686 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27, >> 687 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6 }, >> 688 }, { >> 689 .plaintext = "message digest", >> 690 .psize = 14, >> 691 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, >> 692 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, >> 693 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, >> 694 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, >> 695 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, >> 696 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 }, >> 697 }, { >> 698 .plaintext = "abcdefghijklmnopqrstuvwxyz", >> 699 .psize = 26, >> 700 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, >> 701 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, >> 702 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, >> 703 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B, >> 704 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A, >> 705 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6 }, >> 706 }, { >> 707 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >> 708 "abcdefghijklmnopqrstuvwxyz0123456789", >> 709 .psize = 62, >> 710 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, >> 711 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, >> 712 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, >> 713 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E, >> 714 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F, >> 715 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6 }, >> 716 }, { >> 717 .plaintext = "1234567890123456789012345678901234567890" >> 718 "1234567890123456789012345678901234567890", >> 719 .psize = 80, >> 720 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, >> 721 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, >> 722 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, >> 723 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29, >> 724 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5, >> 725 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A }, >> 726 }, { >> 727 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", >> 728 .psize = 32, >> 729 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, >> 730 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, >> 731 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, >> 732 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, >> 733 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B, >> 734 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56 }, >> 735 }, >> 736 }; >> 737 >> 738 #define WP256_TEST_VECTORS 8 >> 739 >> 740 struct hash_testvec wp256_tv_template[] = { >> 741 { >> 742 .plaintext = "", >> 743 .psize = 0, >> 744 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, >> 745 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, >> 746 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, >> 747 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7 }, >> 748 >> 749 >> 750 }, { >> 751 .plaintext = "a", >> 752 .psize = 1, >> 753 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, >> 754 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, >> 755 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, >> 756 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42 }, >> 757 }, { >> 758 .plaintext = "abc", >> 759 .psize = 3, >> 760 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, >> 761 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, >> 762 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, >> 763 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C }, >> 764 }, { >> 765 .plaintext = "message digest", >> 766 .psize = 14, >> 767 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, >> 768 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, >> 769 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, >> 770 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B }, >> 771 }, { >> 772 .plaintext = "abcdefghijklmnopqrstuvwxyz", >> 773 .psize = 26, >> 774 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, >> 775 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, >> 776 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, >> 777 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B }, >> 778 }, { >> 779 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >> 780 "abcdefghijklmnopqrstuvwxyz0123456789", >> 781 .psize = 62, >> 782 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, >> 783 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, >> 784 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, >> 785 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E }, >> 786 }, { >> 787 .plaintext = "1234567890123456789012345678901234567890" >> 788 "1234567890123456789012345678901234567890", >> 789 .psize = 80, >> 790 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, >> 791 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, >> 792 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, >> 793 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29 }, >> 794 }, { >> 795 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", >> 796 .psize = 32, >> 797 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, >> 798 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, >> 799 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, >> 800 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 }, >> 801 }, 28 }; 802 }; 29 803 30 /* 804 /* 31 * DES test vectors. 805 * DES test vectors. 32 */ 806 */ 33 #define DES3_SPEED_VECTORS 1 !! 807 #define DES_ENC_TEST_VECTORS 10 >> 808 #define DES_DEC_TEST_VECTORS 4 >> 809 #define DES_CBC_ENC_TEST_VECTORS 5 >> 810 #define DES_CBC_DEC_TEST_VECTORS 4 >> 811 #define DES3_EDE_ENC_TEST_VECTORS 3 >> 812 #define DES3_EDE_DEC_TEST_VECTORS 3 >> 813 >> 814 struct cipher_testvec des_enc_tv_template[] = { >> 815 { /* From Applied Cryptography */ >> 816 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 817 .klen = 8, >> 818 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, >> 819 .ilen = 8, >> 820 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, >> 821 .rlen = 8, >> 822 }, { /* Same key, different plaintext block */ >> 823 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 824 .klen = 8, >> 825 .input = { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, >> 826 .ilen = 8, >> 827 .result = { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, >> 828 .rlen = 8, >> 829 }, { /* Sbox test from NBS */ >> 830 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 }, >> 831 .klen = 8, >> 832 .input = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 }, >> 833 .ilen = 8, >> 834 .result = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, >> 835 .rlen = 8, >> 836 }, { /* Three blocks */ >> 837 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 838 .klen = 8, >> 839 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 840 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, >> 841 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef }, >> 842 .ilen = 24, >> 843 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 844 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, >> 845 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 }, >> 846 .rlen = 24, >> 847 }, { /* Weak key */ >> 848 .fail = 1, >> 849 .wk = 1, >> 850 .key = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, >> 851 .klen = 8, >> 852 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, >> 853 .ilen = 8, >> 854 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, >> 855 .rlen = 8, >> 856 }, { /* Two blocks -- for testing encryption across pages */ >> 857 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 858 .klen = 8, >> 859 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 860 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, >> 861 .ilen = 16, >> 862 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 863 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, >> 864 .rlen = 16, >> 865 .np = 2, >> 866 .tap = { 8, 8 } >> 867 }, { /* Four blocks -- for testing encryption with chunking */ >> 868 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 869 .klen = 8, >> 870 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 871 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, >> 872 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef, >> 873 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, >> 874 .ilen = 32, >> 875 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 876 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, >> 877 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90, >> 878 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, >> 879 .rlen = 32, >> 880 .np = 3, >> 881 .tap = { 14, 10, 8 } >> 882 }, { >> 883 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 884 .klen = 8, >> 885 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 886 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, >> 887 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef }, >> 888 .ilen = 24, >> 889 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 890 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b, >> 891 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 }, >> 892 .rlen = 24, >> 893 .np = 4, >> 894 .tap = { 2, 1, 3, 18 } >> 895 }, { >> 896 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 897 .klen = 8, >> 898 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 899 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 }, >> 900 .ilen = 16, >> 901 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 902 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, >> 903 .rlen = 16, >> 904 .np = 5, >> 905 .tap = { 2, 2, 2, 2, 8 } >> 906 }, { >> 907 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 908 .klen = 8, >> 909 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, >> 910 .ilen = 8, >> 911 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, >> 912 .rlen = 8, >> 913 .np = 8, >> 914 .tap = { 1, 1, 1, 1, 1, 1, 1, 1 } >> 915 }, >> 916 }; >> 917 >> 918 struct cipher_testvec des_dec_tv_template[] = { >> 919 { /* From Applied Cryptography */ >> 920 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 921 .klen = 8, >> 922 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, >> 923 .ilen = 8, >> 924 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, >> 925 .rlen = 8, >> 926 }, { /* Sbox test from NBS */ >> 927 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 }, >> 928 .klen = 8, >> 929 .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, >> 930 .ilen = 8, >> 931 .result = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 }, >> 932 .rlen = 8, >> 933 }, { /* Two blocks, for chunking test */ >> 934 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 935 .klen = 8, >> 936 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 937 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, >> 938 .ilen = 16, >> 939 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 940 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 }, >> 941 .rlen = 16, >> 942 .np = 2, >> 943 .tap = { 8, 8 } >> 944 }, { >> 945 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 946 .klen = 8, >> 947 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d, >> 948 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, >> 949 .ilen = 16, >> 950 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7, >> 951 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 }, >> 952 .rlen = 16, >> 953 .np = 3, >> 954 .tap = { 3, 12, 1 } >> 955 }, >> 956 }; >> 957 >> 958 struct cipher_testvec des_cbc_enc_tv_template[] = { >> 959 { /* From OpenSSL */ >> 960 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, >> 961 .klen = 8, >> 962 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, >> 963 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, >> 964 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, >> 965 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, >> 966 .ilen = 24, >> 967 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, >> 968 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, >> 969 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, >> 970 .rlen = 24, >> 971 }, { /* FIPS Pub 81 */ >> 972 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 973 .klen = 8, >> 974 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }, >> 975 .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 }, >> 976 .ilen = 8, >> 977 .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, >> 978 .rlen = 8, >> 979 }, { >> 980 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 981 .klen = 8, >> 982 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, >> 983 .input = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, >> 984 .ilen = 8, >> 985 .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, >> 986 .rlen = 8, >> 987 }, { >> 988 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 989 .klen = 8, >> 990 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, >> 991 .input = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, >> 992 .ilen = 8, >> 993 .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, >> 994 .rlen = 8, >> 995 }, { /* Copy of openssl vector for chunk testing */ >> 996 /* From OpenSSL */ >> 997 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, >> 998 .klen = 8, >> 999 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, >> 1000 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, >> 1001 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, >> 1002 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, >> 1003 .ilen = 24, >> 1004 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, >> 1005 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, >> 1006 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, >> 1007 .rlen = 24, >> 1008 .np = 2, >> 1009 .tap = { 13, 11 } >> 1010 }, >> 1011 }; >> 1012 >> 1013 struct cipher_testvec des_cbc_dec_tv_template[] = { >> 1014 { /* FIPS Pub 81 */ >> 1015 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1016 .klen = 8, >> 1017 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }, >> 1018 .input = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, >> 1019 .ilen = 8, >> 1020 .result = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 }, >> 1021 .rlen = 8, >> 1022 }, { >> 1023 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1024 .klen = 8, >> 1025 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, >> 1026 .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, >> 1027 .ilen = 8, >> 1028 .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, >> 1029 .rlen = 8, >> 1030 }, { >> 1031 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1032 .klen = 8, >> 1033 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, >> 1034 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, >> 1035 .ilen = 8, >> 1036 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, >> 1037 .rlen = 8, >> 1038 }, { /* Copy of above, for chunk testing */ >> 1039 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1040 .klen = 8, >> 1041 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, >> 1042 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, >> 1043 .ilen = 8, >> 1044 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, >> 1045 .rlen = 8, >> 1046 .np = 2, >> 1047 .tap = { 4, 4 } >> 1048 }, >> 1049 }; >> 1050 >> 1051 /* >> 1052 * We really need some more test vectors, especially for DES3 CBC. >> 1053 */ >> 1054 struct cipher_testvec des3_ede_enc_tv_template[] = { >> 1055 { /* These are from openssl */ >> 1056 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1057 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, >> 1058 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, >> 1059 .klen = 24, >> 1060 .input = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 }, >> 1061 .ilen = 8, >> 1062 .result = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 }, >> 1063 .rlen = 8, >> 1064 }, { >> 1065 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17, >> 1066 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98, >> 1067 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 }, >> 1068 .klen = 24, >> 1069 .input = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 }, >> 1070 .ilen = 8, >> 1071 .result = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 }, >> 1072 .rlen = 8, >> 1073 }, { >> 1074 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, >> 1075 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, >> 1076 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 }, >> 1077 .klen = 24, >> 1078 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1079 .ilen = 8, >> 1080 .result = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b }, >> 1081 .rlen = 8, >> 1082 }, >> 1083 }; >> 1084 >> 1085 struct cipher_testvec des3_ede_dec_tv_template[] = { >> 1086 { /* These are from openssl */ >> 1087 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1088 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, >> 1089 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, >> 1090 .klen = 24, >> 1091 .input = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 }, >> 1092 .ilen = 8, >> 1093 .result = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 }, >> 1094 .rlen = 8, >> 1095 }, { >> 1096 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17, >> 1097 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98, >> 1098 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 }, >> 1099 .klen = 24, >> 1100 .input = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 }, >> 1101 .ilen = 8, >> 1102 .result = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 }, >> 1103 .rlen = 8, >> 1104 }, { >> 1105 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, >> 1106 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, >> 1107 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 }, >> 1108 .klen = 24, >> 1109 .input = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b }, >> 1110 .ilen = 8, >> 1111 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1112 .rlen = 8, >> 1113 }, >> 1114 }; >> 1115 >> 1116 /* >> 1117 * Blowfish test vectors. >> 1118 */ >> 1119 #define BF_ENC_TEST_VECTORS 6 >> 1120 #define BF_DEC_TEST_VECTORS 6 >> 1121 #define BF_CBC_ENC_TEST_VECTORS 1 >> 1122 #define BF_CBC_DEC_TEST_VECTORS 1 >> 1123 >> 1124 struct cipher_testvec bf_enc_tv_template[] = { >> 1125 { /* DES test vectors from OpenSSL */ >> 1126 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, >> 1127 .klen = 8, >> 1128 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1129 .ilen = 8, >> 1130 .result = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 }, >> 1131 .rlen = 8, >> 1132 }, { >> 1133 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e }, >> 1134 .klen = 8, >> 1135 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1136 .ilen = 8, >> 1137 .result = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae }, >> 1138 .rlen = 8, >> 1139 }, { >> 1140 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, >> 1141 .klen = 8, >> 1142 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1143 .ilen = 8, >> 1144 .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 }, >> 1145 .rlen = 8, >> 1146 }, { /* Vary the keylength... */ >> 1147 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1148 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, >> 1149 .klen = 16, >> 1150 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1151 .ilen = 8, >> 1152 .result = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c }, >> 1153 .rlen = 8, >> 1154 }, { >> 1155 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1156 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, >> 1157 0x00, 0x11, 0x22, 0x33, 0x44 }, >> 1158 .klen = 21, >> 1159 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1160 .ilen = 8, >> 1161 .result = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f }, >> 1162 .rlen = 8, >> 1163 }, { /* Generated with bf488 */ >> 1164 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1165 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, >> 1166 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1167 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, >> 1168 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, >> 1169 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, >> 1170 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, >> 1171 .klen = 56, >> 1172 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1173 .ilen = 8, >> 1174 .result = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 }, >> 1175 .rlen = 8, >> 1176 }, >> 1177 }; >> 1178 >> 1179 struct cipher_testvec bf_dec_tv_template[] = { >> 1180 { /* DES test vectors from OpenSSL */ >> 1181 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1182 .klen = 8, >> 1183 .input = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 }, >> 1184 .ilen = 8, >> 1185 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1186 .rlen = 8, >> 1187 }, { >> 1188 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e }, >> 1189 .klen = 8, >> 1190 .input = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae }, >> 1191 .ilen = 8, >> 1192 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1193 .rlen = 8, >> 1194 }, { >> 1195 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, >> 1196 .klen = 8, >> 1197 .input = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 }, >> 1198 .ilen = 8, >> 1199 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1200 .rlen = 8, >> 1201 }, { /* Vary the keylength... */ >> 1202 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1203 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, >> 1204 .klen = 16, >> 1205 .input = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c }, >> 1206 .ilen = 8, >> 1207 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1208 .rlen = 8, >> 1209 }, { >> 1210 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1211 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, >> 1212 0x00, 0x11, 0x22, 0x33, 0x44 }, >> 1213 .klen = 21, >> 1214 .input = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f }, >> 1215 .ilen = 8, >> 1216 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1217 .rlen = 8, >> 1218 }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */ >> 1219 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, >> 1220 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, >> 1221 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1222 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, >> 1223 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, >> 1224 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, >> 1225 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, >> 1226 .klen = 56, >> 1227 .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 }, >> 1228 .ilen = 8, >> 1229 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1230 .rlen = 8, >> 1231 }, >> 1232 }; >> 1233 >> 1234 struct cipher_testvec bf_cbc_enc_tv_template[] = { >> 1235 { /* From OpenSSL */ >> 1236 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1237 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, >> 1238 .klen = 16, >> 1239 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1240 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, >> 1241 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, >> 1242 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, >> 1243 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 }, >> 1244 .ilen = 32, >> 1245 .result = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6, >> 1246 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93, >> 1247 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9, >> 1248 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc }, >> 1249 .rlen = 32, >> 1250 }, >> 1251 }; >> 1252 >> 1253 struct cipher_testvec bf_cbc_dec_tv_template[] = { >> 1254 { /* From OpenSSL */ >> 1255 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1256 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, >> 1257 .klen = 16, >> 1258 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, >> 1259 .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6, >> 1260 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93, >> 1261 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9, >> 1262 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc }, >> 1263 .ilen = 32, >> 1264 .result = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, >> 1265 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, >> 1266 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, >> 1267 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 }, >> 1268 .rlen = 32, >> 1269 }, >> 1270 }; >> 1271 >> 1272 /* >> 1273 * Twofish test vectors. >> 1274 */ >> 1275 #define TF_ENC_TEST_VECTORS 3 >> 1276 #define TF_DEC_TEST_VECTORS 3 >> 1277 #define TF_CBC_ENC_TEST_VECTORS 4 >> 1278 #define TF_CBC_DEC_TEST_VECTORS 4 >> 1279 >> 1280 struct cipher_testvec tf_enc_tv_template[] = { >> 1281 { >> 1282 .key = { [0 ... 15] = 0x00 }, >> 1283 .klen = 16, >> 1284 .input = { [0 ... 15] = 0x00 }, >> 1285 .ilen = 16, >> 1286 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1287 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1288 .rlen = 16, >> 1289 }, { >> 1290 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1291 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, >> 1292 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, >> 1293 .klen = 24, >> 1294 .input = { [0 ... 15] = 0x00 }, >> 1295 .ilen = 16, >> 1296 .result = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf, >> 1297 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 }, >> 1298 .rlen = 16, >> 1299 }, { >> 1300 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1301 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, >> 1302 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1303 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1304 .klen = 32, >> 1305 .input = { [0 ... 15] = 0x00 }, >> 1306 .ilen = 16, >> 1307 .result = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8, >> 1308 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 }, >> 1309 .rlen = 16, >> 1310 }, >> 1311 }; >> 1312 >> 1313 struct cipher_testvec tf_dec_tv_template[] = { >> 1314 { >> 1315 .key = { [0 ... 15] = 0x00 }, >> 1316 .klen = 16, >> 1317 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1318 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1319 .ilen = 16, >> 1320 .result = { [0 ... 15] = 0x00 }, >> 1321 .rlen = 16, >> 1322 }, { >> 1323 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1324 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, >> 1325 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, >> 1326 .klen = 24, >> 1327 .input = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf, >> 1328 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 }, >> 1329 .ilen = 16, >> 1330 .result = { [0 ... 15] = 0x00 }, >> 1331 .rlen = 16, >> 1332 }, { >> 1333 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, >> 1334 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, >> 1335 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1336 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1337 .klen = 32, >> 1338 .input = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8, >> 1339 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 }, >> 1340 .ilen = 16, >> 1341 .result = { [0 ... 15] = 0x00 }, >> 1342 .rlen = 16, >> 1343 }, >> 1344 }; >> 1345 >> 1346 struct cipher_testvec tf_cbc_enc_tv_template[] = { >> 1347 { /* Generated with Nettle */ >> 1348 .key = { [0 ... 15] = 0x00 }, >> 1349 .klen = 16, >> 1350 .iv = { [0 ... 15] = 0x00 }, >> 1351 .input = { [0 ... 15] = 0x00 }, >> 1352 .ilen = 16, >> 1353 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1354 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1355 .rlen = 16, >> 1356 }, { >> 1357 .key = { [0 ... 15] = 0x00 }, >> 1358 .klen = 16, >> 1359 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1360 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1361 .input = { [0 ... 15] = 0x00 }, >> 1362 .ilen = 16, >> 1363 .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1364 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, >> 1365 .rlen = 16, >> 1366 }, { >> 1367 .key = { [0 ... 15] = 0x00 }, >> 1368 .klen = 16, >> 1369 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1370 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, >> 1371 .input = { [0 ... 15] = 0x00 }, >> 1372 .ilen = 16, >> 1373 .result = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, >> 1374 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, >> 1375 .rlen = 16, >> 1376 }, { >> 1377 .key = { [0 ... 15] = 0x00 }, >> 1378 .klen = 16, >> 1379 .iv = { [0 ... 15] = 0x00 }, >> 1380 .input = { [0 ... 47] = 0x00 }, >> 1381 .ilen = 48, >> 1382 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1383 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a, >> 1384 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1385 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19, >> 1386 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, >> 1387 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, >> 1388 .rlen = 48, >> 1389 }, >> 1390 }; >> 1391 >> 1392 struct cipher_testvec tf_cbc_dec_tv_template[] = { >> 1393 { /* Reverse of the first four above */ >> 1394 .key = { [0 ... 15] = 0x00 }, >> 1395 .klen = 16, >> 1396 .iv = { [0 ... 15] = 0x00 }, >> 1397 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1398 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1399 .ilen = 16, >> 1400 .result = { [0 ... 15] = 0x00 }, >> 1401 .rlen = 16, >> 1402 }, { >> 1403 .key = { [0 ... 15] = 0x00 }, >> 1404 .klen = 16, >> 1405 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1406 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, >> 1407 .input = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1408 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, >> 1409 .ilen = 16, >> 1410 .result = { [0 ... 15] = 0x00 }, >> 1411 .rlen = 16, >> 1412 }, { >> 1413 .key = { [0 ... 15] = 0x00 }, >> 1414 .klen = 16, >> 1415 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1416 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 }, >> 1417 .input = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, >> 1418 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, >> 1419 .ilen = 16, >> 1420 .result = { [0 ... 15] = 0x00 }, >> 1421 .rlen = 16, >> 1422 }, { >> 1423 .key = { [0 ... 15] = 0x00 }, >> 1424 .klen = 16, >> 1425 .iv = { [0 ... 15] = 0x00 }, >> 1426 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, >> 1427 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a, >> 1428 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, >> 1429 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19, >> 1430 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26, >> 1431 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 }, >> 1432 .ilen = 48, >> 1433 .result = { [0 ... 47] = 0x00 }, >> 1434 .rlen = 48, >> 1435 }, >> 1436 }; >> 1437 >> 1438 /* >> 1439 * Serpent test vectors. These are backwards because Serpent writes >> 1440 * octet sequences in right-to-left mode. >> 1441 */ >> 1442 #define SERPENT_ENC_TEST_VECTORS 4 >> 1443 #define SERPENT_DEC_TEST_VECTORS 4 >> 1444 >> 1445 #define TNEPRES_ENC_TEST_VECTORS 4 >> 1446 #define TNEPRES_DEC_TEST_VECTORS 4 >> 1447 >> 1448 struct cipher_testvec serpent_enc_tv_template[] = >> 1449 { >> 1450 { >> 1451 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1452 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1453 .ilen = 16, >> 1454 .result = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, >> 1455 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 }, >> 1456 .rlen = 16, >> 1457 }, { >> 1458 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1459 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1460 .klen = 16, >> 1461 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1462 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1463 .ilen = 16, >> 1464 .result = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c, >> 1465 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d }, >> 1466 .rlen = 16, >> 1467 }, { >> 1468 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1469 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1470 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, >> 1471 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, >> 1472 .klen = 32, >> 1473 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1474 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1475 .ilen = 16, >> 1476 .result = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8, >> 1477 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c }, >> 1478 .rlen = 16, >> 1479 }, { >> 1480 .key = { [15] = 0x80 }, >> 1481 .klen = 16, >> 1482 .input = { [0 ... 15] = 0x00 }, >> 1483 .ilen = 16, >> 1484 .result = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c, >> 1485 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49}, >> 1486 .rlen = 16, >> 1487 }, >> 1488 }; >> 1489 >> 1490 struct cipher_testvec tnepres_enc_tv_template[] = >> 1491 { >> 1492 { /* KeySize=128, PT=0, I=1 */ >> 1493 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1495 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1497 .klen = 16, >> 1498 .ilen = 16, >> 1499 .result = { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05, >> 1500 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd }, >> 1501 .rlen = 16, >> 1502 }, { /* KeySize=192, PT=0, I=1 */ >> 1503 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1506 .klen = 24, >> 1507 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1509 .ilen = 16, >> 1510 .result = { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68, >> 1511 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 }, >> 1512 .rlen = 16, >> 1513 }, { /* KeySize=256, PT=0, I=1 */ >> 1514 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1518 .klen = 32, >> 1519 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1521 .ilen = 16, >> 1522 .result = { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb, >> 1523 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 }, >> 1524 .rlen = 16, >> 1525 }, { /* KeySize=256, I=257 */ >> 1526 .key = { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, >> 1527 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, >> 1528 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, >> 1529 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }, >> 1530 .klen = 32, >> 1531 .input = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, >> 1532 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }, >> 1533 .ilen = 16, >> 1534 .result = { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b, >> 1535 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde }, >> 1536 .rlen = 16, >> 1537 }, >> 1538 }; 34 1539 35 static struct cipher_speed_template des3_speed !! 1540 >> 1541 struct cipher_testvec serpent_dec_tv_template[] = >> 1542 { >> 1543 { >> 1544 .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, >> 1545 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 }, >> 1546 .ilen = 16, >> 1547 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1548 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1549 .rlen = 16, >> 1550 }, { >> 1551 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1552 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1553 .klen = 16, >> 1554 .input = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c, >> 1555 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d }, >> 1556 .ilen = 16, >> 1557 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1558 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1559 .rlen = 16, >> 1560 }, { >> 1561 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1562 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1563 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, >> 1564 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, >> 1565 .klen = 32, >> 1566 .input = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8, >> 1567 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c }, >> 1568 .ilen = 16, >> 1569 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1570 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1571 .rlen = 16, >> 1572 }, { >> 1573 .key = { [15] = 0x80 }, >> 1574 .klen = 16, >> 1575 .input = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c, >> 1576 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49}, >> 1577 .ilen = 16, >> 1578 .result = { [0 ... 15] = 0x00 }, >> 1579 .rlen = 16, >> 1580 }, >> 1581 }; >> 1582 >> 1583 struct cipher_testvec tnepres_dec_tv_template[] = >> 1584 { 36 { 1585 { 37 .key = "\x01\x23\x45\x67\x8 !! 1586 .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97, 38 "\x55\x55\x55\x55\x5 !! 1587 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 }, 39 "\xfe\xdc\xba\x98\x7 !! 1588 .ilen = 16, >> 1589 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1590 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1591 .rlen = 16, >> 1592 }, { >> 1593 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1594 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1595 .klen = 16, >> 1596 .input = { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47, >> 1597 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e }, >> 1598 .ilen = 16, >> 1599 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1600 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1601 .rlen = 16, >> 1602 }, { >> 1603 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1604 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1605 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, >> 1606 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, >> 1607 .klen = 32, >> 1608 .input = { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49, >> 1609 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee }, >> 1610 .ilen = 16, >> 1611 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1612 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1613 .rlen = 16, >> 1614 }, { /* KeySize=128, I=121 */ >> 1615 .key = { [15] = 0x80 }, >> 1616 .klen = 16, >> 1617 .input = { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06, >> 1618 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 }, >> 1619 .ilen = 16, >> 1620 .result = { [0 ... 15] = 0x00 }, >> 1621 .rlen = 16, >> 1622 }, >> 1623 }; >> 1624 >> 1625 >> 1626 /* Cast6 test vectors from RFC 2612 */ >> 1627 #define CAST6_ENC_TEST_VECTORS 3 >> 1628 #define CAST6_DEC_TEST_VECTORS 3 >> 1629 >> 1630 struct cipher_testvec cast6_enc_tv_template[] = >> 1631 { >> 1632 { >> 1633 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1634 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, >> 1635 .klen = 16, >> 1636 .input = { [0 ... 15] = 0x00 }, >> 1637 .ilen = 16, >> 1638 .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, >> 1639 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, >> 1640 .rlen = 16, >> 1641 }, { >> 1642 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1643 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, >> 1644 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, >> 1645 .klen = 24, >> 1646 .input = { [0 ... 15] = 0x00 }, >> 1647 .ilen = 16, >> 1648 .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, >> 1649 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, >> 1650 .rlen = 16, >> 1651 }, { >> 1652 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1653 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, >> 1654 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, >> 1655 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, >> 1656 .klen = 32, >> 1657 .input = { [0 ... 15] = 0x00 }, >> 1658 .ilen = 16, >> 1659 .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, >> 1660 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, >> 1661 .rlen = 16, >> 1662 }, >> 1663 }; >> 1664 >> 1665 struct cipher_testvec cast6_dec_tv_template[] = >> 1666 { >> 1667 { >> 1668 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1669 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, >> 1670 .klen = 16, >> 1671 .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, >> 1672 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, >> 1673 .ilen = 16, >> 1674 .result = { [0 ... 15] = 0x00 }, >> 1675 .rlen = 16, >> 1676 }, { >> 1677 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1678 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, >> 1679 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, >> 1680 .klen = 24, >> 1681 .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, >> 1682 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, >> 1683 .ilen = 16, >> 1684 .result = { [0 ... 15] = 0x00 }, >> 1685 .rlen = 16, >> 1686 }, { >> 1687 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, >> 1688 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, >> 1689 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, >> 1690 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, >> 1691 .klen = 32, >> 1692 .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, >> 1693 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, >> 1694 .ilen = 16, >> 1695 .result = { [0 ... 15] = 0x00 }, >> 1696 .rlen = 16, >> 1697 }, >> 1698 }; >> 1699 >> 1700 >> 1701 /* >> 1702 * AES test vectors. >> 1703 */ >> 1704 #define AES_ENC_TEST_VECTORS 3 >> 1705 #define AES_DEC_TEST_VECTORS 3 >> 1706 >> 1707 struct cipher_testvec aes_enc_tv_template[] = { >> 1708 { /* From FIPS-197 */ >> 1709 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1710 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1711 .klen = 16, >> 1712 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1713 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1714 .ilen = 16, >> 1715 .result = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, >> 1716 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }, >> 1717 .rlen = 16, >> 1718 }, { >> 1719 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1720 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1721 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, >> 1722 .klen = 24, >> 1723 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1724 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1725 .ilen = 16, >> 1726 .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, >> 1727 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }, >> 1728 .rlen = 16, >> 1729 }, { >> 1730 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1731 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1732 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, >> 1733 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, >> 1734 .klen = 32, >> 1735 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1736 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1737 .ilen = 16, >> 1738 .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, >> 1739 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }, >> 1740 .rlen = 16, >> 1741 }, >> 1742 }; >> 1743 >> 1744 struct cipher_testvec aes_dec_tv_template[] = { >> 1745 { /* From FIPS-197 */ >> 1746 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1747 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, >> 1748 .klen = 16, >> 1749 .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, >> 1750 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }, >> 1751 .ilen = 16, >> 1752 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1753 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1754 .rlen = 16, >> 1755 }, { >> 1756 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1757 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1758 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, 40 .klen = 24, 1759 .klen = 24, >> 1760 .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, >> 1761 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }, >> 1762 .ilen = 16, >> 1763 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1764 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1765 .rlen = 16, >> 1766 }, { >> 1767 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, >> 1768 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, >> 1769 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, >> 1770 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, >> 1771 .klen = 32, >> 1772 .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, >> 1773 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }, >> 1774 .ilen = 16, >> 1775 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, >> 1776 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, >> 1777 .rlen = 16, >> 1778 }, >> 1779 }; >> 1780 >> 1781 /* Cast5 test vectors from RFC 2144 */ >> 1782 #define CAST5_ENC_TEST_VECTORS 3 >> 1783 #define CAST5_DEC_TEST_VECTORS 3 >> 1784 >> 1785 struct cipher_testvec cast5_enc_tv_template[] = >> 1786 { >> 1787 { >> 1788 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, >> 1789 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, >> 1790 .klen = 16, >> 1791 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1792 .ilen = 8, >> 1793 .result = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 }, >> 1794 .rlen = 8, >> 1795 }, { >> 1796 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, >> 1797 0x23, 0x45 }, >> 1798 .klen = 10, >> 1799 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1800 .ilen = 8, >> 1801 .result = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b }, >> 1802 .rlen = 8, >> 1803 }, { >> 1804 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 }, >> 1805 .klen = 5, >> 1806 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1807 .ilen = 8, >> 1808 .result = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e }, >> 1809 .rlen = 8, >> 1810 }, >> 1811 }; >> 1812 >> 1813 struct cipher_testvec cast5_dec_tv_template[] = >> 1814 { >> 1815 { >> 1816 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, >> 1817 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, >> 1818 .klen = 16, >> 1819 .input = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 }, >> 1820 .ilen = 8, >> 1821 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1822 .rlen = 8, >> 1823 }, { >> 1824 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, >> 1825 0x23, 0x45 }, >> 1826 .klen = 10, >> 1827 .input = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b }, >> 1828 .ilen = 8, >> 1829 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1830 .rlen = 8, >> 1831 }, { >> 1832 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 }, >> 1833 .klen = 5, >> 1834 .input = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e }, >> 1835 .ilen = 8, >> 1836 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1837 .rlen = 8, >> 1838 }, >> 1839 }; >> 1840 >> 1841 /* >> 1842 * ARC4 test vectors from OpenSSL >> 1843 */ >> 1844 #define ARC4_ENC_TEST_VECTORS 7 >> 1845 #define ARC4_DEC_TEST_VECTORS 7 >> 1846 >> 1847 struct cipher_testvec arc4_enc_tv_template[] = >> 1848 { >> 1849 { >> 1850 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1851 .klen = 8, >> 1852 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1853 .ilen = 8, >> 1854 .result = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 }, >> 1855 .rlen = 8, >> 1856 }, { >> 1857 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1858 .klen = 8, >> 1859 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1860 .ilen = 8, >> 1861 .result = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 }, >> 1862 .rlen = 8, >> 1863 }, { >> 1864 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1865 .klen = 8, >> 1866 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1867 .ilen = 8, >> 1868 .result = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a }, >> 1869 .rlen = 8, >> 1870 }, { >> 1871 .key = { 0xef, 0x01, 0x23, 0x45}, >> 1872 .klen = 4, >> 1873 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1874 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1875 0x00, 0x00, 0x00, 0x00 }, >> 1876 .ilen = 20, >> 1877 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, >> 1878 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba, >> 1879 0x36, 0xb6, 0x78, 0x58 }, >> 1880 .rlen = 20, >> 1881 }, { >> 1882 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1883 .klen = 8, >> 1884 .input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1885 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1886 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1887 0x12, 0x34, 0x56, 0x78 }, >> 1888 .ilen = 28, >> 1889 .result = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89, >> 1890 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c, >> 1891 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87, >> 1892 0x40, 0x01, 0x1e, 0xcf }, >> 1893 .rlen = 28, >> 1894 }, { >> 1895 .key = { 0xef, 0x01, 0x23, 0x45 }, >> 1896 .klen = 4, >> 1897 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1898 0x00, 0x00 }, >> 1899 .ilen = 10, >> 1900 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, >> 1901 0xbd, 0x61 }, >> 1902 .rlen = 10, >> 1903 }, { >> 1904 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, >> 1905 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1906 .klen = 16, >> 1907 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, >> 1908 .ilen = 8, >> 1909 .result = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 }, >> 1910 .rlen = 8, >> 1911 }, >> 1912 }; >> 1913 >> 1914 struct cipher_testvec arc4_dec_tv_template[] = >> 1915 { >> 1916 { >> 1917 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1918 .klen = 8, >> 1919 .input = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 }, >> 1920 .ilen = 8, >> 1921 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1922 .rlen = 8, >> 1923 }, { >> 1924 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1925 .klen = 8, >> 1926 .input = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 }, >> 1927 .ilen = 8, >> 1928 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1929 .rlen = 8, >> 1930 }, { >> 1931 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1932 .klen = 8, >> 1933 .input = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a }, >> 1934 .ilen = 8, >> 1935 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1936 .rlen = 8, >> 1937 }, { >> 1938 .key = { 0xef, 0x01, 0x23, 0x45}, >> 1939 .klen = 4, >> 1940 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, >> 1941 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba, >> 1942 0x36, 0xb6, 0x78, 0x58 }, >> 1943 .ilen = 20, >> 1944 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1945 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1946 0x00, 0x00, 0x00, 0x00 }, >> 1947 .rlen = 20, >> 1948 }, { >> 1949 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, >> 1950 .klen = 8, >> 1951 .input = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89, >> 1952 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c, >> 1953 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87, >> 1954 0x40, 0x01, 0x1e, 0xcf }, >> 1955 .ilen = 28, >> 1956 .result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1957 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1958 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, >> 1959 0x12, 0x34, 0x56, 0x78 }, >> 1960 .rlen = 28, >> 1961 }, { >> 1962 .key = { 0xef, 0x01, 0x23, 0x45 }, >> 1963 .klen = 4, >> 1964 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, >> 1965 0xbd, 0x61 }, >> 1966 .ilen = 10, >> 1967 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 1968 0x00, 0x00 }, >> 1969 .rlen = 10, >> 1970 }, { >> 1971 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, >> 1972 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 1973 .klen = 16, >> 1974 .input = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 }, >> 1975 .ilen = 8, >> 1976 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }, >> 1977 .rlen = 8, >> 1978 }, >> 1979 }; >> 1980 >> 1981 /* >> 1982 * TEA test vectors >> 1983 */ >> 1984 #define TEA_ENC_TEST_VECTORS 4 >> 1985 #define TEA_DEC_TEST_VECTORS 4 >> 1986 >> 1987 struct cipher_testvec tea_enc_tv_template[] = >> 1988 { >> 1989 { >> 1990 .key = { [0 ... 15] = 0x00 }, >> 1991 .klen = 16, >> 1992 .input = { [0 ... 8] = 0x00 }, >> 1993 .ilen = 8, >> 1994 .result = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 }, >> 1995 .rlen = 8, >> 1996 }, { >> 1997 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 1998 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 1999 .klen = 16, >> 2000 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2001 .ilen = 8, >> 2002 .result = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 }, >> 2003 .rlen = 8, >> 2004 }, { >> 2005 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2006 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2007 .klen = 16, >> 2008 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, >> 2009 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2010 .ilen = 16, >> 2011 .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, >> 2012 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, >> 2013 .rlen = 16, >> 2014 }, { >> 2015 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2016 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2017 .klen = 16, >> 2018 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2019 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2020 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2021 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2022 .ilen = 32, >> 2023 .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, >> 2024 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, >> 2025 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, >> 2026 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, >> 2027 .rlen = 32, >> 2028 } >> 2029 }; >> 2030 >> 2031 struct cipher_testvec tea_dec_tv_template[] = >> 2032 { >> 2033 { >> 2034 .key = { [0 ... 15] = 0x00 }, >> 2035 .klen = 16, >> 2036 .input = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 }, >> 2037 .ilen = 8, >> 2038 .result = { [0 ... 8] = 0x00 }, >> 2039 .rlen = 8, >> 2040 }, { >> 2041 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 2042 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 2043 .klen = 16, >> 2044 .input = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 }, >> 2045 .ilen = 8, >> 2046 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2047 .rlen = 8, >> 2048 }, { >> 2049 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2050 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2051 .klen = 16, >> 2052 .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, >> 2053 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, >> 2054 .ilen = 16, >> 2055 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, >> 2056 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2057 .rlen = 16, >> 2058 }, { >> 2059 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2060 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2061 .klen = 16, >> 2062 .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, >> 2063 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, >> 2064 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, >> 2065 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, >> 2066 .ilen = 32, >> 2067 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2068 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2069 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2070 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2071 .rlen = 32, 41 } 2072 } 42 }; 2073 }; 43 2074 >> 2075 /* >> 2076 * XTEA test vectors >> 2077 */ >> 2078 #define XTEA_ENC_TEST_VECTORS 4 >> 2079 #define XTEA_DEC_TEST_VECTORS 4 >> 2080 >> 2081 struct cipher_testvec xtea_enc_tv_template[] = >> 2082 { >> 2083 { >> 2084 .key = { [0 ... 15] = 0x00 }, >> 2085 .klen = 16, >> 2086 .input = { [0 ... 8] = 0x00 }, >> 2087 .ilen = 8, >> 2088 .result = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 }, >> 2089 .rlen = 8, >> 2090 }, { >> 2091 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 2092 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 2093 .klen = 16, >> 2094 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2095 .ilen = 8, >> 2096 .result = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 }, >> 2097 .rlen = 8, >> 2098 }, { >> 2099 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2100 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2101 .klen = 16, >> 2102 .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d, >> 2103 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2104 .ilen = 16, >> 2105 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, >> 2106 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, >> 2107 .rlen = 16, >> 2108 }, { >> 2109 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2110 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2111 .klen = 16, >> 2112 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2113 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2114 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2115 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2116 .ilen = 32, >> 2117 .result = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a, >> 2118 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07, >> 2119 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4, >> 2120 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 }, >> 2121 .rlen = 32, >> 2122 } >> 2123 }; >> 2124 >> 2125 struct cipher_testvec xtea_dec_tv_template[] = >> 2126 { >> 2127 { >> 2128 .key = { [0 ... 15] = 0x00 }, >> 2129 .klen = 16, >> 2130 .input = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 }, >> 2131 .ilen = 8, >> 2132 .result = { [0 ... 8] = 0x00 }, >> 2133 .rlen = 8, >> 2134 }, { >> 2135 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 2136 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 2137 .klen = 16, >> 2138 .input = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 }, >> 2139 .ilen = 8, >> 2140 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2141 .rlen = 8, >> 2142 }, { >> 2143 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2144 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2145 .klen = 16, >> 2146 .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d, >> 2147 0x77, 0x4d, 0xd4, 0xb4, 0x87, 0x24, 0xe3, 0x9a }, >> 2148 .ilen = 16, >> 2149 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, >> 2150 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2151 .rlen = 16, >> 2152 }, { >> 2153 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2154 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2155 .klen = 16, >> 2156 .input = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a, >> 2157 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07, >> 2158 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4, >> 2159 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 }, >> 2160 .ilen = 32, >> 2161 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2162 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2163 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2164 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2165 .rlen = 32, >> 2166 } >> 2167 }; >> 2168 >> 2169 /* >> 2170 * KHAZAD test vectors. >> 2171 */ >> 2172 #define KHAZAD_ENC_TEST_VECTORS 5 >> 2173 #define KHAZAD_DEC_TEST_VECTORS 5 >> 2174 >> 2175 struct cipher_testvec khazad_enc_tv_template[] = { >> 2176 { >> 2177 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 2178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 2179 .klen = 16, >> 2180 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 2181 .ilen = 8, >> 2182 .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f }, >> 2183 .rlen = 8, >> 2184 }, { >> 2185 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, >> 2186 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, >> 2187 .klen = 16, >> 2188 .input = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, >> 2189 .ilen = 8, >> 2190 .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 }, >> 2191 .rlen = 8, >> 2192 }, { >> 2193 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, >> 2194 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, >> 2195 .klen = 16, >> 2196 .input = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, >> 2197 .ilen = 8, >> 2198 .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c }, >> 2199 .rlen = 8, >> 2200 }, { >> 2201 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, >> 2202 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2203 .klen = 16, >> 2204 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2205 .ilen = 8, >> 2206 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, >> 2207 .rlen = 8, >> 2208 }, { >> 2209 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, >> 2210 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2211 .klen = 16, >> 2212 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f , >> 2213 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2214 .ilen = 16, >> 2215 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 , >> 2216 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, >> 2217 .rlen = 16, >> 2218 }, >> 2219 }; >> 2220 >> 2221 struct cipher_testvec khazad_dec_tv_template[] = { >> 2222 { >> 2223 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, >> 2224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 2225 .klen = 16, >> 2226 .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f }, >> 2227 .ilen = 8, >> 2228 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 2229 .rlen = 8, >> 2230 }, { >> 2231 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, >> 2232 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, >> 2233 .klen = 16, >> 2234 .input = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 }, >> 2235 .ilen = 8, >> 2236 .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 }, >> 2237 .rlen = 8, >> 2238 }, { >> 2239 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, >> 2240 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, >> 2241 .klen = 16, >> 2242 .input = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c }, >> 2243 .ilen = 8, >> 2244 .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 }, >> 2245 .rlen = 8, >> 2246 }, { >> 2247 .key = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, >> 2248 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2249 .klen = 16, >> 2250 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, >> 2251 .ilen = 8, >> 2252 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2253 .rlen = 8, >> 2254 }, { >> 2255 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, >> 2256 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2257 .klen = 16, >> 2258 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 , >> 2259 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 }, >> 2260 .ilen = 16, >> 2261 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f , >> 2262 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f }, >> 2263 .rlen = 16, >> 2264 }, >> 2265 }; >> 2266 44 /* 2267 /* 45 * Cipher speed tests !! 2268 * Anubis test vectors. 46 */ !! 2269 */ 47 static u8 speed_template_8[] = {8, 0}; << 48 static u8 speed_template_16[] = {16, 0}; << 49 static u8 speed_template_24[] = {24, 0}; << 50 static u8 speed_template_8_16[] = {8, 16, 0}; << 51 static u8 speed_template_8_32[] = {8, 32, 0}; << 52 static u8 speed_template_16_32[] = {16, 32, 0} << 53 static u8 speed_template_16_24_32[] = {16, 24, << 54 static u8 speed_template_20_28_36[] = {20, 28, << 55 static u8 speed_template_32_40_48[] = {32, 40, << 56 static u8 speed_template_32_48[] = {32, 48, 0} << 57 static u8 speed_template_32_48_64[] = {32, 48, << 58 static u8 speed_template_32_64[] = {32, 64, 0} << 59 static u8 speed_template_32[] = {32, 0}; << 60 << 61 /* << 62 * AEAD speed tests << 63 */ << 64 static u8 aead_speed_template_19[] = {19, 0}; << 65 static u8 aead_speed_template_20_28_36[] = {20 << 66 static u8 aead_speed_template_36[] = {36, 0}; << 67 << 68 /* << 69 * Digest speed tests << 70 */ << 71 static struct hash_speed generic_hash_speed_te << 72 { .blen = 16, .plen = 16, }, << 73 { .blen = 64, .plen = 16, }, << 74 { .blen = 64, .plen = 64, }, << 75 { .blen = 256, .plen = 16, }, << 76 { .blen = 256, .plen = 64, }, << 77 { .blen = 256, .plen = 256, }, << 78 { .blen = 1024, .plen = 16, }, << 79 { .blen = 1024, .plen = 256, }, << 80 { .blen = 1024, .plen = 1024, }, << 81 { .blen = 2048, .plen = 16, }, << 82 { .blen = 2048, .plen = 256, }, << 83 { .blen = 2048, .plen = 1024, }, << 84 { .blen = 2048, .plen = 2048, }, << 85 { .blen = 4096, .plen = 16, }, << 86 { .blen = 4096, .plen = 256, }, << 87 { .blen = 4096, .plen = 1024, }, << 88 { .blen = 4096, .plen = 4096, }, << 89 { .blen = 8192, .plen = 16, }, << 90 { .blen = 8192, .plen = 256, }, << 91 { .blen = 8192, .plen = 1024, }, << 92 { .blen = 8192, .plen = 4096, }, << 93 { .blen = 8192, .plen = 8192, }, << 94 << 95 /* End marker */ << 96 { .blen = 0, .plen = 0, } << 97 }; << 98 << 99 static struct hash_speed poly1305_speed_templa << 100 { .blen = 96, .plen = 16, }, << 101 { .blen = 96, .plen = 32, }, << 102 { .blen = 96, .plen = 96, }, << 103 { .blen = 288, .plen = 16, }, << 104 { .blen = 288, .plen = 32, }, << 105 { .blen = 288, .plen = 288, }, << 106 { .blen = 1056, .plen = 32, }, << 107 { .blen = 1056, .plen = 1056, }, << 108 { .blen = 2080, .plen = 32, }, << 109 { .blen = 2080, .plen = 2080, }, << 110 { .blen = 4128, .plen = 4128, }, << 111 { .blen = 8224, .plen = 8224, }, << 112 2270 113 /* End marker */ !! 2271 #define ANUBIS_ENC_TEST_VECTORS 5 114 { .blen = 0, .plen = 0, } !! 2272 #define ANUBIS_DEC_TEST_VECTORS 5 >> 2273 #define ANUBIS_CBC_ENC_TEST_VECTORS 2 >> 2274 #define ANUBIS_CBC_DEC_TEST_VECTORS 2 >> 2275 >> 2276 struct cipher_testvec anubis_enc_tv_template[] = { >> 2277 { >> 2278 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2279 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2280 .klen = 16, >> 2281 .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2282 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2283 .ilen = 16, >> 2284 .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, >> 2285 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 }, >> 2286 .rlen = 16, >> 2287 }, { >> 2288 >> 2289 .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2290 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2291 0x03, 0x03, 0x03, 0x03 }, >> 2292 .klen = 20, >> 2293 .input = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2294 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }, >> 2295 .ilen = 16, >> 2296 .result = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49, >> 2297 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae }, >> 2298 .rlen = 16, >> 2299 }, { >> 2300 .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2301 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2302 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2303 0x24, 0x24, 0x24, 0x24 }, >> 2304 .klen = 28, >> 2305 .input = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2306 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 }, >> 2307 .ilen = 16, >> 2308 .result = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d, >> 2309 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde }, >> 2310 .rlen = 16, >> 2311 }, { >> 2312 .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2313 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2314 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2315 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, >> 2316 .klen = 32, >> 2317 .input = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2318 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, >> 2319 .ilen = 16, >> 2320 .result = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4, >> 2321 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe }, >> 2322 .rlen = 16, >> 2323 }, { >> 2324 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2325 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2326 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2327 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2328 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2329 .klen = 40, >> 2330 .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2331 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2332 .ilen = 16, >> 2333 .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, >> 2334 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee }, >> 2335 .rlen = 16, >> 2336 }, >> 2337 }; >> 2338 >> 2339 struct cipher_testvec anubis_dec_tv_template[] = { >> 2340 { >> 2341 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2342 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2343 .klen = 16, >> 2344 .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, >> 2345 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 }, >> 2346 .ilen = 16, >> 2347 .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2348 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2349 .rlen = 16, >> 2350 }, { >> 2351 >> 2352 .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2353 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2354 0x03, 0x03, 0x03, 0x03 }, >> 2355 .klen = 20, >> 2356 .input = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49, >> 2357 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae }, >> 2358 .ilen = 16, >> 2359 .result = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, >> 2360 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }, >> 2361 .rlen = 16, >> 2362 }, { >> 2363 .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2364 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2365 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2366 0x24, 0x24, 0x24, 0x24 }, >> 2367 .klen = 28, >> 2368 .input = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d, >> 2369 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde }, >> 2370 .ilen = 16, >> 2371 .result = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, >> 2372 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 }, >> 2373 .rlen = 16, >> 2374 }, { >> 2375 .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2376 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2377 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2378 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, >> 2379 .klen = 32, >> 2380 .input = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4, >> 2381 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe }, >> 2382 .ilen = 16, >> 2383 .result = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, >> 2384 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 }, >> 2385 .rlen = 16, >> 2386 }, { >> 2387 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2388 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2389 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2390 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2391 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2392 .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, >> 2393 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee }, >> 2394 .klen = 40, >> 2395 .ilen = 16, >> 2396 .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2397 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2398 .rlen = 16, >> 2399 }, >> 2400 }; >> 2401 >> 2402 struct cipher_testvec anubis_cbc_enc_tv_template[] = { >> 2403 { >> 2404 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2405 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2406 .klen = 16, >> 2407 .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2408 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2409 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2410 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2411 .ilen = 32, >> 2412 .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, >> 2413 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90, >> 2414 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66, >> 2415 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe }, >> 2416 .rlen = 32, >> 2417 }, { >> 2418 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2419 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2420 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2421 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2422 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2423 .klen = 40, >> 2424 .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2425 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2426 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2427 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2428 .ilen = 32, >> 2429 .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, >> 2430 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee, >> 2431 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75, >> 2432 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 }, >> 2433 .rlen = 32, >> 2434 }, >> 2435 }; >> 2436 >> 2437 struct cipher_testvec anubis_cbc_dec_tv_template[] = { >> 2438 { >> 2439 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2440 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2441 .klen = 16, >> 2442 .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f, >> 2443 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90, >> 2444 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66, >> 2445 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe }, >> 2446 .ilen = 32, >> 2447 .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2448 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2449 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, >> 2450 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }, >> 2451 .rlen = 32, >> 2452 }, { >> 2453 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2454 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2455 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2456 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2457 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2458 .klen = 40, >> 2459 .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97, >> 2460 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee, >> 2461 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75, >> 2462 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 }, >> 2463 .ilen = 32, >> 2464 .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2465 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2466 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, >> 2467 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 }, >> 2468 .rlen = 32, >> 2469 }, >> 2470 }; >> 2471 >> 2472 /* >> 2473 * XETA test vectors >> 2474 */ >> 2475 #define XETA_ENC_TEST_VECTORS 4 >> 2476 #define XETA_DEC_TEST_VECTORS 4 >> 2477 >> 2478 struct cipher_testvec xeta_enc_tv_template[] = >> 2479 { >> 2480 { >> 2481 .key = { [0 ... 15] = 0x00 }, >> 2482 .klen = 16, >> 2483 .input = { [0 ... 8] = 0x00 }, >> 2484 .ilen = 8, >> 2485 .result = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 }, >> 2486 .rlen = 8, >> 2487 }, { >> 2488 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 2489 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 2490 .klen = 16, >> 2491 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2492 .ilen = 8, >> 2493 .result = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 }, >> 2494 .rlen = 8, >> 2495 }, { >> 2496 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2497 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2498 .klen = 16, >> 2499 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, >> 2500 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2501 .ilen = 16, >> 2502 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, >> 2503 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, >> 2504 .rlen = 16, >> 2505 }, { >> 2506 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2507 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2508 .klen = 16, >> 2509 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2510 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2511 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2512 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2513 .ilen = 32, >> 2514 .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, >> 2515 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, >> 2516 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, >> 2517 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, >> 2518 .rlen = 32, >> 2519 } >> 2520 }; >> 2521 >> 2522 struct cipher_testvec xeta_dec_tv_template[] = >> 2523 { >> 2524 { >> 2525 .key = { [0 ... 15] = 0x00 }, >> 2526 .klen = 16, >> 2527 .input = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 }, >> 2528 .ilen = 8, >> 2529 .result = { [0 ... 8] = 0x00 }, >> 2530 .rlen = 8, >> 2531 }, { >> 2532 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76, >> 2533 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 }, >> 2534 .klen = 16, >> 2535 .input = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 }, >> 2536 .ilen = 8, >> 2537 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e }, >> 2538 .rlen = 8, >> 2539 }, { >> 2540 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, >> 2541 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, >> 2542 .klen = 16, >> 2543 .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, >> 2544 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, >> 2545 .ilen = 16, >> 2546 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, >> 2547 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, >> 2548 .rlen = 16, >> 2549 }, { >> 2550 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, >> 2551 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, >> 2552 .klen = 16, >> 2553 .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, >> 2554 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, >> 2555 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, >> 2556 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, >> 2557 .ilen = 32, >> 2558 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, >> 2559 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, >> 2560 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, >> 2561 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, >> 2562 .rlen = 32, >> 2563 } >> 2564 }; >> 2565 >> 2566 /* >> 2567 * Compression stuff. >> 2568 */ >> 2569 #define COMP_BUF_SIZE 512 >> 2570 >> 2571 struct comp_testvec { >> 2572 int inlen, outlen; >> 2573 char input[COMP_BUF_SIZE]; >> 2574 char output[COMP_BUF_SIZE]; >> 2575 }; >> 2576 >> 2577 /* >> 2578 * Deflate test vectors (null-terminated strings). >> 2579 * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. >> 2580 */ >> 2581 #define DEFLATE_COMP_TEST_VECTORS 2 >> 2582 #define DEFLATE_DECOMP_TEST_VECTORS 2 >> 2583 >> 2584 struct comp_testvec deflate_comp_tv_template[] = { >> 2585 { >> 2586 .inlen = 70, >> 2587 .outlen = 38, >> 2588 .input = "Join us now and share the software " >> 2589 "Join us now and share the software ", >> 2590 .output = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56, >> 2591 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51, >> 2592 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9, >> 2593 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07, >> 2594 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 }, >> 2595 }, { >> 2596 .inlen = 191, >> 2597 .outlen = 122, >> 2598 .input = "This document describes a compression method based on the DEFLATE" >> 2599 "compression algorithm. This document defines the application of " >> 2600 "the DEFLATE algorithm to the IP Payload Compression Protocol.", >> 2601 .output = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04, >> 2602 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09, >> 2603 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8, >> 2604 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49, >> 2605 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27, >> 2606 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2, >> 2607 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad, >> 2608 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4, >> 2609 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b, >> 2610 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f, >> 2611 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf, >> 2612 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02, >> 2613 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98, >> 2614 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a, >> 2615 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79, >> 2616 0xfa, 0x02 }, >> 2617 }, >> 2618 }; >> 2619 >> 2620 struct comp_testvec deflate_decomp_tv_template[] = { >> 2621 { >> 2622 .inlen = 122, >> 2623 .outlen = 191, >> 2624 .input = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04, >> 2625 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09, >> 2626 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8, >> 2627 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49, >> 2628 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27, >> 2629 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2, >> 2630 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad, >> 2631 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4, >> 2632 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b, >> 2633 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f, >> 2634 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf, >> 2635 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02, >> 2636 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98, >> 2637 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a, >> 2638 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79, >> 2639 0xfa, 0x02 }, >> 2640 .output = "This document describes a compression method based on the DEFLATE" >> 2641 "compression algorithm. This document defines the application of " >> 2642 "the DEFLATE algorithm to the IP Payload Compression Protocol.", >> 2643 }, { >> 2644 .inlen = 38, >> 2645 .outlen = 70, >> 2646 .input = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56, >> 2647 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51, >> 2648 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9, >> 2649 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07, >> 2650 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 }, >> 2651 .output = "Join us now and share the software " >> 2652 "Join us now and share the software ", >> 2653 }, >> 2654 }; >> 2655 >> 2656 /* >> 2657 * Michael MIC test vectors from IEEE 802.11i >> 2658 */ >> 2659 #define MICHAEL_MIC_TEST_VECTORS 6 >> 2660 >> 2661 struct hash_testvec michael_mic_tv_template[] = >> 2662 { >> 2663 { >> 2664 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, >> 2665 .ksize = 8, >> 2666 .plaintext = { }, >> 2667 .psize = 0, >> 2668 .digest = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 } >> 2669 }, >> 2670 { >> 2671 .key = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }, >> 2672 .ksize = 8, >> 2673 .plaintext = { 'M' }, >> 2674 .psize = 1, >> 2675 .digest = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f } >> 2676 }, >> 2677 { >> 2678 .key = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }, >> 2679 .ksize = 8, >> 2680 .plaintext = { 'M', 'i' }, >> 2681 .psize = 2, >> 2682 .digest = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 } >> 2683 }, >> 2684 { >> 2685 .key = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }, >> 2686 .ksize = 8, >> 2687 .plaintext = { 'M', 'i', 'c' }, >> 2688 .psize = 3, >> 2689 .digest = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb } >> 2690 }, >> 2691 { >> 2692 .key = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }, >> 2693 .ksize = 8, >> 2694 .plaintext = { 'M', 'i', 'c', 'h' }, >> 2695 .psize = 4, >> 2696 .digest = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 } >> 2697 }, >> 2698 { >> 2699 .key = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }, >> 2700 .ksize = 8, >> 2701 .plaintext = { 'M', 'i', 'c', 'h', 'a', 'e', 'l' }, >> 2702 .psize = 7, >> 2703 .digest = { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 }, >> 2704 } 115 }; 2705 }; 116 2706 117 #endif /* _CRYPTO_TCRYPT_H */ 2707 #endif /* _CRYPTO_TCRYPT_H */ 118 2708
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.