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_aes.h"
46 #ifndef AES_TEST_MSG_LEN
47 #define AES_TEST_MSG_LEN 256
50 #define AES_TEST_OP_ENCRYPT 0x01
51 #define AES_TEST_OP_DECRYPT 0x02
52 #define AES_TEST_OP_AUTH_GEN 0x04
53 #define AES_TEST_OP_AUTH_VERIFY 0x08
55 #define AES_TEST_FEATURE_OOP 0x01
56 #define AES_TEST_FEATURE_SESSIONLESS 0x02
57 #define AES_TEST_FEATURE_STOPPER 0x04 /* stop upon failing */
59 #define AES_TEST_TARGET_PMD_MB 0x0001 /* Multi-buffer flag */
60 #define AES_TEST_TARGET_PMD_QAT 0x0002 /* QAT flag */
62 #define AES_TEST_OP_CIPHER (AES_TEST_OP_ENCRYPT | \
65 #define AES_TEST_OP_AUTH (AES_TEST_OP_AUTH_GEN | \
66 AES_TEST_OP_AUTH_VERIFY)
68 #define AES_TEST_OP_ENC_AUTH_GEN (AES_TEST_OP_ENCRYPT | \
71 #define AES_TEST_OP_AUTH_VERIFY_DEC (AES_TEST_OP_DECRYPT | \
72 AES_TEST_OP_AUTH_VERIFY)
74 struct aes_test_case {
75 const char *test_descr; /* test description */
76 const struct aes_test_data *test_data;
77 uint8_t op_mask; /* operation mask */
82 static const struct aes_test_case aes_test_cases[] = {
84 .test_descr = "AES-128-CTR HMAC-SHA1 Encryption Digest",
85 .test_data = &aes_test_data_1,
86 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
87 .pmd_mask = AES_TEST_TARGET_PMD_MB |
88 AES_TEST_TARGET_PMD_QAT
91 .test_descr = "AES-128-CTR HMAC-SHA1 Decryption Digest "
93 .test_data = &aes_test_data_1,
94 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
95 .pmd_mask = AES_TEST_TARGET_PMD_MB |
96 AES_TEST_TARGET_PMD_QAT
99 .test_descr = "AES-192-CTR XCBC Encryption Digest",
100 .test_data = &aes_test_data_2,
101 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
102 .pmd_mask = AES_TEST_TARGET_PMD_MB |
103 AES_TEST_TARGET_PMD_QAT
106 .test_descr = "AES-192-CTR XCBC Decryption Digest Verify",
107 .test_data = &aes_test_data_2,
108 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
109 .pmd_mask = AES_TEST_TARGET_PMD_MB |
110 AES_TEST_TARGET_PMD_QAT
113 .test_descr = "AES-256-CTR HMAC-SHA1 Encryption Digest",
114 .test_data = &aes_test_data_3,
115 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
116 .pmd_mask = AES_TEST_TARGET_PMD_MB |
117 AES_TEST_TARGET_PMD_QAT
120 .test_descr = "AES-256-CTR HMAC-SHA1 Decryption Digest "
122 .test_data = &aes_test_data_3,
123 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
124 .pmd_mask = AES_TEST_TARGET_PMD_MB |
125 AES_TEST_TARGET_PMD_QAT
128 .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest",
129 .test_data = &aes_test_data_4,
130 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
131 .pmd_mask = AES_TEST_TARGET_PMD_MB |
132 AES_TEST_TARGET_PMD_QAT
135 .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
137 .test_data = &aes_test_data_4,
138 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
139 .pmd_mask = AES_TEST_TARGET_PMD_MB |
140 AES_TEST_TARGET_PMD_QAT
143 .test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest",
144 .test_data = &aes_test_data_5,
145 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
146 .pmd_mask = AES_TEST_TARGET_PMD_MB |
147 AES_TEST_TARGET_PMD_QAT
150 .test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
152 .test_data = &aes_test_data_5,
153 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
154 .pmd_mask = AES_TEST_TARGET_PMD_MB |
155 AES_TEST_TARGET_PMD_QAT
158 .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest",
159 .test_data = &aes_test_data_6,
160 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
161 .pmd_mask = AES_TEST_TARGET_PMD_MB |
162 AES_TEST_TARGET_PMD_QAT
165 .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest "
167 .test_data = &aes_test_data_6,
168 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
169 .feature_mask = AES_TEST_FEATURE_SESSIONLESS,
170 .pmd_mask = AES_TEST_TARGET_PMD_MB
173 .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest "
175 .test_data = &aes_test_data_6,
176 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
177 .pmd_mask = AES_TEST_TARGET_PMD_MB |
178 AES_TEST_TARGET_PMD_QAT
181 .test_descr = "AES-128-CBC XCBC Encryption Digest",
182 .test_data = &aes_test_data_7,
183 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
184 .pmd_mask = AES_TEST_TARGET_PMD_MB |
185 AES_TEST_TARGET_PMD_QAT
188 .test_descr = "AES-128-CBC XCBC Decryption Digest Verify",
189 .test_data = &aes_test_data_7,
190 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
191 .pmd_mask = AES_TEST_TARGET_PMD_MB |
192 AES_TEST_TARGET_PMD_QAT
195 .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
197 .test_data = &aes_test_data_4,
198 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
199 .feature_mask = AES_TEST_FEATURE_OOP,
200 .pmd_mask = AES_TEST_TARGET_PMD_QAT
203 .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
205 .test_data = &aes_test_data_4,
206 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
207 .feature_mask = AES_TEST_FEATURE_OOP,
208 .pmd_mask = AES_TEST_TARGET_PMD_QAT
211 .test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest",
212 .test_data = &aes_test_data_8,
213 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
214 .pmd_mask = AES_TEST_TARGET_PMD_MB
217 .test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest "
219 .test_data = &aes_test_data_8,
220 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
221 .pmd_mask = AES_TEST_TARGET_PMD_MB
224 .test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest",
225 .test_data = &aes_test_data_9,
226 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
227 .pmd_mask = AES_TEST_TARGET_PMD_MB
230 .test_descr = "AES-128-CBC HMAC-SHA384 Decryption Digest "
232 .test_data = &aes_test_data_9,
233 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
234 .pmd_mask = AES_TEST_TARGET_PMD_MB
239 test_AES_one_case(const struct aes_test_case *t,
240 struct rte_mempool *mbuf_pool,
241 struct rte_mempool *op_mpool,
243 enum rte_cryptodev_type cryptodev_type,
246 struct rte_mbuf *ibuf = NULL;
247 struct rte_mbuf *obuf = NULL;
248 struct rte_mbuf *iobuf;
249 struct rte_crypto_sym_xform *cipher_xform = NULL;
250 struct rte_crypto_sym_xform *auth_xform = NULL;
251 struct rte_crypto_sym_xform *init_xform = NULL;
252 struct rte_crypto_sym_op *sym_op = NULL;
253 struct rte_crypto_op *op = NULL;
254 struct rte_cryptodev_sym_session *sess = NULL;
256 int status = TEST_SUCCESS;
257 const struct aes_test_data *tdata = t->test_data;
258 uint8_t cipher_key[tdata->cipher_key.len];
259 uint8_t auth_key[tdata->auth_key.len];
260 uint32_t buf_len = tdata->ciphertext.len;
261 uint32_t digest_len = 0;
264 if (tdata->cipher_key.len)
265 memcpy(cipher_key, tdata->cipher_key.data,
266 tdata->cipher_key.len);
267 if (tdata->auth_key.len)
268 memcpy(auth_key, tdata->auth_key.data,
269 tdata->auth_key.len);
271 switch (cryptodev_type) {
272 case RTE_CRYPTODEV_QAT_SYM_PMD:
273 digest_len = tdata->digest.len;
275 case RTE_CRYPTODEV_AESNI_MB_PMD:
276 digest_len = tdata->digest.truncated_len;
279 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
280 __LINE__, "Unsupported PMD type");
281 status = TEST_FAILED;
286 ibuf = rte_pktmbuf_alloc(mbuf_pool);
288 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
289 __LINE__, "Allocation of rte_mbuf failed");
290 status = TEST_FAILED;
294 if (t->op_mask & AES_TEST_OP_CIPHER)
295 buf_len += tdata->iv.len;
296 if (t->op_mask & AES_TEST_OP_AUTH)
297 buf_len += digest_len;
299 buf_p = rte_pktmbuf_append(ibuf, buf_len);
301 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
302 __LINE__, "No room to append mbuf");
303 status = TEST_FAILED;
307 if (t->op_mask & AES_TEST_OP_CIPHER) {
308 rte_memcpy(buf_p, tdata->iv.data, tdata->iv.len);
309 buf_p += tdata->iv.len;
312 /* only encryption requires plaintext.data input,
313 * decryption/(digest gen)/(digest verify) use ciphertext.data
315 if (t->op_mask & AES_TEST_OP_ENCRYPT) {
316 rte_memcpy(buf_p, tdata->plaintext.data,
317 tdata->plaintext.len);
318 buf_p += tdata->plaintext.len;
320 rte_memcpy(buf_p, tdata->ciphertext.data,
321 tdata->ciphertext.len);
322 buf_p += tdata->ciphertext.len;
325 if (t->op_mask & AES_TEST_OP_AUTH_VERIFY)
326 rte_memcpy(buf_p, tdata->digest.data, digest_len);
328 memset(buf_p, 0, digest_len);
330 if (t->feature_mask & AES_TEST_FEATURE_OOP) {
331 obuf = rte_pktmbuf_alloc(mbuf_pool);
333 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
334 "FAILED: %s", __LINE__,
335 "Allocation of rte_mbuf failed");
336 status = TEST_FAILED;
340 buf_p = rte_pktmbuf_append(obuf, buf_len);
342 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
343 "FAILED: %s", __LINE__,
344 "No room to append mbuf");
345 status = TEST_FAILED;
348 memset(buf_p, 0, buf_len);
351 /* Generate Crypto op data structure */
352 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
354 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
355 __LINE__, "Failed to allocate symmetric crypto "
357 status = TEST_FAILED;
363 sym_op->m_src = ibuf;
365 if (t->feature_mask & AES_TEST_FEATURE_OOP) {
366 sym_op->m_dst = obuf;
369 sym_op->m_dst = NULL;
373 /* sessionless op requires allocate xform using
374 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
376 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
377 uint32_t n_xforms = 0;
379 if (t->op_mask & AES_TEST_OP_CIPHER)
381 if (t->op_mask & AES_TEST_OP_AUTH)
384 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
386 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
387 "FAILED: %s", __LINE__, "Failed to "
388 "allocate space for crypto transforms");
389 status = TEST_FAILED;
393 cipher_xform = rte_zmalloc(NULL,
394 sizeof(struct rte_crypto_sym_xform), 0);
396 auth_xform = rte_zmalloc(NULL,
397 sizeof(struct rte_crypto_sym_xform), 0);
399 if (!cipher_xform || !auth_xform) {
400 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
401 "FAILED: %s", __LINE__, "Failed to "
402 "allocate memory for crypto transforms");
403 status = TEST_FAILED;
408 /* preparing xform, for sessioned op, init_xform is initialized
409 * here and later as param in rte_cryptodev_sym_session_create()
411 if (t->op_mask == AES_TEST_OP_ENC_AUTH_GEN) {
412 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
413 cipher_xform = op->sym->xform;
414 auth_xform = cipher_xform->next;
415 auth_xform->next = NULL;
417 cipher_xform->next = auth_xform;
418 auth_xform->next = NULL;
419 init_xform = cipher_xform;
421 } else if (t->op_mask == AES_TEST_OP_AUTH_VERIFY_DEC) {
422 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
423 auth_xform = op->sym->xform;
424 cipher_xform = auth_xform->next;
425 cipher_xform->next = NULL;
427 auth_xform->next = cipher_xform;
428 cipher_xform->next = NULL;
429 init_xform = auth_xform;
431 } else if ((t->op_mask == AES_TEST_OP_ENCRYPT) ||
432 (t->op_mask == AES_TEST_OP_DECRYPT)) {
433 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)
434 cipher_xform = op->sym->xform;
436 init_xform = cipher_xform;
437 cipher_xform->next = NULL;
438 } else if ((t->op_mask == AES_TEST_OP_AUTH_GEN) ||
439 (t->op_mask == AES_TEST_OP_AUTH_VERIFY)) {
440 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)
441 auth_xform = op->sym->xform;
443 init_xform = auth_xform;
444 auth_xform->next = NULL;
446 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
447 __LINE__, "Unrecognized operation");
448 status = TEST_FAILED;
452 /*configure xforms & sym_op cipher and auth data*/
453 if (t->op_mask & AES_TEST_OP_CIPHER) {
454 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
455 cipher_xform->cipher.algo = tdata->crypto_algo;
456 if (t->op_mask & AES_TEST_OP_ENCRYPT)
457 cipher_xform->cipher.op =
458 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
460 cipher_xform->cipher.op =
461 RTE_CRYPTO_CIPHER_OP_DECRYPT;
462 cipher_xform->cipher.key.data = cipher_key;
463 cipher_xform->cipher.key.length = tdata->cipher_key.len;
465 sym_op->cipher.data.offset = tdata->iv.len;
466 sym_op->cipher.data.length = tdata->ciphertext.len;
467 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
469 sym_op->cipher.iv.length = tdata->iv.len;
470 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
474 if (t->op_mask & AES_TEST_OP_AUTH) {
475 uint32_t auth_data_offset = 0;
476 uint32_t digest_offset = tdata->ciphertext.len;
478 if (t->op_mask & AES_TEST_OP_CIPHER) {
479 digest_offset += tdata->iv.len;
480 auth_data_offset += tdata->iv.len;
483 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
484 auth_xform->auth.algo = tdata->auth_algo;
485 auth_xform->auth.key.length = tdata->auth_key.len;
486 auth_xform->auth.key.data = auth_key;
487 auth_xform->auth.digest_length = digest_len;
489 if (t->op_mask & AES_TEST_OP_AUTH_GEN) {
490 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
491 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
492 (iobuf, uint8_t *, digest_offset);
493 sym_op->auth.digest.phys_addr =
494 rte_pktmbuf_mtophys_offset(iobuf,
497 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
498 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
499 (sym_op->m_src, uint8_t *, digest_offset);
500 sym_op->auth.digest.phys_addr =
501 rte_pktmbuf_mtophys_offset(sym_op->m_src,
505 sym_op->auth.data.offset = auth_data_offset;
506 sym_op->auth.data.length = tdata->ciphertext.len;
507 sym_op->auth.digest.length = digest_len;
510 /* create session for sessioned op */
511 if (!(t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)) {
512 sess = rte_cryptodev_sym_session_create(dev_id,
515 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
516 "FAILED: %s", __LINE__,
517 "Session creation failed");
518 status = TEST_FAILED;
522 /* attach symmetric crypto session to crypto operations */
523 rte_crypto_op_attach_sym_session(op, sess);
526 /* Process crypto operation */
527 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
528 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
529 __LINE__, "Error sending packet for encryption");
530 status = TEST_FAILED;
536 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
540 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
541 __LINE__, "Failed to process sym crypto op");
542 status = TEST_FAILED;
546 TEST_HEXDUMP(stdout, "m_src:",
547 rte_pktmbuf_mtod(sym_op->m_src, uint8_t *), buf_len);
548 if (t->feature_mask & AES_TEST_FEATURE_OOP)
549 TEST_HEXDUMP(stdout, "m_dst:",
550 rte_pktmbuf_mtod(sym_op->m_dst, uint8_t *),
554 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
555 if (t->op_mask & AES_TEST_OP_AUTH_VERIFY)
556 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
557 "FAILED: Digest verification failed "
558 "(0x%X)", __LINE__, op->status);
560 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
561 "FAILED: Digest verification failed "
562 "(0x%X)", __LINE__, op->status);
563 status = TEST_FAILED;
567 if (t->op_mask & AES_TEST_OP_CIPHER) {
569 const uint8_t *compare_ref;
570 uint32_t compare_len;
572 crypto_res = rte_pktmbuf_mtod_offset(iobuf, uint8_t *,
575 if (t->op_mask & AES_TEST_OP_ENCRYPT) {
576 compare_ref = tdata->ciphertext.data;
577 compare_len = tdata->ciphertext.len;
579 compare_ref = tdata->plaintext.data;
580 compare_len = tdata->plaintext.len;
583 if (memcmp(crypto_res, compare_ref, compare_len)) {
584 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
585 "FAILED: %s", __LINE__,
586 "Crypto data not as expected");
587 status = TEST_FAILED;
592 if (t->op_mask & AES_TEST_OP_AUTH_GEN) {
595 if (t->op_mask & AES_TEST_OP_CIPHER)
596 auth_res = rte_pktmbuf_mtod_offset(iobuf,
598 tdata->iv.len + tdata->ciphertext.len);
600 auth_res = rte_pktmbuf_mtod_offset(iobuf,
601 uint8_t *, tdata->ciphertext.len);
603 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
604 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
605 "FAILED: %s", __LINE__, "Generated "
606 "digest data not as expected");
607 status = TEST_FAILED;
612 snprintf(test_msg, AES_TEST_MSG_LEN, "PASS");
615 if (!(t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)) {
617 rte_cryptodev_sym_session_free(dev_id, sess);
619 rte_free(cipher_xform);
621 rte_free(auth_xform);
625 rte_crypto_op_free(op);
628 rte_pktmbuf_free(obuf);
631 rte_pktmbuf_free(ibuf);
637 test_AES_all_tests(struct rte_mempool *mbuf_pool,
638 struct rte_mempool *op_mpool,
640 enum rte_cryptodev_type cryptodev_type)
642 int status, overall_status = TEST_SUCCESS;
643 uint32_t i, test_index = 0;
644 char test_msg[AES_TEST_MSG_LEN + 1];
645 uint32_t n_test_cases = sizeof(aes_test_cases) /
646 sizeof(aes_test_cases[0]);
647 uint32_t target_pmd_mask = 0;
649 switch (cryptodev_type) {
650 case RTE_CRYPTODEV_AESNI_MB_PMD:
651 target_pmd_mask = AES_TEST_TARGET_PMD_MB;
653 case RTE_CRYPTODEV_QAT_SYM_PMD:
654 target_pmd_mask = AES_TEST_TARGET_PMD_QAT;
657 TEST_ASSERT(-1, "Unrecognized cryptodev type");
661 for (i = 0; i < n_test_cases; i++) {
662 const struct aes_test_case *tc = &aes_test_cases[i];
664 if (!(tc->pmd_mask & target_pmd_mask))
667 status = test_AES_one_case(tc, mbuf_pool, op_mpool,
668 dev_id, cryptodev_type, test_msg);
670 printf(" %u) TestCase %s %s\n", test_index ++,
671 tc->test_descr, test_msg);
673 if (status != TEST_SUCCESS) {
674 if (overall_status == TEST_SUCCESS)
675 overall_status = status;
677 if (tc->feature_mask & AES_TEST_FEATURE_STOPPER)
682 return overall_status;