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 uint64_t feat_flags = dev_info.feature_flags;
81 uint64_t oop_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT;
83 if (t->feature_mask && BLOCKCIPHER_TEST_FEATURE_OOP) {
84 if (!(feat_flags & oop_flag)) {
85 printf("Device doesn't support out-of-place "
86 "scatter-gather in input mbuf. "
91 if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
92 printf("Device doesn't support in-place "
93 "scatter-gather mbufs. "
102 if (tdata->cipher_key.len)
103 memcpy(cipher_key, tdata->cipher_key.data,
104 tdata->cipher_key.len);
105 if (tdata->auth_key.len)
106 memcpy(auth_key, tdata->auth_key.data,
107 tdata->auth_key.len);
109 if (driver_id == dpaa2_sec_pmd ||
110 driver_id == dpaa_sec_pmd ||
111 driver_id == qat_pmd ||
112 driver_id == openssl_pmd ||
113 driver_id == armv8_pmd ||
114 driver_id == mrvl_pmd ||
115 driver_id == ccp_pmd ||
116 driver_id == virtio_pmd) { /* Fall through */
117 digest_len = tdata->digest.len;
118 } else if (driver_id == aesni_mb_pmd ||
119 driver_id == scheduler_pmd) {
120 digest_len = tdata->digest.truncated_len;
122 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
123 "line %u FAILED: %s",
124 __LINE__, "Unsupported PMD type");
125 status = TEST_FAILED;
130 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
131 buf_len += digest_len;
133 /* for contiguous mbuf, nb_segs is 1 */
134 ibuf = create_segmented_mbuf(mbuf_pool,
135 tdata->ciphertext.len, nb_segs, src_pattern);
137 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
138 "line %u FAILED: %s",
139 __LINE__, "Cannot create source mbuf");
140 status = TEST_FAILED;
144 /* only encryption requires plaintext.data input,
145 * decryption/(digest gen)/(digest verify) use ciphertext.data
148 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
149 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
150 tdata->plaintext.data);
152 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
153 tdata->ciphertext.data);
155 buf_p = rte_pktmbuf_append(ibuf, digest_len);
156 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
157 rte_memcpy(buf_p, tdata->digest.data, digest_len);
159 memset(buf_p, 0, digest_len);
161 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
162 obuf = rte_pktmbuf_alloc(mbuf_pool);
164 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
165 "FAILED: %s", __LINE__,
166 "Allocation of rte_mbuf failed");
167 status = TEST_FAILED;
170 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
172 buf_p = rte_pktmbuf_append(obuf, buf_len);
174 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
175 "FAILED: %s", __LINE__,
176 "No room to append mbuf");
177 status = TEST_FAILED;
180 memset(buf_p, 0, buf_len);
183 /* Generate Crypto op data structure */
184 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
186 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
187 "line %u FAILED: %s",
188 __LINE__, "Failed to allocate symmetric crypto "
190 status = TEST_FAILED;
196 sym_op->m_src = ibuf;
198 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
199 sym_op->m_dst = obuf;
202 sym_op->m_dst = NULL;
206 /* sessionless op requires allocate xform using
207 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
210 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
211 uint32_t n_xforms = 0;
213 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
215 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
218 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
220 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
221 "FAILED: %s", __LINE__, "Failed to "
222 "allocate space for crypto transforms");
223 status = TEST_FAILED;
227 cipher_xform = rte_zmalloc(NULL,
228 sizeof(struct rte_crypto_sym_xform), 0);
230 auth_xform = rte_zmalloc(NULL,
231 sizeof(struct rte_crypto_sym_xform), 0);
233 if (!cipher_xform || !auth_xform) {
234 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
235 "FAILED: %s", __LINE__, "Failed to "
236 "allocate memory for crypto transforms");
237 status = TEST_FAILED;
242 /* preparing xform, for sessioned op, init_xform is initialized
243 * here and later as param in rte_cryptodev_sym_session_create() call
245 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
246 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
247 cipher_xform = op->sym->xform;
248 auth_xform = cipher_xform->next;
249 auth_xform->next = NULL;
251 cipher_xform->next = auth_xform;
252 auth_xform->next = NULL;
253 init_xform = cipher_xform;
255 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
256 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
257 auth_xform = op->sym->xform;
258 cipher_xform = auth_xform->next;
259 cipher_xform->next = NULL;
261 auth_xform->next = cipher_xform;
262 cipher_xform->next = NULL;
263 init_xform = auth_xform;
265 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
266 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
267 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
268 cipher_xform = op->sym->xform;
270 init_xform = cipher_xform;
271 cipher_xform->next = NULL;
272 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
273 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
274 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
275 auth_xform = op->sym->xform;
277 init_xform = auth_xform;
278 auth_xform->next = NULL;
280 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
281 "line %u FAILED: %s",
282 __LINE__, "Unrecognized operation");
283 status = TEST_FAILED;
287 /*configure xforms & sym_op cipher and auth data*/
288 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
289 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
290 cipher_xform->cipher.algo = tdata->crypto_algo;
291 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
292 cipher_xform->cipher.op =
293 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
295 cipher_xform->cipher.op =
296 RTE_CRYPTO_CIPHER_OP_DECRYPT;
297 cipher_xform->cipher.key.data = cipher_key;
298 cipher_xform->cipher.key.length = tdata->cipher_key.len;
299 cipher_xform->cipher.iv.offset = IV_OFFSET;
300 cipher_xform->cipher.iv.length = tdata->iv.len;
302 sym_op->cipher.data.offset = 0;
303 sym_op->cipher.data.length = tdata->ciphertext.len;
304 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
309 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
310 uint32_t digest_offset = tdata->ciphertext.len;
312 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
313 auth_xform->auth.algo = tdata->auth_algo;
314 auth_xform->auth.key.length = tdata->auth_key.len;
315 auth_xform->auth.key.data = auth_key;
316 auth_xform->auth.digest_length = digest_len;
318 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
319 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
320 sym_op->auth.digest.data = pktmbuf_mtod_offset
321 (iobuf, digest_offset);
322 sym_op->auth.digest.phys_addr =
323 pktmbuf_iova_offset(iobuf,
326 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
327 sym_op->auth.digest.data = pktmbuf_mtod_offset
328 (sym_op->m_src, digest_offset);
329 sym_op->auth.digest.phys_addr =
330 pktmbuf_iova_offset(sym_op->m_src,
334 sym_op->auth.data.offset = 0;
335 sym_op->auth.data.length = tdata->ciphertext.len;
338 /* create session for sessioned op */
339 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
340 sess = rte_cryptodev_sym_session_create(sess_mpool);
342 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
345 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
346 "FAILED: %s", __LINE__,
347 "Session creation failed");
348 status = TEST_FAILED;
352 /* attach symmetric crypto session to crypto operations */
353 rte_crypto_op_attach_sym_session(op, sess);
356 debug_hexdump(stdout, "m_src(before):",
357 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
358 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
359 sym_op->m_src->buf_len);
360 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
361 debug_hexdump(stdout, "m_dst(before):",
362 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
363 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
364 sym_op->m_dst->buf_len);
367 /* Process crypto operation */
368 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
369 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
370 "line %u FAILED: %s",
371 __LINE__, "Error sending packet for encryption");
372 status = TEST_FAILED;
378 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
382 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
383 "line %u FAILED: %s",
384 __LINE__, "Failed to process sym crypto op");
385 status = TEST_FAILED;
389 debug_hexdump(stdout, "m_src(after):",
390 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
391 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
392 debug_hexdump(stdout, "m_dst(after):",
393 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
396 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
397 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
398 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
399 "FAILED: Digest verification failed "
400 "(0x%X)", __LINE__, op->status);
402 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
403 "FAILED: Digest verification failed "
404 "(0x%X)", __LINE__, op->status);
405 status = TEST_FAILED;
409 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
410 uint8_t buffer[2048];
411 const uint8_t *compare_ref;
412 uint32_t compare_len;
414 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
415 compare_ref = tdata->ciphertext.data;
416 compare_len = tdata->ciphertext.len;
418 compare_ref = tdata->plaintext.data;
419 compare_len = tdata->plaintext.len;
422 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
423 buffer), compare_ref, compare_len)) {
424 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
425 "FAILED: %s", __LINE__,
426 "Crypto data not as expected");
427 status = TEST_FAILED;
432 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
433 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
434 tdata->ciphertext.len);
436 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
437 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
438 "FAILED: %s", __LINE__, "Generated "
439 "digest data not as expected");
440 status = TEST_FAILED;
445 /* The only parts that should have changed in the buffer are
446 * plaintext/ciphertext and digest.
447 * In OOP only the dest buffer should change.
449 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
450 struct rte_mbuf *mbuf;
452 uint32_t head_unchanged_len, changed_len = 0;
455 mbuf = sym_op->m_src;
456 head_unchanged_len = mbuf->buf_len;
458 for (i = 0; i < mbuf->buf_len; i++) {
459 value = *((uint8_t *)(mbuf->buf_addr)+i);
460 if (value != tmp_src_buf[i]) {
461 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
462 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
463 __LINE__, value, tmp_src_buf[i]);
464 status = TEST_FAILED;
469 mbuf = sym_op->m_dst;
470 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
471 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
472 sym_op->auth.data.offset;
473 changed_len = sym_op->auth.data.length;
474 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
475 changed_len += digest_len;
478 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
479 sym_op->cipher.data.offset;
480 changed_len = sym_op->cipher.data.length;
483 for (i = 0; i < mbuf->buf_len; i++) {
484 if (i == head_unchanged_len)
486 value = *((uint8_t *)(mbuf->buf_addr)+i);
487 if (value != tmp_dst_buf[i]) {
488 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
489 "line %u FAILED: OOP dst outer mbuf data "
490 "(0x%x) not as expected (0x%x)",
491 __LINE__, value, tmp_dst_buf[i]);
492 status = TEST_FAILED;
497 /* In-place operation */
498 struct rte_mbuf *mbuf;
500 uint32_t head_unchanged_len = 0, changed_len = 0;
503 mbuf = sym_op->m_src;
504 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
505 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
506 sym_op->cipher.data.offset;
507 changed_len = sym_op->cipher.data.length;
510 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
511 sym_op->auth.data.offset +
512 sym_op->auth.data.length;
516 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
517 changed_len += digest_len;
519 for (i = 0; i < mbuf->buf_len; i++) {
520 if (i == head_unchanged_len)
522 value = *((uint8_t *)(mbuf->buf_addr)+i);
523 if (value != tmp_src_buf[i]) {
524 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
525 "line %u FAILED: outer mbuf data (0x%x) "
526 "not as expected (0x%x)",
527 __LINE__, value, tmp_src_buf[i]);
528 status = TEST_FAILED;
534 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
537 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
539 rte_cryptodev_sym_session_clear(dev_id, sess);
540 rte_cryptodev_sym_session_free(sess);
543 rte_free(cipher_xform);
545 rte_free(auth_xform);
549 rte_crypto_op_free(op);
552 rte_pktmbuf_free(obuf);
555 rte_pktmbuf_free(ibuf);
561 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
562 struct rte_mempool *op_mpool,
563 struct rte_mempool *sess_mpool,
566 enum blockcipher_test_type test_type)
568 int status, overall_status = TEST_SUCCESS;
569 uint32_t i, test_index = 0;
570 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
571 uint32_t n_test_cases = 0;
572 uint32_t target_pmd_mask = 0;
573 const struct blockcipher_test_case *tcs = NULL;
575 int openssl_pmd = rte_cryptodev_driver_id_get(
576 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
577 int ccp_pmd = rte_cryptodev_driver_id_get(
578 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
579 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
580 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
581 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
582 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
583 int scheduler_pmd = rte_cryptodev_driver_id_get(
584 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
585 int armv8_pmd = rte_cryptodev_driver_id_get(
586 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
587 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
588 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
589 int qat_pmd = rte_cryptodev_driver_id_get(
590 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
591 int mrvl_pmd = rte_cryptodev_driver_id_get(
592 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
593 int virtio_pmd = rte_cryptodev_driver_id_get(
594 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
597 case BLKCIPHER_AES_CHAIN_TYPE:
598 n_test_cases = sizeof(aes_chain_test_cases) /
599 sizeof(aes_chain_test_cases[0]);
600 tcs = aes_chain_test_cases;
602 case BLKCIPHER_AES_CIPHERONLY_TYPE:
603 n_test_cases = sizeof(aes_cipheronly_test_cases) /
604 sizeof(aes_cipheronly_test_cases[0]);
605 tcs = aes_cipheronly_test_cases;
607 case BLKCIPHER_AES_DOCSIS_TYPE:
608 n_test_cases = sizeof(aes_docsis_test_cases) /
609 sizeof(aes_docsis_test_cases[0]);
610 tcs = aes_docsis_test_cases;
612 case BLKCIPHER_3DES_CHAIN_TYPE:
613 n_test_cases = sizeof(triple_des_chain_test_cases) /
614 sizeof(triple_des_chain_test_cases[0]);
615 tcs = triple_des_chain_test_cases;
617 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
618 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
619 sizeof(triple_des_cipheronly_test_cases[0]);
620 tcs = triple_des_cipheronly_test_cases;
622 case BLKCIPHER_DES_CIPHERONLY_TYPE:
623 n_test_cases = sizeof(des_cipheronly_test_cases) /
624 sizeof(des_cipheronly_test_cases[0]);
625 tcs = des_cipheronly_test_cases;
627 case BLKCIPHER_DES_DOCSIS_TYPE:
628 n_test_cases = sizeof(des_docsis_test_cases) /
629 sizeof(des_docsis_test_cases[0]);
630 tcs = des_docsis_test_cases;
632 case BLKCIPHER_AUTHONLY_TYPE:
633 n_test_cases = sizeof(hash_test_cases) /
634 sizeof(hash_test_cases[0]);
635 tcs = hash_test_cases;
641 if (driver_id == aesni_mb_pmd)
642 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
643 else if (driver_id == qat_pmd)
644 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
645 else if (driver_id == openssl_pmd)
646 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
647 else if (driver_id == armv8_pmd)
648 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
649 else if (driver_id == scheduler_pmd)
650 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
651 else if (driver_id == dpaa2_sec_pmd)
652 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
653 else if (driver_id == ccp_pmd)
654 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_CCP;
655 else if (driver_id == dpaa_sec_pmd)
656 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
657 else if (driver_id == mrvl_pmd)
658 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MVSAM;
659 else if (driver_id == virtio_pmd)
660 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
662 TEST_ASSERT(0, "Unrecognized cryptodev type");
664 for (i = 0; i < n_test_cases; i++) {
665 const struct blockcipher_test_case *tc = &tcs[i];
667 if (!(tc->pmd_mask & target_pmd_mask))
670 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
671 sess_mpool, dev_id, driver_id, test_msg);
673 printf(" %u) TestCase %s %s\n", test_index ++,
674 tc->test_descr, test_msg);
676 if (status != TEST_SUCCESS) {
677 if (overall_status == TEST_SUCCESS)
678 overall_status = status;
680 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
685 return overall_status;