asym_op->rsa.message.length = rsaplaintext.len;
asym_op->rsa.sign.length = 0;
asym_op->rsa.sign.data = output_buf;
- asym_op->rsa.pad = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
+ asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
debug_hexdump(stdout, "message", asym_op->rsa.message.data,
asym_op->rsa.message.length);
/* Verify sign */
asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY;
- asym_op->rsa.pad = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
+ asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
/* Process crypto operation */
if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
asym_op->rsa.cipher.data = cipher_buf;
asym_op->rsa.cipher.length = 0;
asym_op->rsa.message.length = rsaplaintext.len;
- asym_op->rsa.pad = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
+ asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
debug_hexdump(stdout, "message", asym_op->rsa.message.data,
asym_op->rsa.message.length);
asym_op = result_op->asym;
asym_op->rsa.message.length = 0;
asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT;
- asym_op->rsa.pad = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
+ asym_op->rsa.padding.type = RTE_CRYPTO_RSA_PADDING_PKCS1_5;
/* Process crypto operation */
if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
uint8_t input[TEST_DATA_SIZE] = {0};
uint8_t *result = NULL;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
xform_tc.next = NULL;
xform_tc.xform_type = data_tc->modex.xform_type;
}
xform_tc.rsa.key_type = key_type;
- op->asym->rsa.pad = data_tc->rsa_data.padding;
+ op->asym->rsa.padding.type = data_tc->rsa_data.padding;
if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
asym_op->rsa.message.data = data_tc->rsa_data.pt.data;
}
if (!sessionless) {
- sess = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
- ts_params->session_mpool);
- if (!sess) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
+ ts_params->session_mpool, &sess);
+ if (ret < 0) {
snprintf(test_msg, ASYM_TEST_MSG_LEN,
"line %u "
"FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
status = test_cryptodev_asym_op(
&testsuite_params,
&tc, test_msg, sessionless, i,
- RTE_RSA_KET_TYPE_QT);
+ RTE_RSA_KEY_TYPE_QT);
}
if (status)
break;
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
/* Test case supports op with exponent key only,
* Check in PMD feature flag for RSA exponent key type support.
return TEST_SKIPPED;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool);
+ ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool, &sess);
- if (!sess) {
+ if (ret < 0) {
RTE_LOG(ERR, USER1, "Session creation failed for "
"sign_verify\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
/* Test case supports op with exponent key only,
* Check in PMD feature flag for RSA exponent key type support.
return TEST_SKIPPED;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool);
+ ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool, &sess);
- if (!sess) {
+ if (ret < 0) {
RTE_LOG(ERR, USER1, "Session creation failed for enc_dec\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
/* Test case supports op with quintuple format key only,
* Check im PMD feature flag for RSA quintuple key type support.
return TEST_SKIPPED;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool);
+ ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool, &sess);
- if (!sess) {
+ if (ret < 0) {
RTE_LOG(ERR, USER1, "Session creation failed for "
"sign_verify_crt\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
/* Test case supports op with quintuple format key only,
* Check in PMD feature flag for RSA quintuple key type support.
return TEST_SKIPPED;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool);
+ ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool, &sess);
- if (!sess) {
+ if (ret < 0) {
RTE_LOG(ERR, USER1, "Session creation failed for "
"enc_dec_crt\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
}
ts_params->session_mpool = rte_cryptodev_asym_session_pool_create(
- "test_asym_sess_mp", TEST_NUM_SESSIONS, 0,
+ "test_asym_sess_mp", TEST_NUM_SESSIONS, 0, 0,
SOCKET_ID_ANY);
TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
/* check supported operations */
- if (rte_cryptodev_asym_xform_capability_check_optype(capa, i))
- printf(" %s",
- rte_crypto_asym_op_strings[i]);
+ if (rte_cryptodev_asym_xform_capability_check_optype(capa, i)) {
+ if (capa->xform_type == RTE_CRYPTO_ASYM_XFORM_DH)
+ printf(" %s", rte_crypto_asym_ke_strings[i]);
+ else
+ printf(" %s", rte_crypto_asym_op_strings[i]);
}
- switch (capa->xform_type) {
- case RTE_CRYPTO_ASYM_XFORM_RSA:
- case RTE_CRYPTO_ASYM_XFORM_MODINV:
- case RTE_CRYPTO_ASYM_XFORM_MODEX:
- case RTE_CRYPTO_ASYM_XFORM_DH:
- case RTE_CRYPTO_ASYM_XFORM_DSA:
- printf(" modlen: min %d max %d increment %d",
- capa->modlen.min,
- capa->modlen.max,
- capa->modlen.increment);
+ }
+ switch (capa->xform_type) {
+ case RTE_CRYPTO_ASYM_XFORM_RSA:
+ case RTE_CRYPTO_ASYM_XFORM_MODINV:
+ case RTE_CRYPTO_ASYM_XFORM_MODEX:
+ case RTE_CRYPTO_ASYM_XFORM_DH:
+ case RTE_CRYPTO_ASYM_XFORM_DSA:
+ printf(" modlen: min %d max %d increment %d",
+ capa->modlen.min,
+ capa->modlen.max,
+ capa->modlen.increment);
+ break;
+ case RTE_CRYPTO_ASYM_XFORM_ECDSA:
+ case RTE_CRYPTO_ASYM_XFORM_ECPM:
+ default:
break;
- case RTE_CRYPTO_ASYM_XFORM_ECDSA:
- case RTE_CRYPTO_ASYM_XFORM_ECPM:
- default:
- break;
- }
- printf("\n");
+ }
+ printf("\n");
}
static int
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
uint8_t output[TEST_DH_MOD_LEN];
struct rte_crypto_asym_xform xform = *xfrm;
uint8_t peer[] = "01234567890123456789012345678901234567890123456789";
asym_op = op->asym;
/* Setup a xform and op to generate private key only */
- xform.dh.type = RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE;
xform.next = NULL;
+ asym_op->dh.ke_type = RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE;
asym_op->dh.priv_key.data = dh_test_params.priv_key.data;
asym_op->dh.priv_key.length = dh_test_params.priv_key.length;
asym_op->dh.pub_key.data = (uint8_t *)peer;
asym_op->dh.shared_secret.data = output;
asym_op->dh.shared_secret.length = sizeof(output);
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
uint8_t output[TEST_DH_MOD_LEN];
struct rte_crypto_asym_xform xform = *xfrm;
asym_op = op->asym;
/* Setup a xform and op to generate private key only */
- xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE;
xform.next = NULL;
+ asym_op->dh.ke_type = RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE;
asym_op->dh.priv_key.data = output;
asym_op->dh.priv_key.length = sizeof(output);
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
uint8_t output[TEST_DH_MOD_LEN];
struct rte_crypto_asym_xform xform = *xfrm;
* using test private key
*
*/
- xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE;
xform.next = NULL;
+ asym_op->dh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE;
asym_op->dh.pub_key.data = output;
asym_op->dh.pub_key.length = sizeof(output);
/* load pre-defined private key */
0);
asym_op->dh.priv_key = dh_test_params.priv_key;
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
- int status = TEST_SUCCESS;
+ int ret, status = TEST_SUCCESS;
uint8_t out_pub_key[TEST_DH_MOD_LEN];
uint8_t out_prv_key[TEST_DH_MOD_LEN];
struct rte_crypto_asym_xform pub_key_xform;
/* Setup a xform chain to generate
* private key first followed by
* public key
- */xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE;
+ */
pub_key_xform.xform_type = RTE_CRYPTO_ASYM_XFORM_DH;
- pub_key_xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE;
xform.next = &pub_key_xform;
+ asym_op->dh.ke_type = RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE;
asym_op->dh.pub_key.data = out_pub_key;
asym_op->dh.pub_key.length = sizeof(out_pub_key);
asym_op->dh.priv_key.data = out_prv_key;
- asym_op->dh.priv_key.length = sizeof(out_prv_key);
+ asym_op->dh.priv_key.length = 0;
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
return TEST_SKIPPED;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &modinv_xform, sess_mpool);
- if (!sess) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &modinv_xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1, "line %u "
"FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
goto error_exit;
}
- sess = rte_cryptodev_asym_session_create(dev_id, &modex_xform, sess_mpool);
- if (!sess) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &modex_xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u "
"FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
uint8_t r[TEST_DH_MOD_LEN];
uint8_t s[TEST_DH_MOD_LEN];
uint8_t dgst[] = "35d81554afaad2cf18f3a1770d5fedc4ea5be344";
+ int ret;
- sess = rte_cryptodev_asym_session_create(dev_id, &dsa_xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &dsa_xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto error_exit;
}
/* set up crypto op data structure */
struct rte_crypto_asym_op *asym_op;
struct rte_cryptodev_info dev_info;
struct rte_crypto_op *op = NULL;
- int status = TEST_SUCCESS, ret;
+ int ret, status = TEST_SUCCESS;
switch (curve_id) {
case SECP192R1:
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ECDSA;
xform.ec.curve_id = input_params.curve;
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto exit;
}
struct rte_crypto_asym_op *asym_op;
struct rte_cryptodev_info dev_info;
struct rte_crypto_op *op = NULL;
- int status = TEST_SUCCESS, ret;
+ int ret, status = TEST_SUCCESS;
switch (curve_id) {
case SECP192R1:
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ECPM;
xform.ec.curve_id = input_params.curve;
- sess = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool);
- if (sess == NULL) {
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess);
+ if (ret < 0) {
RTE_LOG(ERR, USER1,
"line %u FAILED: %s", __LINE__,
"Session creation failed\n");
- status = TEST_FAILED;
+ status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
goto exit;
}