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_MVSAM_PMD));
73 int virtio_pmd = rte_cryptodev_driver_id_get(
74 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
78 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
79 rte_cryptodev_info_get(dev_id, &dev_info);
80 if (!(dev_info.feature_flags &
81 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
82 printf("Device doesn't support scatter-gather. "
89 if (tdata->cipher_key.len)
90 memcpy(cipher_key, tdata->cipher_key.data,
91 tdata->cipher_key.len);
92 if (tdata->auth_key.len)
93 memcpy(auth_key, tdata->auth_key.data,
96 if (driver_id == dpaa2_sec_pmd ||
97 driver_id == dpaa_sec_pmd ||
98 driver_id == qat_pmd ||
99 driver_id == openssl_pmd ||
100 driver_id == armv8_pmd ||
101 driver_id == mrvl_pmd ||
102 driver_id == ccp_pmd ||
103 driver_id == virtio_pmd) { /* Fall through */
104 digest_len = tdata->digest.len;
105 } else if (driver_id == aesni_mb_pmd ||
106 driver_id == scheduler_pmd) {
107 digest_len = tdata->digest.truncated_len;
109 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
110 "line %u FAILED: %s",
111 __LINE__, "Unsupported PMD type");
112 status = TEST_FAILED;
117 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
118 buf_len += digest_len;
120 /* for contiguous mbuf, nb_segs is 1 */
121 ibuf = create_segmented_mbuf(mbuf_pool,
122 tdata->ciphertext.len, nb_segs, src_pattern);
124 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
125 "line %u FAILED: %s",
126 __LINE__, "Cannot create source mbuf");
127 status = TEST_FAILED;
131 /* only encryption requires plaintext.data input,
132 * decryption/(digest gen)/(digest verify) use ciphertext.data
135 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
136 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
137 tdata->plaintext.data);
139 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
140 tdata->ciphertext.data);
142 buf_p = rte_pktmbuf_append(ibuf, digest_len);
143 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
144 rte_memcpy(buf_p, tdata->digest.data, digest_len);
146 memset(buf_p, 0, digest_len);
148 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
149 obuf = rte_pktmbuf_alloc(mbuf_pool);
151 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
152 "FAILED: %s", __LINE__,
153 "Allocation of rte_mbuf failed");
154 status = TEST_FAILED;
157 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
159 buf_p = rte_pktmbuf_append(obuf, buf_len);
161 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
162 "FAILED: %s", __LINE__,
163 "No room to append mbuf");
164 status = TEST_FAILED;
167 memset(buf_p, 0, buf_len);
170 /* Generate Crypto op data structure */
171 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
173 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
174 "line %u FAILED: %s",
175 __LINE__, "Failed to allocate symmetric crypto "
177 status = TEST_FAILED;
183 sym_op->m_src = ibuf;
185 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
186 sym_op->m_dst = obuf;
189 sym_op->m_dst = NULL;
193 /* sessionless op requires allocate xform using
194 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
197 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
198 uint32_t n_xforms = 0;
200 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
202 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
205 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
207 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
208 "FAILED: %s", __LINE__, "Failed to "
209 "allocate space for crypto transforms");
210 status = TEST_FAILED;
214 cipher_xform = rte_zmalloc(NULL,
215 sizeof(struct rte_crypto_sym_xform), 0);
217 auth_xform = rte_zmalloc(NULL,
218 sizeof(struct rte_crypto_sym_xform), 0);
220 if (!cipher_xform || !auth_xform) {
221 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
222 "FAILED: %s", __LINE__, "Failed to "
223 "allocate memory for crypto transforms");
224 status = TEST_FAILED;
229 /* preparing xform, for sessioned op, init_xform is initialized
230 * here and later as param in rte_cryptodev_sym_session_create() call
232 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
233 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
234 cipher_xform = op->sym->xform;
235 auth_xform = cipher_xform->next;
236 auth_xform->next = NULL;
238 cipher_xform->next = auth_xform;
239 auth_xform->next = NULL;
240 init_xform = cipher_xform;
242 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
243 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
244 auth_xform = op->sym->xform;
245 cipher_xform = auth_xform->next;
246 cipher_xform->next = NULL;
248 auth_xform->next = cipher_xform;
249 cipher_xform->next = NULL;
250 init_xform = auth_xform;
252 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
253 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
254 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
255 cipher_xform = op->sym->xform;
257 init_xform = cipher_xform;
258 cipher_xform->next = NULL;
259 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
260 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
261 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
262 auth_xform = op->sym->xform;
264 init_xform = auth_xform;
265 auth_xform->next = NULL;
267 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
268 "line %u FAILED: %s",
269 __LINE__, "Unrecognized operation");
270 status = TEST_FAILED;
274 /*configure xforms & sym_op cipher and auth data*/
275 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
276 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
277 cipher_xform->cipher.algo = tdata->crypto_algo;
278 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
279 cipher_xform->cipher.op =
280 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
282 cipher_xform->cipher.op =
283 RTE_CRYPTO_CIPHER_OP_DECRYPT;
284 cipher_xform->cipher.key.data = cipher_key;
285 cipher_xform->cipher.key.length = tdata->cipher_key.len;
286 cipher_xform->cipher.iv.offset = IV_OFFSET;
287 cipher_xform->cipher.iv.length = tdata->iv.len;
289 sym_op->cipher.data.offset = 0;
290 sym_op->cipher.data.length = tdata->ciphertext.len;
291 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
296 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
297 uint32_t digest_offset = tdata->ciphertext.len;
299 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
300 auth_xform->auth.algo = tdata->auth_algo;
301 auth_xform->auth.key.length = tdata->auth_key.len;
302 auth_xform->auth.key.data = auth_key;
303 auth_xform->auth.digest_length = digest_len;
305 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
306 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
307 sym_op->auth.digest.data = pktmbuf_mtod_offset
308 (iobuf, digest_offset);
309 sym_op->auth.digest.phys_addr =
310 pktmbuf_iova_offset(iobuf,
313 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
314 sym_op->auth.digest.data = pktmbuf_mtod_offset
315 (sym_op->m_src, digest_offset);
316 sym_op->auth.digest.phys_addr =
317 pktmbuf_iova_offset(sym_op->m_src,
321 sym_op->auth.data.offset = 0;
322 sym_op->auth.data.length = tdata->ciphertext.len;
325 /* create session for sessioned op */
326 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
327 sess = rte_cryptodev_sym_session_create(sess_mpool);
329 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
332 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
333 "FAILED: %s", __LINE__,
334 "Session creation failed");
335 status = TEST_FAILED;
339 /* attach symmetric crypto session to crypto operations */
340 rte_crypto_op_attach_sym_session(op, sess);
343 debug_hexdump(stdout, "m_src(before):",
344 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
345 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
346 sym_op->m_src->buf_len);
347 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
348 debug_hexdump(stdout, "m_dst(before):",
349 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
350 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
351 sym_op->m_dst->buf_len);
354 /* Process crypto operation */
355 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
356 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
357 "line %u FAILED: %s",
358 __LINE__, "Error sending packet for encryption");
359 status = TEST_FAILED;
365 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
369 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
370 "line %u FAILED: %s",
371 __LINE__, "Failed to process sym crypto op");
372 status = TEST_FAILED;
376 debug_hexdump(stdout, "m_src(after):",
377 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
378 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
379 debug_hexdump(stdout, "m_dst(after):",
380 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
383 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
384 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
385 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
386 "FAILED: Digest verification failed "
387 "(0x%X)", __LINE__, op->status);
389 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
390 "FAILED: Digest verification failed "
391 "(0x%X)", __LINE__, op->status);
392 status = TEST_FAILED;
396 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
397 uint8_t buffer[2048];
398 const uint8_t *compare_ref;
399 uint32_t compare_len;
401 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
402 compare_ref = tdata->ciphertext.data;
403 compare_len = tdata->ciphertext.len;
405 compare_ref = tdata->plaintext.data;
406 compare_len = tdata->plaintext.len;
409 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
410 buffer), compare_ref, compare_len)) {
411 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
412 "FAILED: %s", __LINE__,
413 "Crypto data not as expected");
414 status = TEST_FAILED;
419 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
420 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
421 tdata->ciphertext.len);
423 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
424 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
425 "FAILED: %s", __LINE__, "Generated "
426 "digest data not as expected");
427 status = TEST_FAILED;
432 /* The only parts that should have changed in the buffer are
433 * plaintext/ciphertext and digest.
434 * In OOP only the dest buffer should change.
436 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
437 struct rte_mbuf *mbuf;
439 uint32_t head_unchanged_len, changed_len = 0;
442 mbuf = sym_op->m_src;
443 head_unchanged_len = mbuf->buf_len;
445 for (i = 0; i < mbuf->buf_len; i++) {
446 value = *((uint8_t *)(mbuf->buf_addr)+i);
447 if (value != tmp_src_buf[i]) {
448 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
449 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
450 __LINE__, value, tmp_src_buf[i]);
451 status = TEST_FAILED;
456 mbuf = sym_op->m_dst;
457 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
458 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
459 sym_op->auth.data.offset;
460 changed_len = sym_op->auth.data.length;
461 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
462 changed_len += digest_len;
465 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
466 sym_op->cipher.data.offset;
467 changed_len = sym_op->cipher.data.length;
470 for (i = 0; i < mbuf->buf_len; i++) {
471 if (i == head_unchanged_len)
473 value = *((uint8_t *)(mbuf->buf_addr)+i);
474 if (value != tmp_dst_buf[i]) {
475 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
476 "line %u FAILED: OOP dst outer mbuf data "
477 "(0x%x) not as expected (0x%x)",
478 __LINE__, value, tmp_dst_buf[i]);
479 status = TEST_FAILED;
484 /* In-place operation */
485 struct rte_mbuf *mbuf;
487 uint32_t head_unchanged_len = 0, changed_len = 0;
490 mbuf = sym_op->m_src;
491 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
492 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
493 sym_op->cipher.data.offset;
494 changed_len = sym_op->cipher.data.length;
497 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
498 sym_op->auth.data.offset +
499 sym_op->auth.data.length;
503 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
504 changed_len += digest_len;
506 for (i = 0; i < mbuf->buf_len; i++) {
507 if (i == head_unchanged_len)
509 value = *((uint8_t *)(mbuf->buf_addr)+i);
510 if (value != tmp_src_buf[i]) {
511 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
512 "line %u FAILED: outer mbuf data (0x%x) "
513 "not as expected (0x%x)",
514 __LINE__, value, tmp_src_buf[i]);
515 status = TEST_FAILED;
521 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
524 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
526 rte_cryptodev_sym_session_clear(dev_id, sess);
527 rte_cryptodev_sym_session_free(sess);
530 rte_free(cipher_xform);
532 rte_free(auth_xform);
536 rte_crypto_op_free(op);
539 rte_pktmbuf_free(obuf);
542 rte_pktmbuf_free(ibuf);
548 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
549 struct rte_mempool *op_mpool,
550 struct rte_mempool *sess_mpool,
553 enum blockcipher_test_type test_type)
555 int status, overall_status = TEST_SUCCESS;
556 uint32_t i, test_index = 0;
557 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
558 uint32_t n_test_cases = 0;
559 uint32_t target_pmd_mask = 0;
560 const struct blockcipher_test_case *tcs = NULL;
562 int openssl_pmd = rte_cryptodev_driver_id_get(
563 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
564 int ccp_pmd = rte_cryptodev_driver_id_get(
565 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
566 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
567 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
568 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
569 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
570 int scheduler_pmd = rte_cryptodev_driver_id_get(
571 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
572 int armv8_pmd = rte_cryptodev_driver_id_get(
573 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
574 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
575 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
576 int qat_pmd = rte_cryptodev_driver_id_get(
577 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
578 int mrvl_pmd = rte_cryptodev_driver_id_get(
579 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
580 int virtio_pmd = rte_cryptodev_driver_id_get(
581 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
584 case BLKCIPHER_AES_CHAIN_TYPE:
585 n_test_cases = sizeof(aes_chain_test_cases) /
586 sizeof(aes_chain_test_cases[0]);
587 tcs = aes_chain_test_cases;
589 case BLKCIPHER_AES_CIPHERONLY_TYPE:
590 n_test_cases = sizeof(aes_cipheronly_test_cases) /
591 sizeof(aes_cipheronly_test_cases[0]);
592 tcs = aes_cipheronly_test_cases;
594 case BLKCIPHER_AES_DOCSIS_TYPE:
595 n_test_cases = sizeof(aes_docsis_test_cases) /
596 sizeof(aes_docsis_test_cases[0]);
597 tcs = aes_docsis_test_cases;
599 case BLKCIPHER_3DES_CHAIN_TYPE:
600 n_test_cases = sizeof(triple_des_chain_test_cases) /
601 sizeof(triple_des_chain_test_cases[0]);
602 tcs = triple_des_chain_test_cases;
604 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
605 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
606 sizeof(triple_des_cipheronly_test_cases[0]);
607 tcs = triple_des_cipheronly_test_cases;
609 case BLKCIPHER_DES_CIPHERONLY_TYPE:
610 n_test_cases = sizeof(des_cipheronly_test_cases) /
611 sizeof(des_cipheronly_test_cases[0]);
612 tcs = des_cipheronly_test_cases;
614 case BLKCIPHER_DES_DOCSIS_TYPE:
615 n_test_cases = sizeof(des_docsis_test_cases) /
616 sizeof(des_docsis_test_cases[0]);
617 tcs = des_docsis_test_cases;
619 case BLKCIPHER_AUTHONLY_TYPE:
620 n_test_cases = sizeof(hash_test_cases) /
621 sizeof(hash_test_cases[0]);
622 tcs = hash_test_cases;
628 if (driver_id == aesni_mb_pmd)
629 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
630 else if (driver_id == qat_pmd)
631 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
632 else if (driver_id == openssl_pmd)
633 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
634 else if (driver_id == armv8_pmd)
635 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
636 else if (driver_id == scheduler_pmd)
637 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
638 else if (driver_id == dpaa2_sec_pmd)
639 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
640 else if (driver_id == ccp_pmd)
641 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_CCP;
642 else if (driver_id == dpaa_sec_pmd)
643 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
644 else if (driver_id == mrvl_pmd)
645 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MVSAM;
646 else if (driver_id == virtio_pmd)
647 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
649 TEST_ASSERT(0, "Unrecognized cryptodev type");
651 for (i = 0; i < n_test_cases; i++) {
652 const struct blockcipher_test_case *tc = &tcs[i];
654 if (!(tc->pmd_mask & target_pmd_mask))
657 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
658 sess_mpool, dev_id, driver_id, test_msg);
660 printf(" %u) TestCase %s %s\n", test_index ++,
661 tc->test_descr, test_msg);
663 if (status != TEST_SUCCESS) {
664 if (overall_status == TEST_SUCCESS)
665 overall_status = status;
667 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
672 return overall_status;