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.h"
45 #include "test_cryptodev_blockcipher.h"
46 #include "test_cryptodev_aes_test_vectors.h"
47 #include "test_cryptodev_des_test_vectors.h"
48 #include "test_cryptodev_hash_test_vectors.h"
49 #include "test_cryptodev.h"
52 test_blockcipher_one_case(const struct blockcipher_test_case *t,
53 struct rte_mempool *mbuf_pool,
54 struct rte_mempool *op_mpool,
56 enum rte_cryptodev_type cryptodev_type,
59 struct rte_mbuf *ibuf = NULL;
60 struct rte_mbuf *obuf = NULL;
61 struct rte_mbuf *iobuf;
62 struct rte_crypto_sym_xform *cipher_xform = NULL;
63 struct rte_crypto_sym_xform *auth_xform = NULL;
64 struct rte_crypto_sym_xform *init_xform = NULL;
65 struct rte_crypto_sym_op *sym_op = NULL;
66 struct rte_crypto_op *op = NULL;
67 struct rte_cryptodev_sym_session *sess = NULL;
68 struct rte_cryptodev_info dev_info;
70 int status = TEST_SUCCESS;
71 const struct blockcipher_test_data *tdata = t->test_data;
72 uint8_t cipher_key[tdata->cipher_key.len];
73 uint8_t auth_key[tdata->auth_key.len];
74 uint32_t buf_len = tdata->ciphertext.len;
75 uint32_t digest_len = 0;
77 uint8_t src_pattern = 0xa5;
78 uint8_t dst_pattern = 0xb6;
79 uint8_t tmp_src_buf[MBUF_SIZE];
80 uint8_t tmp_dst_buf[MBUF_SIZE];
84 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
85 rte_cryptodev_info_get(dev_id, &dev_info);
86 if (!(dev_info.feature_flags &
87 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
88 printf("Device doesn't support scatter-gather. "
95 if (tdata->cipher_key.len)
96 memcpy(cipher_key, tdata->cipher_key.data,
97 tdata->cipher_key.len);
98 if (tdata->auth_key.len)
99 memcpy(auth_key, tdata->auth_key.data,
100 tdata->auth_key.len);
102 switch (cryptodev_type) {
103 case RTE_CRYPTODEV_QAT_SYM_PMD:
104 case RTE_CRYPTODEV_OPENSSL_PMD:
105 digest_len = tdata->digest.len;
107 case RTE_CRYPTODEV_AESNI_MB_PMD:
108 digest_len = tdata->digest.truncated_len;
111 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
112 "line %u FAILED: %s",
113 __LINE__, "Unsupported PMD type");
114 status = TEST_FAILED;
119 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
120 buf_len += tdata->iv.len;
121 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
122 buf_len += digest_len;
124 /* for contiguous mbuf, nb_segs is 1 */
125 ibuf = create_segmented_mbuf(mbuf_pool,
126 tdata->ciphertext.len, nb_segs, src_pattern);
128 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
129 "line %u FAILED: %s",
130 __LINE__, "Cannot create source mbuf");
131 status = TEST_FAILED;
135 /* only encryption requires plaintext.data input,
136 * decryption/(digest gen)/(digest verify) use ciphertext.data
139 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
140 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
141 tdata->plaintext.data);
143 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
144 tdata->ciphertext.data);
146 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
147 rte_memcpy(rte_pktmbuf_prepend(ibuf, tdata->iv.len),
148 tdata->iv.data, tdata->iv.len);
150 buf_p = rte_pktmbuf_append(ibuf, digest_len);
151 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
152 rte_memcpy(buf_p, tdata->digest.data, digest_len);
154 memset(buf_p, 0, digest_len);
156 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
157 obuf = rte_pktmbuf_alloc(mbuf_pool);
159 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
160 "FAILED: %s", __LINE__,
161 "Allocation of rte_mbuf failed");
162 status = TEST_FAILED;
165 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
167 buf_p = rte_pktmbuf_append(obuf, buf_len);
169 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
170 "FAILED: %s", __LINE__,
171 "No room to append mbuf");
172 status = TEST_FAILED;
175 memset(buf_p, 0, buf_len);
178 /* Generate Crypto op data structure */
179 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
181 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
182 "line %u FAILED: %s",
183 __LINE__, "Failed to allocate symmetric crypto "
185 status = TEST_FAILED;
191 sym_op->m_src = ibuf;
193 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
194 sym_op->m_dst = obuf;
197 sym_op->m_dst = NULL;
201 /* sessionless op requires allocate xform using
202 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
205 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
206 uint32_t n_xforms = 0;
208 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
210 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
213 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
215 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
216 "FAILED: %s", __LINE__, "Failed to "
217 "allocate space for crypto transforms");
218 status = TEST_FAILED;
222 cipher_xform = rte_zmalloc(NULL,
223 sizeof(struct rte_crypto_sym_xform), 0);
225 auth_xform = rte_zmalloc(NULL,
226 sizeof(struct rte_crypto_sym_xform), 0);
228 if (!cipher_xform || !auth_xform) {
229 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
230 "FAILED: %s", __LINE__, "Failed to "
231 "allocate memory for crypto transforms");
232 status = TEST_FAILED;
237 /* preparing xform, for sessioned op, init_xform is initialized
238 * here and later as param in rte_cryptodev_sym_session_create() call
240 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
241 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
242 cipher_xform = op->sym->xform;
243 auth_xform = cipher_xform->next;
244 auth_xform->next = NULL;
246 cipher_xform->next = auth_xform;
247 auth_xform->next = NULL;
248 init_xform = cipher_xform;
250 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
251 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
252 auth_xform = op->sym->xform;
253 cipher_xform = auth_xform->next;
254 cipher_xform->next = NULL;
256 auth_xform->next = cipher_xform;
257 cipher_xform->next = NULL;
258 init_xform = auth_xform;
260 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
261 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
262 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
263 cipher_xform = op->sym->xform;
265 init_xform = cipher_xform;
266 cipher_xform->next = NULL;
267 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
268 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
269 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
270 auth_xform = op->sym->xform;
272 init_xform = auth_xform;
273 auth_xform->next = NULL;
275 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
276 "line %u FAILED: %s",
277 __LINE__, "Unrecognized operation");
278 status = TEST_FAILED;
282 /*configure xforms & sym_op cipher and auth data*/
283 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
284 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
285 cipher_xform->cipher.algo = tdata->crypto_algo;
286 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
287 cipher_xform->cipher.op =
288 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
290 cipher_xform->cipher.op =
291 RTE_CRYPTO_CIPHER_OP_DECRYPT;
292 cipher_xform->cipher.key.data = cipher_key;
293 cipher_xform->cipher.key.length = tdata->cipher_key.len;
295 sym_op->cipher.data.offset = tdata->iv.len;
296 sym_op->cipher.data.length = tdata->ciphertext.len;
297 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
299 sym_op->cipher.iv.length = tdata->iv.len;
300 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
304 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
305 uint32_t auth_data_offset = 0;
306 uint32_t digest_offset = tdata->ciphertext.len;
308 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
309 digest_offset += tdata->iv.len;
310 auth_data_offset += tdata->iv.len;
313 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
314 auth_xform->auth.algo = tdata->auth_algo;
315 auth_xform->auth.key.length = tdata->auth_key.len;
316 auth_xform->auth.key.data = auth_key;
317 auth_xform->auth.digest_length = digest_len;
319 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
320 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
321 sym_op->auth.digest.data = pktmbuf_mtod_offset
322 (iobuf, digest_offset);
323 sym_op->auth.digest.phys_addr =
324 pktmbuf_mtophys_offset(iobuf,
327 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
328 sym_op->auth.digest.data = pktmbuf_mtod_offset
329 (sym_op->m_src, digest_offset);
330 sym_op->auth.digest.phys_addr =
331 pktmbuf_mtophys_offset(sym_op->m_src,
335 sym_op->auth.data.offset = auth_data_offset;
336 sym_op->auth.data.length = tdata->ciphertext.len;
337 sym_op->auth.digest.length = digest_len;
340 /* create session for sessioned op */
341 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
342 sess = rte_cryptodev_sym_session_create(dev_id,
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 TEST_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 TEST_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 TEST_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 TEST_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, tdata->iv.len, 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) {
435 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
436 auth_res = pktmbuf_mtod_offset(iobuf,
437 tdata->iv.len + tdata->ciphertext.len);
439 auth_res = pktmbuf_mtod_offset(iobuf,
440 tdata->ciphertext.len);
442 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
443 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
444 "FAILED: %s", __LINE__, "Generated "
445 "digest data not as expected");
446 status = TEST_FAILED;
451 /* The only parts that should have changed in the buffer are
452 * plaintext/ciphertext and digest.
453 * In OOP only the dest buffer should change.
455 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
456 struct rte_mbuf *mbuf;
458 uint32_t head_unchanged_len = 0, changed_len = 0;
461 mbuf = sym_op->m_src;
462 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
463 /* white-box test: PMDs use some of the
464 * tailroom as temp storage in verify case
466 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
467 + rte_pktmbuf_data_len(mbuf);
468 changed_len = digest_len;
470 head_unchanged_len = mbuf->buf_len;
474 for (i = 0; i < mbuf->buf_len; i++) {
475 if (i == head_unchanged_len)
477 value = *((uint8_t *)(mbuf->buf_addr)+i);
478 if (value != tmp_src_buf[i]) {
479 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
480 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
481 __LINE__, value, tmp_src_buf[i]);
482 status = TEST_FAILED;
487 mbuf = sym_op->m_dst;
488 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
489 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
490 sym_op->auth.data.offset;
491 changed_len = sym_op->auth.data.length;
492 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
493 changed_len += sym_op->auth.digest.length;
496 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
497 sym_op->cipher.data.offset;
498 changed_len = sym_op->cipher.data.length;
501 for (i = 0; i < mbuf->buf_len; i++) {
502 if (i == head_unchanged_len)
504 value = *((uint8_t *)(mbuf->buf_addr)+i);
505 if (value != tmp_dst_buf[i]) {
506 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
507 "line %u FAILED: OOP dst outer mbuf data "
508 "(0x%x) not as expected (0x%x)",
509 __LINE__, value, tmp_dst_buf[i]);
510 status = TEST_FAILED;
515 /* In-place operation */
516 struct rte_mbuf *mbuf;
518 uint32_t head_unchanged_len = 0, changed_len = 0;
521 mbuf = sym_op->m_src;
522 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
523 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
524 sym_op->cipher.data.offset;
525 changed_len = sym_op->cipher.data.length;
528 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
529 sym_op->auth.data.offset +
530 sym_op->auth.data.length;
534 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
535 changed_len += sym_op->auth.digest.length;
537 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
538 /* white-box test: PMDs use some of the
539 * tailroom as temp storage in verify case
541 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
542 /* This is simplified, not checking digest*/
543 changed_len += digest_len*2;
545 head_unchanged_len += digest_len;
546 changed_len += digest_len;
550 for (i = 0; i < mbuf->buf_len; i++) {
551 if (i == head_unchanged_len)
553 value = *((uint8_t *)(mbuf->buf_addr)+i);
554 if (value != tmp_src_buf[i]) {
555 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
556 "line %u FAILED: outer mbuf data (0x%x) "
557 "not as expected (0x%x)",
558 __LINE__, value, tmp_src_buf[i]);
559 status = TEST_FAILED;
565 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
568 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
570 rte_cryptodev_sym_session_free(dev_id, sess);
572 rte_free(cipher_xform);
574 rte_free(auth_xform);
578 rte_crypto_op_free(op);
581 rte_pktmbuf_free(obuf);
584 rte_pktmbuf_free(ibuf);
590 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
591 struct rte_mempool *op_mpool,
593 enum rte_cryptodev_type cryptodev_type,
594 enum blockcipher_test_type test_type)
596 int status, overall_status = TEST_SUCCESS;
597 uint32_t i, test_index = 0;
598 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
599 uint32_t n_test_cases = 0;
600 uint32_t target_pmd_mask = 0;
601 const struct blockcipher_test_case *tcs = NULL;
604 case BLKCIPHER_AES_CHAIN_TYPE:
605 n_test_cases = sizeof(aes_chain_test_cases) /
606 sizeof(aes_chain_test_cases[0]);
607 tcs = aes_chain_test_cases;
609 case BLKCIPHER_AES_CIPHERONLY_TYPE:
610 n_test_cases = sizeof(aes_cipheronly_test_cases) /
611 sizeof(aes_cipheronly_test_cases[0]);
612 tcs = aes_cipheronly_test_cases;
614 case BLKCIPHER_3DES_CHAIN_TYPE:
615 n_test_cases = sizeof(triple_des_chain_test_cases) /
616 sizeof(triple_des_chain_test_cases[0]);
617 tcs = triple_des_chain_test_cases;
619 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
620 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
621 sizeof(triple_des_cipheronly_test_cases[0]);
622 tcs = triple_des_cipheronly_test_cases;
624 case BLKCIPHER_DES_CIPHERONLY_TYPE:
625 n_test_cases = sizeof(des_cipheronly_test_cases) /
626 sizeof(des_cipheronly_test_cases[0]);
627 tcs = des_cipheronly_test_cases;
629 case BLKCIPHER_AUTHONLY_TYPE:
630 n_test_cases = sizeof(hash_test_cases) /
631 sizeof(hash_test_cases[0]);
632 tcs = hash_test_cases;
638 switch (cryptodev_type) {
639 case RTE_CRYPTODEV_AESNI_MB_PMD:
640 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
642 case RTE_CRYPTODEV_QAT_SYM_PMD:
643 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
645 case RTE_CRYPTODEV_OPENSSL_PMD:
646 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
649 TEST_ASSERT(0, "Unrecognized cryptodev type");
653 for (i = 0; i < n_test_cases; i++) {
654 const struct blockcipher_test_case *tc = &tcs[i];
656 if (!(tc->pmd_mask & target_pmd_mask))
659 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
660 dev_id, cryptodev_type, test_msg);
662 printf(" %u) TestCase %s %s\n", test_index ++,
663 tc->test_descr, test_msg);
665 if (status != TEST_SUCCESS) {
666 if (overall_status == TEST_SUCCESS)
667 overall_status = status;
669 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
674 return overall_status;