4 * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef TEST_CRYPTODEV_HASH_TEST_VECTORS_H_
34 #define TEST_CRYPTODEV_HASH_TEST_VECTORS_H_
36 static const uint8_t plaintext_hash[] = {
37 "What a lousy earth! He wondered how many people "
38 "were destitute that same night even in his own "
39 "prosperous country, how many homes were "
40 "shanties, how many husbands were drunk and "
41 "wives socked, and how many children were "
42 "bullied, abused, or abandoned. How many "
43 "families hungered for food they could not "
44 "afford to buy? How many hearts were broken? How "
45 "many suicides would take place that same night, "
46 "how many people would go insane? How many "
47 "cockroaches and landlords would triumph? How "
48 "many winners were losers, successes failures, "
49 "and rich men poor men? How many wise guys were "
50 "stupid? How many happy endings were unhappy "
51 "endings? How many honest men were liars, brave "
52 "men cowards, loyal men traitors, how many "
53 "sainted men were corrupt, how many people in "
54 "positions of trust had sold their souls to "
55 "bodyguards, how many had never had souls? How "
56 "many straight-and-narrow paths were crooked "
57 "paths? How many best families were worst "
58 "families and how many good people were bad "
59 "people? When you added them all up and then "
60 "subtracted, you might be left with only the "
61 "children, and perhaps with Albert Einstein and "
62 "an old violinist or sculptor somewhere."
65 static const struct blockcipher_test_data
67 .auth_algo = RTE_CRYPTO_AUTH_MD5,
69 .data = plaintext_hash,
74 0xB3, 0xE6, 0xBB, 0x50, 0x41, 0x35, 0x3C, 0x6B,
75 0x7A, 0xFF, 0xD2, 0x64, 0xAF, 0xD5, 0x1C, 0xB2
81 static const struct blockcipher_test_data
82 hmac_md5_test_vector = {
83 .auth_algo = RTE_CRYPTO_AUTH_MD5_HMAC,
85 .data = plaintext_hash,
90 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
91 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD
97 0x50, 0xE8, 0xDE, 0xC5, 0xC1, 0x76, 0xAC, 0xAE,
98 0x15, 0x4A, 0xF1, 0x7F, 0x7E, 0x04, 0x42, 0x9B
105 static const struct blockcipher_test_data
107 .auth_algo = RTE_CRYPTO_AUTH_SHA1,
109 .data = plaintext_hash,
114 0xA2, 0x8D, 0x40, 0x78, 0xDD, 0x9F, 0xBB, 0xD5,
115 0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70,
116 0xA6, 0x7D, 0x45, 0xCA
122 static const struct blockcipher_test_data
123 hmac_sha1_test_vector = {
124 .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
126 .data = plaintext_hash,
131 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
132 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
133 0xDE, 0xF4, 0xDE, 0xAD
139 0xC4, 0xB7, 0x0E, 0x6B, 0xDE, 0xD1, 0xE7, 0x77,
140 0x7E, 0x2E, 0x8F, 0xFC, 0x48, 0x39, 0x46, 0x17,
141 0x3F, 0x91, 0x64, 0x59
148 static const struct blockcipher_test_data
149 sha224_test_vector = {
150 .auth_algo = RTE_CRYPTO_AUTH_SHA224,
152 .data = plaintext_hash,
157 0x91, 0xE7, 0xCD, 0x75, 0x14, 0x9C, 0xA9, 0xE9,
158 0x2E, 0x46, 0x12, 0x20, 0x22, 0xF9, 0x68, 0x28,
159 0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E,
160 0x5E, 0x8F, 0x25, 0x84
166 static const struct blockcipher_test_data
167 hmac_sha224_test_vector = {
168 .auth_algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
170 .data = plaintext_hash,
175 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
176 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
177 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
178 0xFB, 0xBF, 0xB0, 0x8C
184 0x70, 0x0F, 0x04, 0x4D, 0x22, 0x02, 0x7D, 0x31,
185 0x36, 0xDA, 0x77, 0x19, 0xB9, 0x66, 0x37, 0x7B,
186 0xF1, 0x8A, 0x63, 0xBB, 0x5D, 0x1D, 0xE3, 0x9F,
187 0x92, 0xF6, 0xAA, 0x19
194 static const struct blockcipher_test_data
195 sha256_test_vector = {
196 .auth_algo = RTE_CRYPTO_AUTH_SHA256,
198 .data = plaintext_hash,
203 0x7F, 0xF1, 0x0C, 0xF5, 0x90, 0x97, 0x19, 0x0F,
204 0x00, 0xE4, 0x83, 0x01, 0xCA, 0x59, 0x00, 0x2E,
205 0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15,
206 0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7
212 static const struct blockcipher_test_data
213 hmac_sha256_test_vector = {
214 .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
216 .data = plaintext_hash,
221 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
222 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
223 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
224 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC
230 0xAF, 0x8F, 0x70, 0x1B, 0x4B, 0xAF, 0x34, 0xCB,
231 0x02, 0x24, 0x48, 0x45, 0x83, 0x52, 0x8F, 0x22,
232 0x06, 0x4D, 0x64, 0x09, 0x0A, 0xCC, 0x02, 0x77,
233 0x71, 0x83, 0x48, 0x71, 0x07, 0x02, 0x25, 0x17
240 static const struct blockcipher_test_data
241 sha384_test_vector = {
242 .auth_algo = RTE_CRYPTO_AUTH_SHA384,
244 .data = plaintext_hash,
249 0x1D, 0xE7, 0x3F, 0x55, 0x86, 0xFE, 0x48, 0x9F,
250 0xAC, 0xC6, 0x85, 0x32, 0xFA, 0x8E, 0xA6, 0x77,
251 0x25, 0x84, 0xA5, 0x98, 0x8D, 0x0B, 0x80, 0xF4,
252 0xEB, 0x2C, 0xFB, 0x6C, 0xEA, 0x7B, 0xFD, 0xD5,
253 0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC,
254 0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6
260 static const struct blockcipher_test_data
261 hmac_sha384_test_vector = {
262 .auth_algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
264 .data = plaintext_hash,
269 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
270 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
271 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
272 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC,
273 0x39, 0x8B, 0x5C, 0x49, 0x68, 0x1E, 0x3A, 0x05,
274 0xCC, 0x68, 0x5C, 0x76, 0xCB, 0x3C, 0x71, 0x89
280 0xE2, 0x83, 0x18, 0x55, 0xB5, 0x8D, 0x94, 0x9B,
281 0x01, 0xB6, 0xE2, 0x57, 0x7A, 0x62, 0xF5, 0xF4,
282 0xAB, 0x39, 0xF3, 0x3C, 0x28, 0xA0, 0x0F, 0xCC,
283 0xEE, 0x1C, 0xF1, 0xF8, 0x69, 0xF1, 0x24, 0x3B,
284 0x10, 0x90, 0x0A, 0xE3, 0xF0, 0x59, 0xDD, 0xC0,
285 0x6F, 0xE6, 0x8C, 0x84, 0xD5, 0x03, 0xF8, 0x9E
292 static const struct blockcipher_test_data
293 sha512_test_vector = {
294 .auth_algo = RTE_CRYPTO_AUTH_SHA512,
296 .data = plaintext_hash,
301 0xB9, 0xBA, 0x28, 0x48, 0x3C, 0xC2, 0xD3, 0x65,
302 0x4A, 0xD6, 0x00, 0x1D, 0xCE, 0x61, 0x64, 0x54,
303 0x45, 0x8C, 0x64, 0x0E, 0xED, 0x0E, 0xD8, 0x1C,
304 0x72, 0xCE, 0xD2, 0x44, 0x91, 0xC8, 0xEB, 0xC7,
305 0x99, 0xC5, 0xCA, 0x89, 0x72, 0x64, 0x96, 0x41,
306 0xC8, 0xEA, 0xB2, 0x4E, 0xD1, 0x21, 0x13, 0x49,
307 0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F,
308 0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB
314 static const struct blockcipher_test_data
315 hmac_sha512_test_vector = {
316 .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
318 .data = plaintext_hash,
323 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
324 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
325 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
326 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC,
327 0x39, 0x8B, 0x5C, 0x49, 0x68, 0x1E, 0x3A, 0x05,
328 0xCC, 0x68, 0x5C, 0x76, 0xCB, 0x3C, 0x71, 0x89,
329 0xDE, 0xAA, 0x36, 0x44, 0x98, 0x93, 0x97, 0x1E,
330 0x6D, 0x53, 0x83, 0x87, 0xB3, 0xB7, 0x56, 0x41
336 0xB8, 0x0B, 0x35, 0x97, 0x3F, 0x24, 0x3F, 0x05,
337 0x2A, 0x7F, 0x2F, 0xD8, 0xD7, 0x56, 0x58, 0xAD,
338 0x6F, 0x8D, 0x1F, 0x4C, 0x30, 0xF9, 0xA8, 0x29,
339 0x7A, 0xE0, 0x8D, 0x88, 0xF5, 0x2E, 0x94, 0xF5,
340 0x06, 0xF7, 0x5D, 0x57, 0x32, 0xA8, 0x49, 0x29,
341 0xEA, 0x6B, 0x6D, 0x95, 0xBD, 0x76, 0xF5, 0x79,
342 0x97, 0x37, 0x0F, 0xBE, 0xC2, 0x45, 0xA0, 0x87,
343 0xAF, 0x24, 0x27, 0x0C, 0x78, 0xBA, 0xBE, 0x20
350 static const struct blockcipher_test_case hash_test_cases[] = {
352 .test_descr = "MD5 Digest",
353 .test_data = &md5_test_vector,
354 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
355 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
358 .test_descr = "MD5 Digest Verify",
359 .test_data = &md5_test_vector,
360 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
361 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
364 .test_descr = "HMAC-MD5 Digest",
365 .test_data = &hmac_md5_test_vector,
366 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
367 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
368 BLOCKCIPHER_TEST_TARGET_PMD_MB |
369 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
372 .test_descr = "HMAC-MD5 Digest Verify",
373 .test_data = &hmac_md5_test_vector,
374 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
375 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
376 BLOCKCIPHER_TEST_TARGET_PMD_MB |
377 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
380 .test_descr = "SHA1 Digest",
381 .test_data = &sha1_test_vector,
382 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
383 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
386 .test_descr = "SHA1 Digest Verify",
387 .test_data = &sha1_test_vector,
388 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
389 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
392 .test_descr = "HMAC-SHA1 Digest",
393 .test_data = &hmac_sha1_test_vector,
394 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
395 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
396 BLOCKCIPHER_TEST_TARGET_PMD_MB |
397 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
400 .test_descr = "HMAC-SHA1 Digest Verify",
401 .test_data = &hmac_sha1_test_vector,
402 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
403 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
404 BLOCKCIPHER_TEST_TARGET_PMD_MB |
405 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
408 .test_descr = "SHA224 Digest",
409 .test_data = &sha224_test_vector,
410 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
411 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
414 .test_descr = "SHA224 Digest Verify",
415 .test_data = &sha224_test_vector,
416 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
417 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
420 .test_descr = "HMAC-SHA224 Digest",
421 .test_data = &hmac_sha224_test_vector,
422 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
423 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
424 BLOCKCIPHER_TEST_TARGET_PMD_MB |
425 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
428 .test_descr = "HMAC-SHA224 Digest Verify",
429 .test_data = &hmac_sha224_test_vector,
430 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
431 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
432 BLOCKCIPHER_TEST_TARGET_PMD_MB |
433 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
436 .test_descr = "SHA256 Digest",
437 .test_data = &sha256_test_vector,
438 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
439 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
442 .test_descr = "SHA256 Digest Verify",
443 .test_data = &sha256_test_vector,
444 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
445 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
448 .test_descr = "HMAC-SHA256 Digest",
449 .test_data = &hmac_sha256_test_vector,
450 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
451 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
452 BLOCKCIPHER_TEST_TARGET_PMD_MB |
453 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
456 .test_descr = "HMAC-SHA256 Digest Verify",
457 .test_data = &hmac_sha256_test_vector,
458 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
459 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
460 BLOCKCIPHER_TEST_TARGET_PMD_MB |
461 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
464 .test_descr = "SHA384 Digest",
465 .test_data = &sha384_test_vector,
466 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
467 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
470 .test_descr = "SHA384 Digest Verify",
471 .test_data = &sha384_test_vector,
472 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
473 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
476 .test_descr = "HMAC-SHA384 Digest",
477 .test_data = &hmac_sha384_test_vector,
478 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
479 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
480 BLOCKCIPHER_TEST_TARGET_PMD_MB |
481 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
484 .test_descr = "HMAC-SHA384 Digest Verify",
485 .test_data = &hmac_sha384_test_vector,
486 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
487 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
488 BLOCKCIPHER_TEST_TARGET_PMD_MB |
489 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
492 .test_descr = "SHA512 Digest",
493 .test_data = &sha512_test_vector,
494 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
495 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
498 .test_descr = "SHA512 Digest Verify",
499 .test_data = &sha512_test_vector,
500 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
501 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
504 .test_descr = "HMAC-SHA512 Digest",
505 .test_data = &hmac_sha512_test_vector,
506 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
507 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
508 BLOCKCIPHER_TEST_TARGET_PMD_MB |
509 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
512 .test_descr = "HMAC-SHA512 Digest Verify",
513 .test_data = &hmac_sha512_test_vector,
514 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
515 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
516 BLOCKCIPHER_TEST_TARGET_PMD_MB |
517 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
521 #endif /* TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ */