#include "test_cryptodev_aes_test_vectors.h"
#include "test_cryptodev_des_test_vectors.h"
#include "test_cryptodev_hash_test_vectors.h"
-#include "test_cryptodev.h"
static int
test_blockcipher_one_case(const struct blockcipher_test_case *t,
struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
+ struct rte_mempool *sess_mpool,
uint8_t dev_id,
int driver_id,
char *test_msg)
struct rte_crypto_sym_xform *init_xform = NULL;
struct rte_crypto_sym_op *sym_op = NULL;
struct rte_crypto_op *op = NULL;
- struct rte_cryptodev_sym_session *sess = NULL;
struct rte_cryptodev_info dev_info;
+ struct rte_cryptodev_sym_session *sess = NULL;
int status = TEST_SUCCESS;
const struct blockcipher_test_data *tdata = t->test_data;
/* create session for sessioned op */
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- sess = rte_cryptodev_sym_session_create(dev_id,
- init_xform);
+ sess = rte_cryptodev_sym_session_create(sess_mpool);
+
+ rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
+ sess_mpool);
if (!sess) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
"FAILED: %s", __LINE__,
if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
struct rte_mbuf *mbuf;
uint8_t value;
- uint32_t head_unchanged_len = 0, changed_len = 0;
+ uint32_t head_unchanged_len, changed_len = 0;
uint32_t i;
mbuf = sym_op->m_src;
- if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
- /* white-box test: PMDs use some of the
- * tailroom as temp storage in verify case
- */
- head_unchanged_len = rte_pktmbuf_headroom(mbuf)
- + rte_pktmbuf_data_len(mbuf);
- changed_len = digest_len;
- } else {
- head_unchanged_len = mbuf->buf_len;
- changed_len = 0;
- }
+ head_unchanged_len = mbuf->buf_len;
for (i = 0; i < mbuf->buf_len; i++) {
- if (i == head_unchanged_len)
- i += changed_len;
value = *((uint8_t *)(mbuf->buf_addr)+i);
if (value != tmp_src_buf[i]) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
changed_len += digest_len;
- if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
- /* white-box test: PMDs use some of the
- * tailroom as temp storage in verify case
- */
- if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
- /* This is simplified, not checking digest*/
- changed_len += digest_len*2;
- } else {
- head_unchanged_len += digest_len;
- changed_len += digest_len;
- }
- }
-
for (i = 0; i < mbuf->buf_len; i++) {
if (i == head_unchanged_len)
i += changed_len;
error_exit:
if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
- if (sess)
- rte_cryptodev_sym_session_free(dev_id, sess);
+ if (sess) {
+ rte_cryptodev_sym_session_clear(dev_id, sess);
+ rte_cryptodev_sym_session_free(sess);
+ }
if (cipher_xform)
rte_free(cipher_xform);
if (auth_xform)
int
test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
struct rte_mempool *op_mpool,
+ struct rte_mempool *sess_mpool,
uint8_t dev_id,
int driver_id,
enum blockcipher_test_type test_type)
int openssl_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
- int dpaa2_pmd = rte_cryptodev_driver_id_get(
+ int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
int scheduler_pmd = rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
else if (driver_id == scheduler_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
- else if (driver_id == dpaa2_pmd)
+ else if (driver_id == dpaa2_sec_pmd)
target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
else
TEST_ASSERT(0, "Unrecognized cryptodev type");
continue;
status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
- dev_id, driver_id, test_msg);
+ sess_mpool, dev_id, driver_id, test_msg);
printf(" %u) TestCase %s %s\n", test_index ++,
tc->test_descr, test_msg);