4 * Copyright(c) 2015-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 #include <rte_common.h>
34 #include <rte_hexdump.h>
36 #include <rte_malloc.h>
37 #include <rte_memcpy.h>
38 #include <rte_pause.h>
40 #include <rte_crypto.h>
41 #include <rte_cryptodev.h>
42 #include <rte_cryptodev_pmd.h>
45 #include "test_cryptodev.h"
46 #include "test_cryptodev_blockcipher.h"
47 #include "test_cryptodev_aes_test_vectors.h"
48 #include "test_cryptodev_des_test_vectors.h"
49 #include "test_cryptodev_hash_test_vectors.h"
52 test_blockcipher_one_case(const struct blockcipher_test_case *t,
53 struct rte_mempool *mbuf_pool,
54 struct rte_mempool *op_mpool,
55 struct rte_mempool *sess_mpool,
60 struct rte_mbuf *ibuf = NULL;
61 struct rte_mbuf *obuf = NULL;
62 struct rte_mbuf *iobuf;
63 struct rte_crypto_sym_xform *cipher_xform = NULL;
64 struct rte_crypto_sym_xform *auth_xform = NULL;
65 struct rte_crypto_sym_xform *init_xform = NULL;
66 struct rte_crypto_sym_op *sym_op = NULL;
67 struct rte_crypto_op *op = NULL;
68 struct rte_cryptodev_info dev_info;
69 struct rte_cryptodev_sym_session *sess = NULL;
71 int status = TEST_SUCCESS;
72 const struct blockcipher_test_data *tdata = t->test_data;
73 uint8_t cipher_key[tdata->cipher_key.len];
74 uint8_t auth_key[tdata->auth_key.len];
75 uint32_t buf_len = tdata->ciphertext.len;
76 uint32_t digest_len = 0;
78 uint8_t src_pattern = 0xa5;
79 uint8_t dst_pattern = 0xb6;
80 uint8_t tmp_src_buf[MBUF_SIZE];
81 uint8_t tmp_dst_buf[MBUF_SIZE];
83 int openssl_pmd = rte_cryptodev_driver_id_get(
84 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
85 int scheduler_pmd = rte_cryptodev_driver_id_get(
86 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
87 int armv8_pmd = rte_cryptodev_driver_id_get(
88 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
89 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
90 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
91 int qat_pmd = rte_cryptodev_driver_id_get(
92 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
93 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
94 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
95 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
96 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
97 int mrvl_pmd = rte_cryptodev_driver_id_get(
98 RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
102 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
103 rte_cryptodev_info_get(dev_id, &dev_info);
104 if (!(dev_info.feature_flags &
105 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
106 printf("Device doesn't support scatter-gather. "
113 if (tdata->cipher_key.len)
114 memcpy(cipher_key, tdata->cipher_key.data,
115 tdata->cipher_key.len);
116 if (tdata->auth_key.len)
117 memcpy(auth_key, tdata->auth_key.data,
118 tdata->auth_key.len);
120 if (driver_id == dpaa2_sec_pmd ||
121 driver_id == dpaa_sec_pmd ||
122 driver_id == qat_pmd ||
123 driver_id == openssl_pmd ||
124 driver_id == armv8_pmd ||
125 driver_id == mrvl_pmd) { /* Fall through */
126 digest_len = tdata->digest.len;
127 } else if (driver_id == aesni_mb_pmd ||
128 driver_id == scheduler_pmd) {
129 digest_len = tdata->digest.truncated_len;
131 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
132 "line %u FAILED: %s",
133 __LINE__, "Unsupported PMD type");
134 status = TEST_FAILED;
139 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
140 buf_len += digest_len;
142 /* for contiguous mbuf, nb_segs is 1 */
143 ibuf = create_segmented_mbuf(mbuf_pool,
144 tdata->ciphertext.len, nb_segs, src_pattern);
146 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
147 "line %u FAILED: %s",
148 __LINE__, "Cannot create source mbuf");
149 status = TEST_FAILED;
153 /* only encryption requires plaintext.data input,
154 * decryption/(digest gen)/(digest verify) use ciphertext.data
157 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
158 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
159 tdata->plaintext.data);
161 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
162 tdata->ciphertext.data);
164 buf_p = rte_pktmbuf_append(ibuf, digest_len);
165 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
166 rte_memcpy(buf_p, tdata->digest.data, digest_len);
168 memset(buf_p, 0, digest_len);
170 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
171 obuf = rte_pktmbuf_alloc(mbuf_pool);
173 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
174 "FAILED: %s", __LINE__,
175 "Allocation of rte_mbuf failed");
176 status = TEST_FAILED;
179 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
181 buf_p = rte_pktmbuf_append(obuf, buf_len);
183 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
184 "FAILED: %s", __LINE__,
185 "No room to append mbuf");
186 status = TEST_FAILED;
189 memset(buf_p, 0, buf_len);
192 /* Generate Crypto op data structure */
193 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
195 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
196 "line %u FAILED: %s",
197 __LINE__, "Failed to allocate symmetric crypto "
199 status = TEST_FAILED;
205 sym_op->m_src = ibuf;
207 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
208 sym_op->m_dst = obuf;
211 sym_op->m_dst = NULL;
215 /* sessionless op requires allocate xform using
216 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
219 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
220 uint32_t n_xforms = 0;
222 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
224 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
227 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
229 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
230 "FAILED: %s", __LINE__, "Failed to "
231 "allocate space for crypto transforms");
232 status = TEST_FAILED;
236 cipher_xform = rte_zmalloc(NULL,
237 sizeof(struct rte_crypto_sym_xform), 0);
239 auth_xform = rte_zmalloc(NULL,
240 sizeof(struct rte_crypto_sym_xform), 0);
242 if (!cipher_xform || !auth_xform) {
243 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
244 "FAILED: %s", __LINE__, "Failed to "
245 "allocate memory for crypto transforms");
246 status = TEST_FAILED;
251 /* preparing xform, for sessioned op, init_xform is initialized
252 * here and later as param in rte_cryptodev_sym_session_create() call
254 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
255 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
256 cipher_xform = op->sym->xform;
257 auth_xform = cipher_xform->next;
258 auth_xform->next = NULL;
260 cipher_xform->next = auth_xform;
261 auth_xform->next = NULL;
262 init_xform = cipher_xform;
264 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
265 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
266 auth_xform = op->sym->xform;
267 cipher_xform = auth_xform->next;
268 cipher_xform->next = NULL;
270 auth_xform->next = cipher_xform;
271 cipher_xform->next = NULL;
272 init_xform = auth_xform;
274 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
275 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
276 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
277 cipher_xform = op->sym->xform;
279 init_xform = cipher_xform;
280 cipher_xform->next = NULL;
281 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
282 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
283 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
284 auth_xform = op->sym->xform;
286 init_xform = auth_xform;
287 auth_xform->next = NULL;
289 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
290 "line %u FAILED: %s",
291 __LINE__, "Unrecognized operation");
292 status = TEST_FAILED;
296 /*configure xforms & sym_op cipher and auth data*/
297 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
298 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
299 cipher_xform->cipher.algo = tdata->crypto_algo;
300 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
301 cipher_xform->cipher.op =
302 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
304 cipher_xform->cipher.op =
305 RTE_CRYPTO_CIPHER_OP_DECRYPT;
306 cipher_xform->cipher.key.data = cipher_key;
307 cipher_xform->cipher.key.length = tdata->cipher_key.len;
308 cipher_xform->cipher.iv.offset = IV_OFFSET;
309 cipher_xform->cipher.iv.length = tdata->iv.len;
311 sym_op->cipher.data.offset = 0;
312 sym_op->cipher.data.length = tdata->ciphertext.len;
313 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
318 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
319 uint32_t digest_offset = tdata->ciphertext.len;
321 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
322 auth_xform->auth.algo = tdata->auth_algo;
323 auth_xform->auth.key.length = tdata->auth_key.len;
324 auth_xform->auth.key.data = auth_key;
325 auth_xform->auth.digest_length = digest_len;
327 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
328 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
329 sym_op->auth.digest.data = pktmbuf_mtod_offset
330 (iobuf, digest_offset);
331 sym_op->auth.digest.phys_addr =
332 pktmbuf_iova_offset(iobuf,
335 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
336 sym_op->auth.digest.data = pktmbuf_mtod_offset
337 (sym_op->m_src, digest_offset);
338 sym_op->auth.digest.phys_addr =
339 pktmbuf_iova_offset(sym_op->m_src,
343 sym_op->auth.data.offset = 0;
344 sym_op->auth.data.length = tdata->ciphertext.len;
347 /* create session for sessioned op */
348 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
349 sess = rte_cryptodev_sym_session_create(sess_mpool);
351 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
354 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
355 "FAILED: %s", __LINE__,
356 "Session creation failed");
357 status = TEST_FAILED;
361 /* attach symmetric crypto session to crypto operations */
362 rte_crypto_op_attach_sym_session(op, sess);
365 debug_hexdump(stdout, "m_src(before):",
366 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
367 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
368 sym_op->m_src->buf_len);
369 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
370 debug_hexdump(stdout, "m_dst(before):",
371 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
372 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
373 sym_op->m_dst->buf_len);
376 /* Process crypto operation */
377 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
378 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
379 "line %u FAILED: %s",
380 __LINE__, "Error sending packet for encryption");
381 status = TEST_FAILED;
387 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
391 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
392 "line %u FAILED: %s",
393 __LINE__, "Failed to process sym crypto op");
394 status = TEST_FAILED;
398 debug_hexdump(stdout, "m_src(after):",
399 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
400 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
401 debug_hexdump(stdout, "m_dst(after):",
402 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
405 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
406 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
407 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
408 "FAILED: Digest verification failed "
409 "(0x%X)", __LINE__, op->status);
411 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
412 "FAILED: Digest verification failed "
413 "(0x%X)", __LINE__, op->status);
414 status = TEST_FAILED;
418 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
419 uint8_t buffer[2048];
420 const uint8_t *compare_ref;
421 uint32_t compare_len;
423 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
424 compare_ref = tdata->ciphertext.data;
425 compare_len = tdata->ciphertext.len;
427 compare_ref = tdata->plaintext.data;
428 compare_len = tdata->plaintext.len;
431 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
432 buffer), compare_ref, compare_len)) {
433 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
434 "FAILED: %s", __LINE__,
435 "Crypto data not as expected");
436 status = TEST_FAILED;
441 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
442 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
443 tdata->ciphertext.len);
445 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
446 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
447 "FAILED: %s", __LINE__, "Generated "
448 "digest data not as expected");
449 status = TEST_FAILED;
454 /* The only parts that should have changed in the buffer are
455 * plaintext/ciphertext and digest.
456 * In OOP only the dest buffer should change.
458 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
459 struct rte_mbuf *mbuf;
461 uint32_t head_unchanged_len, changed_len = 0;
464 mbuf = sym_op->m_src;
465 head_unchanged_len = mbuf->buf_len;
467 for (i = 0; i < mbuf->buf_len; i++) {
468 value = *((uint8_t *)(mbuf->buf_addr)+i);
469 if (value != tmp_src_buf[i]) {
470 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
471 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
472 __LINE__, value, tmp_src_buf[i]);
473 status = TEST_FAILED;
478 mbuf = sym_op->m_dst;
479 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
480 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
481 sym_op->auth.data.offset;
482 changed_len = sym_op->auth.data.length;
483 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
484 changed_len += digest_len;
487 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
488 sym_op->cipher.data.offset;
489 changed_len = sym_op->cipher.data.length;
492 for (i = 0; i < mbuf->buf_len; i++) {
493 if (i == head_unchanged_len)
495 value = *((uint8_t *)(mbuf->buf_addr)+i);
496 if (value != tmp_dst_buf[i]) {
497 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
498 "line %u FAILED: OOP dst outer mbuf data "
499 "(0x%x) not as expected (0x%x)",
500 __LINE__, value, tmp_dst_buf[i]);
501 status = TEST_FAILED;
506 /* In-place operation */
507 struct rte_mbuf *mbuf;
509 uint32_t head_unchanged_len = 0, changed_len = 0;
512 mbuf = sym_op->m_src;
513 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
514 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
515 sym_op->cipher.data.offset;
516 changed_len = sym_op->cipher.data.length;
519 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
520 sym_op->auth.data.offset +
521 sym_op->auth.data.length;
525 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
526 changed_len += digest_len;
528 for (i = 0; i < mbuf->buf_len; i++) {
529 if (i == head_unchanged_len)
531 value = *((uint8_t *)(mbuf->buf_addr)+i);
532 if (value != tmp_src_buf[i]) {
533 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
534 "line %u FAILED: outer mbuf data (0x%x) "
535 "not as expected (0x%x)",
536 __LINE__, value, tmp_src_buf[i]);
537 status = TEST_FAILED;
543 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
546 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
548 rte_cryptodev_sym_session_clear(dev_id, sess);
549 rte_cryptodev_sym_session_free(sess);
552 rte_free(cipher_xform);
554 rte_free(auth_xform);
558 rte_crypto_op_free(op);
561 rte_pktmbuf_free(obuf);
564 rte_pktmbuf_free(ibuf);
570 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
571 struct rte_mempool *op_mpool,
572 struct rte_mempool *sess_mpool,
575 enum blockcipher_test_type test_type)
577 int status, overall_status = TEST_SUCCESS;
578 uint32_t i, test_index = 0;
579 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
580 uint32_t n_test_cases = 0;
581 uint32_t target_pmd_mask = 0;
582 const struct blockcipher_test_case *tcs = NULL;
584 int openssl_pmd = rte_cryptodev_driver_id_get(
585 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
586 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
587 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
588 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
589 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
590 int scheduler_pmd = rte_cryptodev_driver_id_get(
591 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
592 int armv8_pmd = rte_cryptodev_driver_id_get(
593 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
594 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
595 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
596 int qat_pmd = rte_cryptodev_driver_id_get(
597 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
598 int mrvl_pmd = rte_cryptodev_driver_id_get(
599 RTE_STR(CRYPTODEV_NAME_MRVL_PMD));
602 case BLKCIPHER_AES_CHAIN_TYPE:
603 n_test_cases = sizeof(aes_chain_test_cases) /
604 sizeof(aes_chain_test_cases[0]);
605 tcs = aes_chain_test_cases;
607 case BLKCIPHER_AES_CIPHERONLY_TYPE:
608 n_test_cases = sizeof(aes_cipheronly_test_cases) /
609 sizeof(aes_cipheronly_test_cases[0]);
610 tcs = aes_cipheronly_test_cases;
612 case BLKCIPHER_AES_DOCSIS_TYPE:
613 n_test_cases = sizeof(aes_docsis_test_cases) /
614 sizeof(aes_docsis_test_cases[0]);
615 tcs = aes_docsis_test_cases;
617 case BLKCIPHER_3DES_CHAIN_TYPE:
618 n_test_cases = sizeof(triple_des_chain_test_cases) /
619 sizeof(triple_des_chain_test_cases[0]);
620 tcs = triple_des_chain_test_cases;
622 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
623 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
624 sizeof(triple_des_cipheronly_test_cases[0]);
625 tcs = triple_des_cipheronly_test_cases;
627 case BLKCIPHER_DES_CIPHERONLY_TYPE:
628 n_test_cases = sizeof(des_cipheronly_test_cases) /
629 sizeof(des_cipheronly_test_cases[0]);
630 tcs = des_cipheronly_test_cases;
632 case BLKCIPHER_DES_DOCSIS_TYPE:
633 n_test_cases = sizeof(des_docsis_test_cases) /
634 sizeof(des_docsis_test_cases[0]);
635 tcs = des_docsis_test_cases;
637 case BLKCIPHER_AUTHONLY_TYPE:
638 n_test_cases = sizeof(hash_test_cases) /
639 sizeof(hash_test_cases[0]);
640 tcs = hash_test_cases;
646 if (driver_id == aesni_mb_pmd)
647 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
648 else if (driver_id == qat_pmd)
649 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
650 else if (driver_id == openssl_pmd)
651 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
652 else if (driver_id == armv8_pmd)
653 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
654 else if (driver_id == scheduler_pmd)
655 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
656 else if (driver_id == dpaa2_sec_pmd)
657 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
658 else if (driver_id == dpaa_sec_pmd)
659 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
660 else if (driver_id == mrvl_pmd)
661 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MRVL;
663 TEST_ASSERT(0, "Unrecognized cryptodev type");
665 for (i = 0; i < n_test_cases; i++) {
666 const struct blockcipher_test_case *tc = &tcs[i];
668 if (!(tc->pmd_mask & target_pmd_mask))
671 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
672 sess_mpool, dev_id, driver_id, test_msg);
674 printf(" %u) TestCase %s %s\n", test_index ++,
675 tc->test_descr, test_msg);
677 if (status != TEST_SUCCESS) {
678 if (overall_status == TEST_SUCCESS)
679 overall_status = status;
681 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
686 return overall_status;