1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
5 #ifndef TEST_CRYPTODEV_HASH_TEST_VECTORS_H_
6 #define TEST_CRYPTODEV_HASH_TEST_VECTORS_H_
8 static const uint8_t plaintext_hash[] = {
9 "What a lousy earth! He wondered how many people "
10 "were destitute that same night even in his own "
11 "prosperous country, how many homes were "
12 "shanties, how many husbands were drunk and "
13 "wives socked, and how many children were "
14 "bullied, abused, or abandoned. How many "
15 "families hungered for food they could not "
16 "afford to buy? How many hearts were broken? How "
17 "many suicides would take place that same night, "
18 "how many people would go insane? How many "
19 "cockroaches and landlords would triumph? How "
20 "many winners were losers, successes failures, "
21 "and rich men poor men? How many wise guys were "
22 "stupid? How many happy endings were unhappy "
23 "endings? How many honest men were liars, brave "
24 "men cowards, loyal men traitors, how many "
25 "sainted men were corrupt, how many people in "
26 "positions of trust had sold their souls to "
27 "bodyguards, how many had never had souls? How "
28 "many straight-and-narrow paths were crooked "
29 "paths? How many best families were worst "
30 "families and how many good people were bad "
31 "people? When you added them all up and then "
32 "subtracted, you might be left with only the "
33 "children, and perhaps with Albert Einstein and "
34 "an old violinist or sculptor somewhere."
37 static const struct blockcipher_test_data
39 .auth_algo = RTE_CRYPTO_AUTH_MD5,
41 .data = plaintext_hash,
46 0xB3, 0xE6, 0xBB, 0x50, 0x41, 0x35, 0x3C, 0x6B,
47 0x7A, 0xFF, 0xD2, 0x64, 0xAF, 0xD5, 0x1C, 0xB2
53 static const struct blockcipher_test_data
54 hmac_md5_test_vector = {
55 .auth_algo = RTE_CRYPTO_AUTH_MD5_HMAC,
57 .data = plaintext_hash,
62 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
63 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD
69 0x50, 0xE8, 0xDE, 0xC5, 0xC1, 0x76, 0xAC, 0xAE,
70 0x15, 0x4A, 0xF1, 0x7F, 0x7E, 0x04, 0x42, 0x9B
77 static const struct blockcipher_test_data
79 .auth_algo = RTE_CRYPTO_AUTH_SHA1,
81 .data = plaintext_hash,
86 0xA2, 0x8D, 0x40, 0x78, 0xDD, 0x9F, 0xBB, 0xD5,
87 0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70,
88 0xA6, 0x7D, 0x45, 0xCA
94 static const struct blockcipher_test_data
95 hmac_sha1_test_vector = {
96 .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
98 .data = plaintext_hash,
103 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
104 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
105 0xDE, 0xF4, 0xDE, 0xAD
111 0xC4, 0xB7, 0x0E, 0x6B, 0xDE, 0xD1, 0xE7, 0x77,
112 0x7E, 0x2E, 0x8F, 0xFC, 0x48, 0x39, 0x46, 0x17,
113 0x3F, 0x91, 0x64, 0x59
120 static const struct blockcipher_test_data
121 sha224_test_vector = {
122 .auth_algo = RTE_CRYPTO_AUTH_SHA224,
124 .data = plaintext_hash,
129 0x91, 0xE7, 0xCD, 0x75, 0x14, 0x9C, 0xA9, 0xE9,
130 0x2E, 0x46, 0x12, 0x20, 0x22, 0xF9, 0x68, 0x28,
131 0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E,
132 0x5E, 0x8F, 0x25, 0x84
138 static const struct blockcipher_test_data
139 hmac_sha224_test_vector = {
140 .auth_algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
142 .data = plaintext_hash,
147 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
148 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
149 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
150 0xFB, 0xBF, 0xB0, 0x8C
156 0x70, 0x0F, 0x04, 0x4D, 0x22, 0x02, 0x7D, 0x31,
157 0x36, 0xDA, 0x77, 0x19, 0xB9, 0x66, 0x37, 0x7B,
158 0xF1, 0x8A, 0x63, 0xBB, 0x5D, 0x1D, 0xE3, 0x9F,
159 0x92, 0xF6, 0xAA, 0x19
166 static const struct blockcipher_test_data
167 sha256_test_vector = {
168 .auth_algo = RTE_CRYPTO_AUTH_SHA256,
170 .data = plaintext_hash,
175 0x7F, 0xF1, 0x0C, 0xF5, 0x90, 0x97, 0x19, 0x0F,
176 0x00, 0xE4, 0x83, 0x01, 0xCA, 0x59, 0x00, 0x2E,
177 0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15,
178 0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7
184 static const struct blockcipher_test_data
185 hmac_sha256_test_vector = {
186 .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
188 .data = plaintext_hash,
193 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
194 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
195 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
196 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC
202 0xAF, 0x8F, 0x70, 0x1B, 0x4B, 0xAF, 0x34, 0xCB,
203 0x02, 0x24, 0x48, 0x45, 0x83, 0x52, 0x8F, 0x22,
204 0x06, 0x4D, 0x64, 0x09, 0x0A, 0xCC, 0x02, 0x77,
205 0x71, 0x83, 0x48, 0x71, 0x07, 0x02, 0x25, 0x17
212 static const struct blockcipher_test_data
213 sha384_test_vector = {
214 .auth_algo = RTE_CRYPTO_AUTH_SHA384,
216 .data = plaintext_hash,
221 0x1D, 0xE7, 0x3F, 0x55, 0x86, 0xFE, 0x48, 0x9F,
222 0xAC, 0xC6, 0x85, 0x32, 0xFA, 0x8E, 0xA6, 0x77,
223 0x25, 0x84, 0xA5, 0x98, 0x8D, 0x0B, 0x80, 0xF4,
224 0xEB, 0x2C, 0xFB, 0x6C, 0xEA, 0x7B, 0xFD, 0xD5,
225 0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC,
226 0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6
232 static const struct blockcipher_test_data
233 hmac_sha384_test_vector = {
234 .auth_algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
236 .data = plaintext_hash,
241 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
242 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
243 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
244 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC,
245 0x39, 0x8B, 0x5C, 0x49, 0x68, 0x1E, 0x3A, 0x05,
246 0xCC, 0x68, 0x5C, 0x76, 0xCB, 0x3C, 0x71, 0x89
252 0xE2, 0x83, 0x18, 0x55, 0xB5, 0x8D, 0x94, 0x9B,
253 0x01, 0xB6, 0xE2, 0x57, 0x7A, 0x62, 0xF5, 0xF4,
254 0xAB, 0x39, 0xF3, 0x3C, 0x28, 0xA0, 0x0F, 0xCC,
255 0xEE, 0x1C, 0xF1, 0xF8, 0x69, 0xF1, 0x24, 0x3B,
256 0x10, 0x90, 0x0A, 0xE3, 0xF0, 0x59, 0xDD, 0xC0,
257 0x6F, 0xE6, 0x8C, 0x84, 0xD5, 0x03, 0xF8, 0x9E
264 static const struct blockcipher_test_data
265 sha512_test_vector = {
266 .auth_algo = RTE_CRYPTO_AUTH_SHA512,
268 .data = plaintext_hash,
273 0xB9, 0xBA, 0x28, 0x48, 0x3C, 0xC2, 0xD3, 0x65,
274 0x4A, 0xD6, 0x00, 0x1D, 0xCE, 0x61, 0x64, 0x54,
275 0x45, 0x8C, 0x64, 0x0E, 0xED, 0x0E, 0xD8, 0x1C,
276 0x72, 0xCE, 0xD2, 0x44, 0x91, 0xC8, 0xEB, 0xC7,
277 0x99, 0xC5, 0xCA, 0x89, 0x72, 0x64, 0x96, 0x41,
278 0xC8, 0xEA, 0xB2, 0x4E, 0xD1, 0x21, 0x13, 0x49,
279 0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F,
280 0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB
286 static const struct blockcipher_test_data
287 hmac_sha512_test_vector = {
288 .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
290 .data = plaintext_hash,
295 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
296 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
297 0xDE, 0xF4, 0xDE, 0xAD, 0x26, 0xEB, 0xAB, 0x92,
298 0xFB, 0xBF, 0xB0, 0x8C, 0x29, 0x87, 0x90, 0xAC,
299 0x39, 0x8B, 0x5C, 0x49, 0x68, 0x1E, 0x3A, 0x05,
300 0xCC, 0x68, 0x5C, 0x76, 0xCB, 0x3C, 0x71, 0x89,
301 0xDE, 0xAA, 0x36, 0x44, 0x98, 0x93, 0x97, 0x1E,
302 0x6D, 0x53, 0x83, 0x87, 0xB3, 0xB7, 0x56, 0x41
308 0xB8, 0x0B, 0x35, 0x97, 0x3F, 0x24, 0x3F, 0x05,
309 0x2A, 0x7F, 0x2F, 0xD8, 0xD7, 0x56, 0x58, 0xAD,
310 0x6F, 0x8D, 0x1F, 0x4C, 0x30, 0xF9, 0xA8, 0x29,
311 0x7A, 0xE0, 0x8D, 0x88, 0xF5, 0x2E, 0x94, 0xF5,
312 0x06, 0xF7, 0x5D, 0x57, 0x32, 0xA8, 0x49, 0x29,
313 0xEA, 0x6B, 0x6D, 0x95, 0xBD, 0x76, 0xF5, 0x79,
314 0x97, 0x37, 0x0F, 0xBE, 0xC2, 0x45, 0xA0, 0x87,
315 0xAF, 0x24, 0x27, 0x0C, 0x78, 0xBA, 0xBE, 0x20
322 static const struct blockcipher_test_case hash_test_cases[] = {
324 .test_descr = "MD5 Digest",
325 .test_data = &md5_test_vector,
326 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
327 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
330 .test_descr = "MD5 Digest Verify",
331 .test_data = &md5_test_vector,
332 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
333 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
336 .test_descr = "HMAC-MD5 Digest",
337 .test_data = &hmac_md5_test_vector,
338 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
339 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
340 BLOCKCIPHER_TEST_TARGET_PMD_MB |
341 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
342 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
343 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
344 BLOCKCIPHER_TEST_TARGET_PMD_QAT
347 .test_descr = "HMAC-MD5 Digest Verify",
348 .test_data = &hmac_md5_test_vector,
349 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
350 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
351 BLOCKCIPHER_TEST_TARGET_PMD_MB |
352 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
353 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
354 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
355 BLOCKCIPHER_TEST_TARGET_PMD_QAT
358 .test_descr = "SHA1 Digest",
359 .test_data = &sha1_test_vector,
360 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
361 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
364 .test_descr = "SHA1 Digest Verify",
365 .test_data = &sha1_test_vector,
366 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
367 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
370 .test_descr = "HMAC-SHA1 Digest",
371 .test_data = &hmac_sha1_test_vector,
372 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
373 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
374 BLOCKCIPHER_TEST_TARGET_PMD_MB |
375 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
376 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
377 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
378 BLOCKCIPHER_TEST_TARGET_PMD_QAT
381 .test_descr = "HMAC-SHA1 Digest Verify",
382 .test_data = &hmac_sha1_test_vector,
383 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
384 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
385 BLOCKCIPHER_TEST_TARGET_PMD_MB |
386 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
387 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
388 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
389 BLOCKCIPHER_TEST_TARGET_PMD_QAT
392 .test_descr = "SHA224 Digest",
393 .test_data = &sha224_test_vector,
394 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
395 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
398 .test_descr = "SHA224 Digest Verify",
399 .test_data = &sha224_test_vector,
400 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
401 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
404 .test_descr = "HMAC-SHA224 Digest",
405 .test_data = &hmac_sha224_test_vector,
406 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
407 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
408 BLOCKCIPHER_TEST_TARGET_PMD_MB |
409 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
410 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
411 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
412 BLOCKCIPHER_TEST_TARGET_PMD_QAT
415 .test_descr = "HMAC-SHA224 Digest Verify",
416 .test_data = &hmac_sha224_test_vector,
417 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
418 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
419 BLOCKCIPHER_TEST_TARGET_PMD_MB |
420 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
421 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
422 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
423 BLOCKCIPHER_TEST_TARGET_PMD_QAT
426 .test_descr = "SHA256 Digest",
427 .test_data = &sha256_test_vector,
428 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
429 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
432 .test_descr = "SHA256 Digest Verify",
433 .test_data = &sha256_test_vector,
434 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
435 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
438 .test_descr = "HMAC-SHA256 Digest",
439 .test_data = &hmac_sha256_test_vector,
440 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
441 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
442 BLOCKCIPHER_TEST_TARGET_PMD_MB |
443 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
444 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
445 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
446 BLOCKCIPHER_TEST_TARGET_PMD_QAT
449 .test_descr = "HMAC-SHA256 Digest Verify",
450 .test_data = &hmac_sha256_test_vector,
451 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
452 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
453 BLOCKCIPHER_TEST_TARGET_PMD_MB |
454 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
455 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
456 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
457 BLOCKCIPHER_TEST_TARGET_PMD_QAT
460 .test_descr = "SHA384 Digest",
461 .test_data = &sha384_test_vector,
462 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
463 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
466 .test_descr = "SHA384 Digest Verify",
467 .test_data = &sha384_test_vector,
468 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
469 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
472 .test_descr = "HMAC-SHA384 Digest",
473 .test_data = &hmac_sha384_test_vector,
474 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
475 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
476 BLOCKCIPHER_TEST_TARGET_PMD_MB |
477 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
478 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
479 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
480 BLOCKCIPHER_TEST_TARGET_PMD_QAT
483 .test_descr = "HMAC-SHA384 Digest Verify",
484 .test_data = &hmac_sha384_test_vector,
485 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
486 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
487 BLOCKCIPHER_TEST_TARGET_PMD_MB |
488 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
489 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
490 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
491 BLOCKCIPHER_TEST_TARGET_PMD_QAT
494 .test_descr = "SHA512 Digest",
495 .test_data = &sha512_test_vector,
496 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
497 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
500 .test_descr = "SHA512 Digest Verify",
501 .test_data = &sha512_test_vector,
502 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
503 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
506 .test_descr = "HMAC-SHA512 Digest",
507 .test_data = &hmac_sha512_test_vector,
508 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
509 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
510 BLOCKCIPHER_TEST_TARGET_PMD_MB |
511 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
512 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
513 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
514 BLOCKCIPHER_TEST_TARGET_PMD_QAT
517 .test_descr = "HMAC-SHA512 Digest Verify",
518 .test_data = &hmac_sha512_test_vector,
519 .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
520 .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
521 BLOCKCIPHER_TEST_TARGET_PMD_MB |
522 BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
523 BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
524 BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
525 BLOCKCIPHER_TEST_TARGET_PMD_QAT
529 #endif /* TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ */