4 * Copyright(c) 2015-2016 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>
39 #include <rte_crypto.h>
40 #include <rte_cryptodev.h>
41 #include <rte_cryptodev_pmd.h>
44 #include "test_cryptodev_blockcipher.h"
45 #include "test_cryptodev_aes_test_vectors.h"
46 #include "test_cryptodev_des_test_vectors.h"
47 #include "test_cryptodev_hash_test_vectors.h"
48 #include "test_cryptodev.h"
51 test_blockcipher_one_case(const struct blockcipher_test_case *t,
52 struct rte_mempool *mbuf_pool,
53 struct rte_mempool *op_mpool,
55 enum rte_cryptodev_type cryptodev_type,
58 struct rte_mbuf *ibuf = NULL;
59 struct rte_mbuf *obuf = NULL;
60 struct rte_mbuf *iobuf;
61 struct rte_crypto_sym_xform *cipher_xform = NULL;
62 struct rte_crypto_sym_xform *auth_xform = NULL;
63 struct rte_crypto_sym_xform *init_xform = NULL;
64 struct rte_crypto_sym_op *sym_op = NULL;
65 struct rte_crypto_op *op = NULL;
66 struct rte_cryptodev_sym_session *sess = NULL;
68 int status = TEST_SUCCESS;
69 const struct blockcipher_test_data *tdata = t->test_data;
70 uint8_t cipher_key[tdata->cipher_key.len];
71 uint8_t auth_key[tdata->auth_key.len];
72 uint32_t buf_len = tdata->ciphertext.len;
73 uint32_t digest_len = 0;
75 uint8_t src_pattern = 0xa5;
76 uint8_t dst_pattern = 0xb6;
77 uint8_t tmp_src_buf[MBUF_SIZE];
78 uint8_t tmp_dst_buf[MBUF_SIZE];
80 if (tdata->cipher_key.len)
81 memcpy(cipher_key, tdata->cipher_key.data,
82 tdata->cipher_key.len);
83 if (tdata->auth_key.len)
84 memcpy(auth_key, tdata->auth_key.data,
87 switch (cryptodev_type) {
88 case RTE_CRYPTODEV_QAT_SYM_PMD:
89 case RTE_CRYPTODEV_OPENSSL_PMD:
90 digest_len = tdata->digest.len;
92 case RTE_CRYPTODEV_AESNI_MB_PMD:
93 digest_len = tdata->digest.truncated_len;
96 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
98 __LINE__, "Unsupported PMD type");
104 ibuf = rte_pktmbuf_alloc(mbuf_pool);
106 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
107 "line %u FAILED: %s",
108 __LINE__, "Allocation of rte_mbuf failed");
109 status = TEST_FAILED;
112 memset(ibuf->buf_addr, src_pattern, ibuf->buf_len);
114 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
115 buf_len += tdata->iv.len;
116 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
117 buf_len += digest_len;
119 buf_p = rte_pktmbuf_append(ibuf, buf_len);
121 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
122 "line %u FAILED: %s",
123 __LINE__, "No room to append mbuf");
124 status = TEST_FAILED;
128 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
129 rte_memcpy(buf_p, tdata->iv.data, tdata->iv.len);
130 buf_p += tdata->iv.len;
133 /* only encryption requires plaintext.data input,
134 * decryption/(digest gen)/(digest verify) use ciphertext.data
137 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
138 rte_memcpy(buf_p, tdata->plaintext.data,
139 tdata->plaintext.len);
140 buf_p += tdata->plaintext.len;
142 rte_memcpy(buf_p, tdata->ciphertext.data,
143 tdata->ciphertext.len);
144 buf_p += tdata->ciphertext.len;
147 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
148 rte_memcpy(buf_p, tdata->digest.data, digest_len);
150 memset(buf_p, 0, digest_len);
152 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
153 obuf = rte_pktmbuf_alloc(mbuf_pool);
155 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
156 "FAILED: %s", __LINE__,
157 "Allocation of rte_mbuf failed");
158 status = TEST_FAILED;
161 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
163 buf_p = rte_pktmbuf_append(obuf, buf_len);
165 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
166 "FAILED: %s", __LINE__,
167 "No room to append mbuf");
168 status = TEST_FAILED;
171 memset(buf_p, 0, buf_len);
174 /* Generate Crypto op data structure */
175 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
177 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
178 "line %u FAILED: %s",
179 __LINE__, "Failed to allocate symmetric crypto "
181 status = TEST_FAILED;
187 sym_op->m_src = ibuf;
189 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
190 sym_op->m_dst = obuf;
193 sym_op->m_dst = NULL;
197 /* sessionless op requires allocate xform using
198 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
201 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
202 uint32_t n_xforms = 0;
204 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
206 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
209 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
211 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
212 "FAILED: %s", __LINE__, "Failed to "
213 "allocate space for crypto transforms");
214 status = TEST_FAILED;
218 cipher_xform = rte_zmalloc(NULL,
219 sizeof(struct rte_crypto_sym_xform), 0);
221 auth_xform = rte_zmalloc(NULL,
222 sizeof(struct rte_crypto_sym_xform), 0);
224 if (!cipher_xform || !auth_xform) {
225 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
226 "FAILED: %s", __LINE__, "Failed to "
227 "allocate memory for crypto transforms");
228 status = TEST_FAILED;
233 /* preparing xform, for sessioned op, init_xform is initialized
234 * here and later as param in rte_cryptodev_sym_session_create() call
236 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
237 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
238 cipher_xform = op->sym->xform;
239 auth_xform = cipher_xform->next;
240 auth_xform->next = NULL;
242 cipher_xform->next = auth_xform;
243 auth_xform->next = NULL;
244 init_xform = cipher_xform;
246 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
247 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
248 auth_xform = op->sym->xform;
249 cipher_xform = auth_xform->next;
250 cipher_xform->next = NULL;
252 auth_xform->next = cipher_xform;
253 cipher_xform->next = NULL;
254 init_xform = auth_xform;
256 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
257 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
258 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
259 cipher_xform = op->sym->xform;
261 init_xform = cipher_xform;
262 cipher_xform->next = NULL;
263 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
264 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
265 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
266 auth_xform = op->sym->xform;
268 init_xform = auth_xform;
269 auth_xform->next = NULL;
271 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
272 "line %u FAILED: %s",
273 __LINE__, "Unrecognized operation");
274 status = TEST_FAILED;
278 /*configure xforms & sym_op cipher and auth data*/
279 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
280 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
281 cipher_xform->cipher.algo = tdata->crypto_algo;
282 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
283 cipher_xform->cipher.op =
284 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
286 cipher_xform->cipher.op =
287 RTE_CRYPTO_CIPHER_OP_DECRYPT;
288 cipher_xform->cipher.key.data = cipher_key;
289 cipher_xform->cipher.key.length = tdata->cipher_key.len;
291 sym_op->cipher.data.offset = tdata->iv.len;
292 sym_op->cipher.data.length = tdata->ciphertext.len;
293 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
295 sym_op->cipher.iv.length = tdata->iv.len;
296 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
300 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
301 uint32_t auth_data_offset = 0;
302 uint32_t digest_offset = tdata->ciphertext.len;
304 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
305 digest_offset += tdata->iv.len;
306 auth_data_offset += tdata->iv.len;
309 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
310 auth_xform->auth.algo = tdata->auth_algo;
311 auth_xform->auth.key.length = tdata->auth_key.len;
312 auth_xform->auth.key.data = auth_key;
313 auth_xform->auth.digest_length = digest_len;
315 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
316 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
317 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
318 (iobuf, uint8_t *, digest_offset);
319 sym_op->auth.digest.phys_addr =
320 rte_pktmbuf_mtophys_offset(iobuf,
323 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
324 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
325 (sym_op->m_src, uint8_t *, digest_offset);
326 sym_op->auth.digest.phys_addr =
327 rte_pktmbuf_mtophys_offset(sym_op->m_src,
331 sym_op->auth.data.offset = auth_data_offset;
332 sym_op->auth.data.length = tdata->ciphertext.len;
333 sym_op->auth.digest.length = digest_len;
336 /* create session for sessioned op */
337 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
338 sess = rte_cryptodev_sym_session_create(dev_id,
341 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
342 "FAILED: %s", __LINE__,
343 "Session creation failed");
344 status = TEST_FAILED;
348 /* attach symmetric crypto session to crypto operations */
349 rte_crypto_op_attach_sym_session(op, sess);
352 TEST_HEXDUMP(stdout, "m_src(before):",
353 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
354 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
355 sym_op->m_src->buf_len);
356 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
357 TEST_HEXDUMP(stdout, "m_dst(before):",
358 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
359 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
360 sym_op->m_dst->buf_len);
363 /* Process crypto operation */
364 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
365 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
366 "line %u FAILED: %s",
367 __LINE__, "Error sending packet for encryption");
368 status = TEST_FAILED;
374 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
378 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
379 "line %u FAILED: %s",
380 __LINE__, "Failed to process sym crypto op");
381 status = TEST_FAILED;
385 TEST_HEXDUMP(stdout, "m_src(after):",
386 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
387 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
388 TEST_HEXDUMP(stdout, "m_dst(after):",
389 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
392 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
393 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
394 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
395 "FAILED: Digest verification failed "
396 "(0x%X)", __LINE__, op->status);
398 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
399 "FAILED: Digest verification failed "
400 "(0x%X)", __LINE__, op->status);
401 status = TEST_FAILED;
405 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
407 const uint8_t *compare_ref;
408 uint32_t compare_len;
410 crypto_res = rte_pktmbuf_mtod_offset(iobuf, uint8_t *,
413 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
414 compare_ref = tdata->ciphertext.data;
415 compare_len = tdata->ciphertext.len;
417 compare_ref = tdata->plaintext.data;
418 compare_len = tdata->plaintext.len;
421 if (memcmp(crypto_res, compare_ref, compare_len)) {
422 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
423 "FAILED: %s", __LINE__,
424 "Crypto data not as expected");
425 status = TEST_FAILED;
430 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
433 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
434 auth_res = rte_pktmbuf_mtod_offset(iobuf,
436 tdata->iv.len + tdata->ciphertext.len);
438 auth_res = rte_pktmbuf_mtod_offset(iobuf,
439 uint8_t *, tdata->ciphertext.len);
441 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
442 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
443 "FAILED: %s", __LINE__, "Generated "
444 "digest data not as expected");
445 status = TEST_FAILED;
450 /* The only parts that should have changed in the buffer are
451 * plaintext/ciphertext and digest.
452 * In OOP only the dest buffer should change.
454 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
455 struct rte_mbuf *mbuf;
457 uint32_t head_unchanged_len = 0, changed_len = 0;
460 mbuf = sym_op->m_src;
461 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
462 /* white-box test: PMDs use some of the
463 * tailroom as temp storage in verify case
465 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
466 + rte_pktmbuf_data_len(mbuf);
467 changed_len = digest_len;
469 head_unchanged_len = mbuf->buf_len;
473 for (i = 0; i < mbuf->buf_len; i++) {
474 if (i == head_unchanged_len)
476 value = *((uint8_t *)(mbuf->buf_addr)+i);
477 if (value != tmp_src_buf[i]) {
478 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
479 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
480 __LINE__, value, tmp_src_buf[i]);
481 status = TEST_FAILED;
486 mbuf = sym_op->m_dst;
487 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
488 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
489 sym_op->auth.data.offset;
490 changed_len = sym_op->auth.data.length;
491 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
492 changed_len += sym_op->auth.digest.length;
495 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
496 sym_op->cipher.data.offset;
497 changed_len = sym_op->cipher.data.length;
500 for (i = 0; i < mbuf->buf_len; i++) {
501 if (i == head_unchanged_len)
503 value = *((uint8_t *)(mbuf->buf_addr)+i);
504 if (value != tmp_dst_buf[i]) {
505 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
506 "line %u FAILED: OOP dst outer mbuf data "
507 "(0x%x) not as expected (0x%x)",
508 __LINE__, value, tmp_dst_buf[i]);
509 status = TEST_FAILED;
514 /* In-place operation */
515 struct rte_mbuf *mbuf;
517 uint32_t head_unchanged_len = 0, changed_len = 0;
520 mbuf = sym_op->m_src;
521 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
522 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
523 sym_op->cipher.data.offset;
524 changed_len = sym_op->cipher.data.length;
527 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
528 sym_op->auth.data.offset +
529 sym_op->auth.data.length;
533 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
534 changed_len += sym_op->auth.digest.length;
536 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
537 /* white-box test: PMDs use some of the
538 * tailroom as temp storage in verify case
540 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
541 /* This is simplified, not checking digest*/
542 changed_len += digest_len*2;
544 head_unchanged_len += digest_len;
545 changed_len += digest_len;
549 for (i = 0; i < mbuf->buf_len; i++) {
550 if (i == head_unchanged_len)
552 value = *((uint8_t *)(mbuf->buf_addr)+i);
553 if (value != tmp_src_buf[i]) {
554 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
555 "line %u FAILED: outer mbuf data (0x%x) "
556 "not as expected (0x%x)",
557 __LINE__, value, tmp_src_buf[i]);
558 status = TEST_FAILED;
564 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
567 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
569 rte_cryptodev_sym_session_free(dev_id, sess);
571 rte_free(cipher_xform);
573 rte_free(auth_xform);
577 rte_crypto_op_free(op);
580 rte_pktmbuf_free(obuf);
583 rte_pktmbuf_free(ibuf);
589 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
590 struct rte_mempool *op_mpool,
592 enum rte_cryptodev_type cryptodev_type,
593 enum blockcipher_test_type test_type)
595 int status, overall_status = TEST_SUCCESS;
596 uint32_t i, test_index = 0;
597 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
598 uint32_t n_test_cases = 0;
599 uint32_t target_pmd_mask = 0;
600 const struct blockcipher_test_case *tcs = NULL;
603 case BLKCIPHER_AES_CHAIN_TYPE:
604 n_test_cases = sizeof(aes_chain_test_cases) /
605 sizeof(aes_chain_test_cases[0]);
606 tcs = aes_chain_test_cases;
608 case BLKCIPHER_AES_CIPHERONLY_TYPE:
609 n_test_cases = sizeof(aes_cipheronly_test_cases) /
610 sizeof(aes_cipheronly_test_cases[0]);
611 tcs = aes_cipheronly_test_cases;
613 case BLKCIPHER_3DES_CHAIN_TYPE:
614 n_test_cases = sizeof(triple_des_chain_test_cases) /
615 sizeof(triple_des_chain_test_cases[0]);
616 tcs = triple_des_chain_test_cases;
618 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
619 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
620 sizeof(triple_des_cipheronly_test_cases[0]);
621 tcs = triple_des_cipheronly_test_cases;
623 case BLKCIPHER_DES_CIPHERONLY_TYPE:
624 n_test_cases = sizeof(des_cipheronly_test_cases) /
625 sizeof(des_cipheronly_test_cases[0]);
626 tcs = des_cipheronly_test_cases;
628 case BLKCIPHER_AUTHONLY_TYPE:
629 n_test_cases = sizeof(hash_test_cases) /
630 sizeof(hash_test_cases[0]);
631 tcs = hash_test_cases;
637 switch (cryptodev_type) {
638 case RTE_CRYPTODEV_AESNI_MB_PMD:
639 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
641 case RTE_CRYPTODEV_QAT_SYM_PMD:
642 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
644 case RTE_CRYPTODEV_OPENSSL_PMD:
645 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
648 TEST_ASSERT(0, "Unrecognized cryptodev type");
652 for (i = 0; i < n_test_cases; i++) {
653 const struct blockcipher_test_case *tc = &tcs[i];
655 if (!(tc->pmd_mask & target_pmd_mask))
658 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
659 dev_id, cryptodev_type, test_msg);
661 printf(" %u) TestCase %s %s\n", test_index ++,
662 tc->test_descr, test_msg);
664 if (status != TEST_SUCCESS) {
665 if (overall_status == TEST_SUCCESS)
666 overall_status = status;
668 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
673 return overall_status;