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 caam_jr_pmd = rte_cryptodev_driver_id_get(
72 RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD));
73 int mrvl_pmd = rte_cryptodev_driver_id_get(
74 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
75 int virtio_pmd = rte_cryptodev_driver_id_get(
76 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
77 int octeontx_pmd = rte_cryptodev_driver_id_get(
78 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
82 rte_cryptodev_info_get(dev_id, &dev_info);
84 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
85 uint64_t feat_flags = dev_info.feature_flags;
86 uint64_t oop_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT;
88 if (t->feature_mask && BLOCKCIPHER_TEST_FEATURE_OOP) {
89 if (!(feat_flags & oop_flag)) {
90 printf("Device doesn't support out-of-place "
91 "scatter-gather in input mbuf. "
96 if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
97 printf("Device doesn't support in-place "
98 "scatter-gather mbufs. "
107 if (tdata->cipher_key.len)
108 memcpy(cipher_key, tdata->cipher_key.data,
109 tdata->cipher_key.len);
110 if (tdata->auth_key.len)
111 memcpy(auth_key, tdata->auth_key.data,
112 tdata->auth_key.len);
114 if (driver_id == dpaa2_sec_pmd ||
115 driver_id == dpaa_sec_pmd ||
116 driver_id == caam_jr_pmd ||
117 driver_id == qat_pmd ||
118 driver_id == openssl_pmd ||
119 driver_id == armv8_pmd ||
120 driver_id == mrvl_pmd ||
121 driver_id == ccp_pmd ||
122 driver_id == virtio_pmd ||
123 driver_id == octeontx_pmd) { /* Fall through */
124 digest_len = tdata->digest.len;
125 } else if (driver_id == aesni_mb_pmd ||
126 driver_id == scheduler_pmd) {
127 digest_len = tdata->digest.truncated_len;
129 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
130 "line %u FAILED: %s",
131 __LINE__, "Unsupported PMD type");
132 status = TEST_FAILED;
137 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
138 buf_len += digest_len;
140 /* for contiguous mbuf, nb_segs is 1 */
141 ibuf = create_segmented_mbuf(mbuf_pool,
142 tdata->ciphertext.len, nb_segs, src_pattern);
144 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
145 "line %u FAILED: %s",
146 __LINE__, "Cannot create source mbuf");
147 status = TEST_FAILED;
151 /* only encryption requires plaintext.data input,
152 * decryption/(digest gen)/(digest verify) use ciphertext.data
155 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
156 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
157 tdata->plaintext.data);
159 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
160 tdata->ciphertext.data);
162 buf_p = rte_pktmbuf_append(ibuf, digest_len);
163 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
164 rte_memcpy(buf_p, tdata->digest.data, digest_len);
166 memset(buf_p, 0, digest_len);
168 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
169 obuf = rte_pktmbuf_alloc(mbuf_pool);
171 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
172 "FAILED: %s", __LINE__,
173 "Allocation of rte_mbuf failed");
174 status = TEST_FAILED;
177 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
179 buf_p = rte_pktmbuf_append(obuf, buf_len);
181 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
182 "FAILED: %s", __LINE__,
183 "No room to append mbuf");
184 status = TEST_FAILED;
187 memset(buf_p, 0, buf_len);
190 /* Generate Crypto op data structure */
191 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
193 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
194 "line %u FAILED: %s",
195 __LINE__, "Failed to allocate symmetric crypto "
197 status = TEST_FAILED;
203 sym_op->m_src = ibuf;
205 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
206 sym_op->m_dst = obuf;
209 sym_op->m_dst = NULL;
213 /* sessionless op requires allocate xform using
214 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
217 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
218 uint32_t n_xforms = 0;
220 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
222 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
225 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
227 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
228 "FAILED: %s", __LINE__, "Failed to "
229 "allocate space for crypto transforms");
230 status = TEST_FAILED;
234 cipher_xform = rte_zmalloc(NULL,
235 sizeof(struct rte_crypto_sym_xform), 0);
237 auth_xform = rte_zmalloc(NULL,
238 sizeof(struct rte_crypto_sym_xform), 0);
240 if (!cipher_xform || !auth_xform) {
241 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
242 "FAILED: %s", __LINE__, "Failed to "
243 "allocate memory for crypto transforms");
244 status = TEST_FAILED;
249 /* preparing xform, for sessioned op, init_xform is initialized
250 * here and later as param in rte_cryptodev_sym_session_create() call
252 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
253 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
254 cipher_xform = op->sym->xform;
255 auth_xform = cipher_xform->next;
256 auth_xform->next = NULL;
258 cipher_xform->next = auth_xform;
259 auth_xform->next = NULL;
260 init_xform = cipher_xform;
262 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
263 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
264 auth_xform = op->sym->xform;
265 cipher_xform = auth_xform->next;
266 cipher_xform->next = NULL;
268 auth_xform->next = cipher_xform;
269 cipher_xform->next = NULL;
270 init_xform = auth_xform;
272 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
273 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
274 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
275 cipher_xform = op->sym->xform;
277 init_xform = cipher_xform;
278 cipher_xform->next = NULL;
279 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
280 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
281 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
282 auth_xform = op->sym->xform;
284 init_xform = auth_xform;
285 auth_xform->next = NULL;
287 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
288 "line %u FAILED: %s",
289 __LINE__, "Unrecognized operation");
290 status = TEST_FAILED;
294 /*configure xforms & sym_op cipher and auth data*/
295 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
296 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
297 cipher_xform->cipher.algo = tdata->crypto_algo;
298 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
299 cipher_xform->cipher.op =
300 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
302 cipher_xform->cipher.op =
303 RTE_CRYPTO_CIPHER_OP_DECRYPT;
304 cipher_xform->cipher.key.data = cipher_key;
305 cipher_xform->cipher.key.length = tdata->cipher_key.len;
306 cipher_xform->cipher.iv.offset = IV_OFFSET;
307 cipher_xform->cipher.iv.length = tdata->iv.len;
309 sym_op->cipher.data.offset = 0;
310 sym_op->cipher.data.length = tdata->ciphertext.len;
311 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
316 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
317 uint32_t digest_offset = tdata->ciphertext.len;
319 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
320 auth_xform->auth.algo = tdata->auth_algo;
321 auth_xform->auth.key.length = tdata->auth_key.len;
322 auth_xform->auth.key.data = auth_key;
323 auth_xform->auth.digest_length = digest_len;
325 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
326 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
327 sym_op->auth.digest.data = pktmbuf_mtod_offset
328 (iobuf, digest_offset);
329 sym_op->auth.digest.phys_addr =
330 pktmbuf_iova_offset(iobuf,
333 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
334 sym_op->auth.digest.data = pktmbuf_mtod_offset
335 (sym_op->m_src, digest_offset);
336 sym_op->auth.digest.phys_addr =
337 pktmbuf_iova_offset(sym_op->m_src,
341 sym_op->auth.data.offset = 0;
342 sym_op->auth.data.length = tdata->ciphertext.len;
345 /* create session for sessioned op */
346 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
347 sess = rte_cryptodev_sym_session_create(sess_mpool);
349 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
352 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
353 "FAILED: %s", __LINE__,
354 "Session creation failed");
355 status = TEST_FAILED;
359 /* attach symmetric crypto session to crypto operations */
360 rte_crypto_op_attach_sym_session(op, sess);
363 debug_hexdump(stdout, "m_src(before):",
364 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
365 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
366 sym_op->m_src->buf_len);
367 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
368 debug_hexdump(stdout, "m_dst(before):",
369 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
370 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
371 sym_op->m_dst->buf_len);
374 /* Process crypto operation */
375 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
376 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
377 "line %u FAILED: %s",
378 __LINE__, "Error sending packet for encryption");
379 status = TEST_FAILED;
385 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
389 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
390 "line %u FAILED: %s",
391 __LINE__, "Failed to process sym crypto op");
392 status = TEST_FAILED;
396 debug_hexdump(stdout, "m_src(after):",
397 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
398 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
399 debug_hexdump(stdout, "m_dst(after):",
400 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
403 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
404 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
405 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
406 "FAILED: Digest verification failed "
407 "(0x%X)", __LINE__, op->status);
409 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
410 "FAILED: Digest verification failed "
411 "(0x%X)", __LINE__, op->status);
412 status = TEST_FAILED;
416 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
417 uint8_t buffer[2048];
418 const uint8_t *compare_ref;
419 uint32_t compare_len;
421 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
422 compare_ref = tdata->ciphertext.data;
423 compare_len = tdata->ciphertext.len;
425 compare_ref = tdata->plaintext.data;
426 compare_len = tdata->plaintext.len;
429 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
430 buffer), compare_ref, compare_len)) {
431 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
432 "FAILED: %s", __LINE__,
433 "Crypto data not as expected");
434 status = TEST_FAILED;
439 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
440 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
441 tdata->ciphertext.len);
443 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
444 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
445 "FAILED: %s", __LINE__, "Generated "
446 "digest data not as expected");
447 status = TEST_FAILED;
452 /* The only parts that should have changed in the buffer are
453 * plaintext/ciphertext and digest.
454 * In OOP only the dest buffer should change.
456 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
457 struct rte_mbuf *mbuf;
459 uint32_t head_unchanged_len, changed_len = 0;
461 uint32_t hdroom_used = 0, tlroom_used = 0;
464 mbuf = sym_op->m_src;
466 * Crypto PMDs specify the headroom & tailroom it would use
467 * when processing the crypto operation. PMD is free to modify
468 * this space, and so the verification check should skip that
471 hdroom_used = dev_info.min_mbuf_headroom_req;
472 tlroom_used = dev_info.min_mbuf_tailroom_req;
475 hdroom = rte_pktmbuf_headroom(mbuf);
477 head_unchanged_len = mbuf->buf_len;
479 for (i = 0; i < mbuf->buf_len; i++) {
481 /* Skip headroom used by PMD */
482 if (i == hdroom - hdroom_used)
485 /* Skip tailroom used by PMD */
486 if (i == (hdroom + mbuf->data_len))
489 value = *((uint8_t *)(mbuf->buf_addr)+i);
490 if (value != tmp_src_buf[i]) {
491 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
492 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
493 __LINE__, value, tmp_src_buf[i]);
494 status = TEST_FAILED;
499 mbuf = sym_op->m_dst;
500 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
501 head_unchanged_len = hdroom + sym_op->auth.data.offset;
502 changed_len = sym_op->auth.data.length;
503 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
504 changed_len += digest_len;
507 head_unchanged_len = hdroom +
508 sym_op->cipher.data.offset;
509 changed_len = sym_op->cipher.data.length;
512 for (i = 0; i < mbuf->buf_len; i++) {
513 if (i == head_unchanged_len)
515 value = *((uint8_t *)(mbuf->buf_addr)+i);
516 if (value != tmp_dst_buf[i]) {
517 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
518 "line %u FAILED: OOP dst outer mbuf data "
519 "(0x%x) not as expected (0x%x)",
520 __LINE__, value, tmp_dst_buf[i]);
521 status = TEST_FAILED;
526 /* In-place operation */
527 struct rte_mbuf *mbuf;
529 uint32_t head_unchanged_len = 0, changed_len = 0;
531 uint32_t hdroom_used = 0, tlroom_used = 0;
535 * Crypto PMDs specify the headroom & tailroom it would use
536 * when processing the crypto operation. PMD is free to modify
537 * this space, and so the verification check should skip that
540 hdroom_used = dev_info.min_mbuf_headroom_req;
541 tlroom_used = dev_info.min_mbuf_tailroom_req;
543 mbuf = sym_op->m_src;
546 hdroom = rte_pktmbuf_headroom(mbuf);
548 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
549 head_unchanged_len = hdroom +
550 sym_op->cipher.data.offset;
551 changed_len = sym_op->cipher.data.length;
554 head_unchanged_len = hdroom +
555 sym_op->auth.data.offset +
556 sym_op->auth.data.length;
560 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
561 changed_len += digest_len;
563 for (i = 0; i < mbuf->buf_len; i++) {
565 /* Skip headroom used by PMD */
566 if (i == hdroom - hdroom_used)
569 if (i == head_unchanged_len)
572 /* Skip tailroom used by PMD */
573 if (i == (hdroom + mbuf->data_len))
576 value = *((uint8_t *)(mbuf->buf_addr)+i);
577 if (value != tmp_src_buf[i]) {
578 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
579 "line %u FAILED: outer mbuf data (0x%x) "
580 "not as expected (0x%x)",
581 __LINE__, value, tmp_src_buf[i]);
582 status = TEST_FAILED;
588 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
591 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
593 rte_cryptodev_sym_session_clear(dev_id, sess);
594 rte_cryptodev_sym_session_free(sess);
597 rte_free(cipher_xform);
599 rte_free(auth_xform);
603 rte_crypto_op_free(op);
606 rte_pktmbuf_free(obuf);
609 rte_pktmbuf_free(ibuf);
615 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
616 struct rte_mempool *op_mpool,
617 struct rte_mempool *sess_mpool,
620 enum blockcipher_test_type test_type)
622 int status, overall_status = TEST_SUCCESS;
623 uint32_t i, test_index = 0;
624 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
625 uint32_t n_test_cases = 0;
626 uint32_t target_pmd_mask = 0;
627 const struct blockcipher_test_case *tcs = NULL;
629 int openssl_pmd = rte_cryptodev_driver_id_get(
630 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
631 int ccp_pmd = rte_cryptodev_driver_id_get(
632 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
633 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
634 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
635 int dpaa_sec_pmd = rte_cryptodev_driver_id_get(
636 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
637 int caam_jr_pmd = rte_cryptodev_driver_id_get(
638 RTE_STR(CRYPTODEV_NAME_CAAM_JR_PMD));
639 int scheduler_pmd = rte_cryptodev_driver_id_get(
640 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
641 int armv8_pmd = rte_cryptodev_driver_id_get(
642 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
643 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
644 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
645 int qat_pmd = rte_cryptodev_driver_id_get(
646 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
647 int mrvl_pmd = rte_cryptodev_driver_id_get(
648 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
649 int virtio_pmd = rte_cryptodev_driver_id_get(
650 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
651 int octeontx_pmd = rte_cryptodev_driver_id_get(
652 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
655 case BLKCIPHER_AES_CHAIN_TYPE:
656 n_test_cases = sizeof(aes_chain_test_cases) /
657 sizeof(aes_chain_test_cases[0]);
658 tcs = aes_chain_test_cases;
660 case BLKCIPHER_AES_CIPHERONLY_TYPE:
661 n_test_cases = sizeof(aes_cipheronly_test_cases) /
662 sizeof(aes_cipheronly_test_cases[0]);
663 tcs = aes_cipheronly_test_cases;
665 case BLKCIPHER_AES_DOCSIS_TYPE:
666 n_test_cases = sizeof(aes_docsis_test_cases) /
667 sizeof(aes_docsis_test_cases[0]);
668 tcs = aes_docsis_test_cases;
670 case BLKCIPHER_3DES_CHAIN_TYPE:
671 n_test_cases = sizeof(triple_des_chain_test_cases) /
672 sizeof(triple_des_chain_test_cases[0]);
673 tcs = triple_des_chain_test_cases;
675 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
676 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
677 sizeof(triple_des_cipheronly_test_cases[0]);
678 tcs = triple_des_cipheronly_test_cases;
680 case BLKCIPHER_DES_CIPHERONLY_TYPE:
681 n_test_cases = sizeof(des_cipheronly_test_cases) /
682 sizeof(des_cipheronly_test_cases[0]);
683 tcs = des_cipheronly_test_cases;
685 case BLKCIPHER_DES_DOCSIS_TYPE:
686 n_test_cases = sizeof(des_docsis_test_cases) /
687 sizeof(des_docsis_test_cases[0]);
688 tcs = des_docsis_test_cases;
690 case BLKCIPHER_AUTHONLY_TYPE:
691 n_test_cases = sizeof(hash_test_cases) /
692 sizeof(hash_test_cases[0]);
693 tcs = hash_test_cases;
699 if (driver_id == aesni_mb_pmd)
700 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
701 else if (driver_id == qat_pmd)
702 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
703 else if (driver_id == openssl_pmd)
704 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
705 else if (driver_id == armv8_pmd)
706 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
707 else if (driver_id == scheduler_pmd)
708 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
709 else if (driver_id == dpaa2_sec_pmd)
710 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
711 else if (driver_id == ccp_pmd)
712 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_CCP;
713 else if (driver_id == dpaa_sec_pmd)
714 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC;
715 else if (driver_id == caam_jr_pmd)
716 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR;
717 else if (driver_id == mrvl_pmd)
718 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MVSAM;
719 else if (driver_id == virtio_pmd)
720 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO;
721 else if (driver_id == octeontx_pmd)
722 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX;
724 TEST_ASSERT(0, "Unrecognized cryptodev type");
726 for (i = 0; i < n_test_cases; i++) {
727 const struct blockcipher_test_case *tc = &tcs[i];
729 if (!(tc->pmd_mask & target_pmd_mask))
732 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
733 sess_mpool, dev_id, driver_id, test_msg);
735 printf(" %u) TestCase %s %s\n", test_index ++,
736 tc->test_descr, test_msg);
738 if (status != TEST_SUCCESS) {
739 if (overall_status == TEST_SUCCESS)
740 overall_status = status;
742 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
747 return overall_status;