1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2017 Intel Corporation
5 #include <rte_common.h>
6 #include <rte_hexdump.h>
8 #include <rte_malloc.h>
9 #include <rte_memcpy.h>
10 #include <rte_pause.h>
12 #include <rte_crypto.h>
13 #include <rte_cryptodev.h>
14 #include <rte_cryptodev_pmd.h>
17 #include "test_cryptodev.h"
18 #include "test_cryptodev_blockcipher.h"
19 #include "test_cryptodev_aes_test_vectors.h"
20 #include "test_cryptodev_des_test_vectors.h"
21 #include "test_cryptodev_hash_test_vectors.h"
24 test_blockcipher_one_case(const struct blockcipher_test_case *t,
25 struct rte_mempool *mbuf_pool,
26 struct rte_mempool *op_mpool,
27 struct rte_mempool *sess_mpool,
32 struct rte_mbuf *ibuf = NULL;
33 struct rte_mbuf *obuf = NULL;
34 struct rte_mbuf *iobuf;
35 struct rte_crypto_sym_xform *cipher_xform = NULL;
36 struct rte_crypto_sym_xform *auth_xform = NULL;
37 struct rte_crypto_sym_xform *init_xform = NULL;
38 struct rte_crypto_sym_op *sym_op = NULL;
39 struct rte_crypto_op *op = NULL;
40 struct rte_cryptodev_info dev_info;
41 struct rte_cryptodev_sym_session *sess = NULL;
43 int status = TEST_SUCCESS;
44 const struct blockcipher_test_data *tdata = t->test_data;
45 uint8_t cipher_key[tdata->cipher_key.len];
46 uint8_t auth_key[tdata->auth_key.len];
47 uint32_t buf_len = tdata->ciphertext.len;
48 uint32_t digest_len = 0;
50 uint8_t src_pattern = 0xa5;
51 uint8_t dst_pattern = 0xb6;
52 uint8_t tmp_src_buf[MBUF_SIZE];
53 uint8_t tmp_dst_buf[MBUF_SIZE];
55 int openssl_pmd = rte_cryptodev_driver_id_get(
56 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
57 int ccp_pmd = rte_cryptodev_driver_id_get(
58 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
59 int scheduler_pmd = rte_cryptodev_driver_id_get(
60 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
61 int armv8_pmd = rte_cryptodev_driver_id_get(
62 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
63 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
64 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
65 int qat_pmd = rte_cryptodev_driver_id_get(
66 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
67 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
68 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
69 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
70 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
71 int mrvl_pmd = rte_cryptodev_driver_id_get(
72 RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
76 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
77 rte_cryptodev_info_get(dev_id, &dev_info);
78 if (!(dev_info.feature_flags &
79 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
80 printf("Device doesn't support scatter-gather. "
87 if (tdata->cipher_key.len)
88 memcpy(cipher_key, tdata->cipher_key.data,
89 tdata->cipher_key.len);
90 if (tdata->auth_key.len)
91 memcpy(auth_key, tdata->auth_key.data,
94 if (driver_id == dpaa2_sec_pmd ||
95 driver_id == dpaa_sec_pmd ||
96 driver_id == qat_pmd ||
97 driver_id == openssl_pmd ||
98 driver_id == armv8_pmd ||
99 driver_id == mrvl_pmd ||
100 driver_id == ccp_pmd) { /* Fall through */
101 digest_len = tdata->digest.len;
102 } else if (driver_id == aesni_mb_pmd ||
103 driver_id == scheduler_pmd) {
104 digest_len = tdata->digest.truncated_len;
106 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
107 "line %u FAILED: %s",
108 __LINE__, "Unsupported PMD type");
109 status = TEST_FAILED;
114 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
115 buf_len += digest_len;
117 /* for contiguous mbuf, nb_segs is 1 */
118 ibuf = create_segmented_mbuf(mbuf_pool,
119 tdata->ciphertext.len, nb_segs, src_pattern);
121 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
122 "line %u FAILED: %s",
123 __LINE__, "Cannot create source mbuf");
124 status = TEST_FAILED;
128 /* only encryption requires plaintext.data input,
129 * decryption/(digest gen)/(digest verify) use ciphertext.data
132 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
133 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
134 tdata->plaintext.data);
136 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
137 tdata->ciphertext.data);
139 buf_p = rte_pktmbuf_append(ibuf, digest_len);
140 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
141 rte_memcpy(buf_p, tdata->digest.data, digest_len);
143 memset(buf_p, 0, digest_len);
145 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
146 obuf = rte_pktmbuf_alloc(mbuf_pool);
148 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
149 "FAILED: %s", __LINE__,
150 "Allocation of rte_mbuf failed");
151 status = TEST_FAILED;
154 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
156 buf_p = rte_pktmbuf_append(obuf, buf_len);
158 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
159 "FAILED: %s", __LINE__,
160 "No room to append mbuf");
161 status = TEST_FAILED;
164 memset(buf_p, 0, buf_len);
167 /* Generate Crypto op data structure */
168 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
170 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
171 "line %u FAILED: %s",
172 __LINE__, "Failed to allocate symmetric crypto "
174 status = TEST_FAILED;
180 sym_op->m_src = ibuf;
182 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
183 sym_op->m_dst = obuf;
186 sym_op->m_dst = NULL;
190 /* sessionless op requires allocate xform using
191 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
194 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
195 uint32_t n_xforms = 0;
197 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
199 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
202 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
204 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
205 "FAILED: %s", __LINE__, "Failed to "
206 "allocate space for crypto transforms");
207 status = TEST_FAILED;
211 cipher_xform = rte_zmalloc(NULL,
212 sizeof(struct rte_crypto_sym_xform), 0);
214 auth_xform = rte_zmalloc(NULL,
215 sizeof(struct rte_crypto_sym_xform), 0);
217 if (!cipher_xform || !auth_xform) {
218 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
219 "FAILED: %s", __LINE__, "Failed to "
220 "allocate memory for crypto transforms");
221 status = TEST_FAILED;
226 /* preparing xform, for sessioned op, init_xform is initialized
227 * here and later as param in rte_cryptodev_sym_session_create() call
229 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
230 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
231 cipher_xform = op->sym->xform;
232 auth_xform = cipher_xform->next;
233 auth_xform->next = NULL;
235 cipher_xform->next = auth_xform;
236 auth_xform->next = NULL;
237 init_xform = cipher_xform;
239 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
240 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
241 auth_xform = op->sym->xform;
242 cipher_xform = auth_xform->next;
243 cipher_xform->next = NULL;
245 auth_xform->next = cipher_xform;
246 cipher_xform->next = NULL;
247 init_xform = auth_xform;
249 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
250 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
251 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
252 cipher_xform = op->sym->xform;
254 init_xform = cipher_xform;
255 cipher_xform->next = NULL;
256 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
257 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
258 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
259 auth_xform = op->sym->xform;
261 init_xform = auth_xform;
262 auth_xform->next = NULL;
264 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
265 "line %u FAILED: %s",
266 __LINE__, "Unrecognized operation");
267 status = TEST_FAILED;
271 /*configure xforms & sym_op cipher and auth data*/
272 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
273 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
274 cipher_xform->cipher.algo = tdata->crypto_algo;
275 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
276 cipher_xform->cipher.op =
277 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
279 cipher_xform->cipher.op =
280 RTE_CRYPTO_CIPHER_OP_DECRYPT;
281 cipher_xform->cipher.key.data = cipher_key;
282 cipher_xform->cipher.key.length = tdata->cipher_key.len;
283 cipher_xform->cipher.iv.offset = IV_OFFSET;
284 cipher_xform->cipher.iv.length = tdata->iv.len;
286 sym_op->cipher.data.offset = 0;
287 sym_op->cipher.data.length = tdata->ciphertext.len;
288 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
293 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
294 uint32_t digest_offset = tdata->ciphertext.len;
296 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
297 auth_xform->auth.algo = tdata->auth_algo;
298 auth_xform->auth.key.length = tdata->auth_key.len;
299 auth_xform->auth.key.data = auth_key;
300 auth_xform->auth.digest_length = digest_len;
302 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
303 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
304 sym_op->auth.digest.data = pktmbuf_mtod_offset
305 (iobuf, digest_offset);
306 sym_op->auth.digest.phys_addr =
307 pktmbuf_iova_offset(iobuf,
310 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
311 sym_op->auth.digest.data = pktmbuf_mtod_offset
312 (sym_op->m_src, digest_offset);
313 sym_op->auth.digest.phys_addr =
314 pktmbuf_iova_offset(sym_op->m_src,
318 sym_op->auth.data.offset = 0;
319 sym_op->auth.data.length = tdata->ciphertext.len;
322 /* create session for sessioned op */
323 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
324 sess = rte_cryptodev_sym_session_create(sess_mpool);
326 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
329 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
330 "FAILED: %s", __LINE__,
331 "Session creation failed");
332 status = TEST_FAILED;
336 /* attach symmetric crypto session to crypto operations */
337 rte_crypto_op_attach_sym_session(op, sess);
340 debug_hexdump(stdout, "m_src(before):",
341 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
342 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
343 sym_op->m_src->buf_len);
344 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
345 debug_hexdump(stdout, "m_dst(before):",
346 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
347 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
348 sym_op->m_dst->buf_len);
351 /* Process crypto operation */
352 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
353 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
354 "line %u FAILED: %s",
355 __LINE__, "Error sending packet for encryption");
356 status = TEST_FAILED;
362 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
366 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
367 "line %u FAILED: %s",
368 __LINE__, "Failed to process sym crypto op");
369 status = TEST_FAILED;
373 debug_hexdump(stdout, "m_src(after):",
374 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
375 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
376 debug_hexdump(stdout, "m_dst(after):",
377 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
380 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
381 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
382 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
383 "FAILED: Digest verification failed "
384 "(0x%X)", __LINE__, op->status);
386 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
387 "FAILED: Digest verification failed "
388 "(0x%X)", __LINE__, op->status);
389 status = TEST_FAILED;
393 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
394 uint8_t buffer[2048];
395 const uint8_t *compare_ref;
396 uint32_t compare_len;
398 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
399 compare_ref = tdata->ciphertext.data;
400 compare_len = tdata->ciphertext.len;
402 compare_ref = tdata->plaintext.data;
403 compare_len = tdata->plaintext.len;
406 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
407 buffer), compare_ref, compare_len)) {
408 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
409 "FAILED: %s", __LINE__,
410 "Crypto data not as expected");
411 status = TEST_FAILED;
416 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
417 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
418 tdata->ciphertext.len);
420 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
421 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
422 "FAILED: %s", __LINE__, "Generated "
423 "digest data not as expected");
424 status = TEST_FAILED;
429 /* The only parts that should have changed in the buffer are
430 * plaintext/ciphertext and digest.
431 * In OOP only the dest buffer should change.
433 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
434 struct rte_mbuf *mbuf;
436 uint32_t head_unchanged_len, changed_len = 0;
439 mbuf = sym_op->m_src;
440 head_unchanged_len = mbuf->buf_len;
442 for (i = 0; i < mbuf->buf_len; i++) {
443 value = *((uint8_t *)(mbuf->buf_addr)+i);
444 if (value != tmp_src_buf[i]) {
445 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
446 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
447 __LINE__, value, tmp_src_buf[i]);
448 status = TEST_FAILED;
453 mbuf = sym_op->m_dst;
454 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
455 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
456 sym_op->auth.data.offset;
457 changed_len = sym_op->auth.data.length;
458 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
459 changed_len += digest_len;
462 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
463 sym_op->cipher.data.offset;
464 changed_len = sym_op->cipher.data.length;
467 for (i = 0; i < mbuf->buf_len; i++) {
468 if (i == head_unchanged_len)
470 value = *((uint8_t *)(mbuf->buf_addr)+i);
471 if (value != tmp_dst_buf[i]) {
472 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
473 "line %u FAILED: OOP dst outer mbuf data "
474 "(0x%x) not as expected (0x%x)",
475 __LINE__, value, tmp_dst_buf[i]);
476 status = TEST_FAILED;
481 /* In-place operation */
482 struct rte_mbuf *mbuf;
484 uint32_t head_unchanged_len = 0, changed_len = 0;
487 mbuf = sym_op->m_src;
488 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
489 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
490 sym_op->cipher.data.offset;
491 changed_len = sym_op->cipher.data.length;
494 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
495 sym_op->auth.data.offset +
496 sym_op->auth.data.length;
500 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
501 changed_len += digest_len;
503 for (i = 0; i < mbuf->buf_len; i++) {
504 if (i == head_unchanged_len)
506 value = *((uint8_t *)(mbuf->buf_addr)+i);
507 if (value != tmp_src_buf[i]) {
508 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
509 "line %u FAILED: outer mbuf data (0x%x) "
510 "not as expected (0x%x)",
511 __LINE__, value, tmp_src_buf[i]);
512 status = TEST_FAILED;
518 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
521 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
523 rte_cryptodev_sym_session_clear(dev_id, sess);
524 rte_cryptodev_sym_session_free(sess);
527 rte_free(cipher_xform);
529 rte_free(auth_xform);
533 rte_crypto_op_free(op);
536 rte_pktmbuf_free(obuf);
539 rte_pktmbuf_free(ibuf);
545 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
546 struct rte_mempool *op_mpool,
547 struct rte_mempool *sess_mpool,
550 enum blockcipher_test_type test_type)
552 int status, overall_status = TEST_SUCCESS;
553 uint32_t i, test_index = 0;
554 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
555 uint32_t n_test_cases = 0;
556 uint32_t target_pmd_mask = 0;
557 const struct blockcipher_test_case *tcs = NULL;
559 int openssl_pmd = rte_cryptodev_driver_id_get(
560 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
561 int ccp_pmd = rte_cryptodev_driver_id_get(
562 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
563 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
564 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
565 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
566 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
567 int scheduler_pmd = rte_cryptodev_driver_id_get(
568 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
569 int armv8_pmd = rte_cryptodev_driver_id_get(
570 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
571 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
572 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
573 int qat_pmd = rte_cryptodev_driver_id_get(
574 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
575 int mrvl_pmd = rte_cryptodev_driver_id_get(
576 RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
579 case BLKCIPHER_AES_CHAIN_TYPE:
580 n_test_cases = sizeof(aes_chain_test_cases) /
581 sizeof(aes_chain_test_cases[0]);
582 tcs = aes_chain_test_cases;
584 case BLKCIPHER_AES_CIPHERONLY_TYPE:
585 n_test_cases = sizeof(aes_cipheronly_test_cases) /
586 sizeof(aes_cipheronly_test_cases[0]);
587 tcs = aes_cipheronly_test_cases;
589 case BLKCIPHER_AES_DOCSIS_TYPE:
590 n_test_cases = sizeof(aes_docsis_test_cases) /
591 sizeof(aes_docsis_test_cases[0]);
592 tcs = aes_docsis_test_cases;
594 case BLKCIPHER_3DES_CHAIN_TYPE:
595 n_test_cases = sizeof(triple_des_chain_test_cases) /
596 sizeof(triple_des_chain_test_cases[0]);
597 tcs = triple_des_chain_test_cases;
599 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
600 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
601 sizeof(triple_des_cipheronly_test_cases[0]);
602 tcs = triple_des_cipheronly_test_cases;
604 case BLKCIPHER_DES_CIPHERONLY_TYPE:
605 n_test_cases = sizeof(des_cipheronly_test_cases) /
606 sizeof(des_cipheronly_test_cases[0]);
607 tcs = des_cipheronly_test_cases;
609 case BLKCIPHER_DES_DOCSIS_TYPE:
610 n_test_cases = sizeof(des_docsis_test_cases) /
611 sizeof(des_docsis_test_cases[0]);
612 tcs = des_docsis_test_cases;
614 case BLKCIPHER_AUTHONLY_TYPE:
615 n_test_cases = sizeof(hash_test_cases) /
616 sizeof(hash_test_cases[0]);
617 tcs = hash_test_cases;
623 if (driver_id == aesni_mb_pmd)
624 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
625 else if (driver_id == qat_pmd)
626 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
627 else if (driver_id == openssl_pmd)
628 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
629 else if (driver_id == armv8_pmd)
630 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
631 else if (driver_id == scheduler_pmd)
632 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
633 else if (driver_id == dpaa2_sec_pmd)
634 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
635 else if (driver_id == ccp_pmd)
636 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_CCP;
637 else if (driver_id == dpaa_sec_pmd)
638 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
639 else if (driver_id == mrvl_pmd)
640 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MRVL;
642 TEST_ASSERT(0, "Unrecognized cryptodev type");
644 for (i = 0; i < n_test_cases; i++) {
645 const struct blockcipher_test_case *tc = &tcs[i];
647 if (!(tc->pmd_mask & target_pmd_mask))
650 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
651 sess_mpool, dev_id, driver_id, test_msg);
653 printf(" %u) TestCase %s %s\n", test_index ++,
654 tc->test_descr, test_msg);
656 if (status != TEST_SUCCESS) {
657 if (overall_status == TEST_SUCCESS)
658 overall_status = status;
660 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
665 return overall_status;