* [PATCH 1/4] app/test: remove testsuite calls from ut setup
2023-05-17 21:18 [PATCH 0/4] Replace obsolote test cases Arek Kusztal
@ 2023-05-17 21:18 ` Arek Kusztal
2023-05-25 15:18 ` Power, Ciara
2023-05-17 21:18 ` [PATCH 2/4] app/test: refactor mod exp test case Arek Kusztal
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Arek Kusztal @ 2023-05-17 21:18 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, ciara.power, Arek Kusztal
Unit test setup should be responsible for setting unit
test parateres only, analogous rules should apply to ut teardown
function.
Cryptodev start/stop functions should be used once - during
setting the testsuite.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev_asym.c | 310 ++++++++++++++-------------------
1 file changed, 130 insertions(+), 180 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 9236817650..026fa48c9e 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -41,12 +41,13 @@ struct crypto_testsuite_params_asym {
struct rte_cryptodev_qp_conf qp_conf;
uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
uint8_t valid_dev_count;
-};
+} _testsuite_params, *params = &_testsuite_params;
-struct crypto_unittest_params {
+static struct ut_args {
void *sess;
struct rte_crypto_op *op;
-};
+ struct rte_crypto_op *result_op;
+} _args, *self = &_args;
union test_case_structure {
struct modex_test_data modex;
@@ -62,14 +63,11 @@ static struct test_cases_array test_vector = {0, { NULL } };
static uint32_t test_index;
-static struct crypto_testsuite_params_asym testsuite_params = { NULL };
-
static int
queue_ops_rsa_sign_verify(void *sess)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_op *op, *result_op;
struct rte_crypto_asym_op *asym_op;
uint8_t output_buf[TEST_DATA_SIZE];
@@ -158,9 +156,8 @@ queue_ops_rsa_sign_verify(void *sess)
static int
queue_ops_rsa_enc_dec(void *sess)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_op *op, *result_op;
struct rte_crypto_asym_op *asym_op;
uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
@@ -299,7 +296,7 @@ test_cryptodev_asym_ver(struct rte_crypto_op *op,
}
static int
-test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
+test_cryptodev_asym_op(struct crypto_testsuite_params_asym *params,
union test_case_structure *data_tc,
char *test_msg, int sessionless, enum rte_crypto_asym_op_type type,
enum rte_crypto_rsa_priv_key_type key_type)
@@ -311,7 +308,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
void *sess = NULL;
struct rte_cryptodev_asym_capability_idx cap_idx;
const struct rte_cryptodev_asymmetric_xform_capability *capability;
- uint8_t dev_id = ts_params->valid_devs[0];
+ uint8_t dev_id = params->valid_devs[0];
uint8_t input[TEST_DATA_SIZE] = {0};
uint8_t *result = NULL;
@@ -330,7 +327,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
}
/* Generate crypto op data structure */
- op = rte_crypto_op_alloc(ts_params->op_mpool,
+ op = rte_crypto_op_alloc(params->op_mpool,
RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
if (!op) {
@@ -451,7 +448,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
if (!sessionless) {
ret = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
- ts_params->session_mpool, &sess);
+ params->session_mpool, &sess);
if (ret < 0) {
snprintf(test_msg, ASYM_TEST_MSG_LEN,
"line %u "
@@ -524,7 +521,7 @@ test_one_case(const void *test_case, int sessionless)
if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX
|| tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {
- status = test_cryptodev_asym_op(&testsuite_params, &tc, test_msg,
+ status = test_cryptodev_asym_op(params, &tc, test_msg,
sessionless, 0, 0);
printf(" %u) TestCase %s %s\n", test_index++,
tc.modex.description, test_msg);
@@ -534,7 +531,7 @@ test_one_case(const void *test_case, int sessionless)
if (tc.rsa_data.op_type_flags & (1 << i)) {
if (tc.rsa_data.key_exp) {
status = test_cryptodev_asym_op(
- &testsuite_params, &tc,
+ params, &tc,
test_msg, sessionless, i,
RTE_RSA_KEY_TYPE_EXP);
}
@@ -544,7 +541,7 @@ test_one_case(const void *test_case, int sessionless)
RTE_CRYPTO_ASYM_OP_DECRYPT ||
i == RTE_CRYPTO_ASYM_OP_SIGN)) {
status = test_cryptodev_asym_op(
- &testsuite_params,
+ params,
&tc, test_msg, sessionless, i,
RTE_RSA_KEY_TYPE_QT);
}
@@ -564,17 +561,6 @@ static int
load_test_vectors(void)
{
uint32_t i = 0, v_size = 0;
- /* Load MODEX vector*/
- v_size = RTE_DIM(modex_test_case);
- for (i = 0; i < v_size; i++) {
- if (test_vector.size >= (TEST_VECTOR_SIZE)) {
- RTE_LOG(DEBUG, USER1,
- "TEST_VECTOR_SIZE too small\n");
- return -1;
- }
- test_vector.address[test_vector.size] = &modex_test_case[i];
- test_vector.size++;
- }
/* Load MODINV vector*/
v_size = RTE_DIM(modinv_test_case);
for (i = 0; i < v_size; i++) {
@@ -604,9 +590,8 @@ static int
test_one_by_one(void)
{
int status = TEST_SUCCESS;
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint32_t i = 0;
- uint8_t dev_id = ts_params->valid_devs[0];
+ uint8_t dev_id = params->valid_devs[0];
struct rte_cryptodev_info dev_info;
int sessionless = 0;
@@ -637,9 +622,8 @@ test_one_by_one(void)
static int
test_rsa_sign_verify(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;
@@ -677,9 +661,8 @@ test_rsa_sign_verify(void)
static int
test_rsa_enc_dec(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;
@@ -717,9 +700,8 @@ test_rsa_enc_dec(void)
static int
test_rsa_sign_verify_crt(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;
@@ -757,9 +739,8 @@ test_rsa_sign_verify_crt(void)
static int
test_rsa_enc_dec_crt(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;
@@ -797,26 +778,25 @@ test_rsa_enc_dec_crt(void)
static int
testsuite_setup(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
struct rte_cryptodev_info info;
int ret, dev_id = -1;
uint32_t i, nb_devs;
uint16_t qp_id;
- memset(ts_params, 0, sizeof(*ts_params));
+ memset(params, 0, sizeof(*params));
test_vector.size = 0;
load_test_vectors();
/* Device, op pool and session configuration for asymmetric crypto. 8< */
- ts_params->op_mpool = rte_crypto_op_pool_create(
+ params->op_mpool = rte_crypto_op_pool_create(
"CRYPTO_ASYM_OP_POOL",
RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
TEST_NUM_BUFS, 0,
0,
rte_socket_id());
- if (ts_params->op_mpool == NULL) {
+ if (params->op_mpool == NULL) {
RTE_LOG(ERR, USER1, "Can't create ASYM_CRYPTO_OP_POOL\n");
return TEST_FAILED;
}
@@ -854,7 +834,7 @@ testsuite_setup(void)
for (i = 0; i < nb_devs ; i++) {
rte_cryptodev_info_get(valid_devs[i], &info);
if (info.feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) {
- dev_id = ts_params->valid_devs[0] = valid_devs[i];
+ dev_id = params->valid_devs[0] = valid_devs[i];
break;
}
}
@@ -866,106 +846,58 @@ testsuite_setup(void)
}
/* Set valid device count */
- ts_params->valid_dev_count = nb_devs;
+ params->valid_dev_count = nb_devs;
/* configure device with num qp */
- ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
- ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.ff_disable = RTE_CRYPTODEV_FF_SECURITY |
+ params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
+ params->conf.socket_id = SOCKET_ID_ANY;
+ params->conf.ff_disable = RTE_CRYPTODEV_FF_SECURITY |
RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO;
TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
- &ts_params->conf),
+ ¶ms->conf),
"Failed to configure cryptodev %u with %u qps",
- dev_id, ts_params->conf.nb_queue_pairs);
+ dev_id, params->conf.nb_queue_pairs);
/* configure qp */
- ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
- ts_params->qp_conf.mp_session = ts_params->session_mpool;
+ params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+ params->qp_conf.mp_session = params->session_mpool;
for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
- dev_id, qp_id, &ts_params->qp_conf,
+ dev_id, qp_id, ¶ms->qp_conf,
rte_cryptodev_socket_id(dev_id)),
"Failed to setup queue pair %u on cryptodev %u ASYM",
qp_id, dev_id);
}
- ts_params->session_mpool = rte_cryptodev_asym_session_pool_create(
+ params->session_mpool = rte_cryptodev_asym_session_pool_create(
"test_asym_sess_mp", TEST_NUM_SESSIONS, 0, 0,
SOCKET_ID_ANY);
- TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
+ TEST_ASSERT_NOT_NULL(params->session_mpool,
"session mempool allocation failed");
/* >8 End of device, op pool and session configuration for asymmetric crypto section. */
- return TEST_SUCCESS;
-}
-
-static void
-testsuite_teardown(void)
-{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
-
- /* Reset device */
- ts_params->qp_conf.mp_session = NULL;
- ts_params->conf.ff_disable = 0;
- if (rte_cryptodev_configure(ts_params->valid_devs[0], &ts_params->conf))
- RTE_LOG(DEBUG, USER1, "Could not reset cryptodev\n");
-
- if (ts_params->op_mpool != NULL) {
- RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
- rte_mempool_avail_count(ts_params->op_mpool));
- }
-
- /* Free session mempools */
- if (ts_params->session_mpool != NULL) {
- rte_mempool_free(ts_params->session_mpool);
- ts_params->session_mpool = NULL;
- }
-}
-
-static int
-ut_setup_asym(void)
-{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- uint16_t qp_id;
-
- /* Reconfigure device to default parameters */
- ts_params->conf.socket_id = SOCKET_ID_ANY;
-
- TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
- &ts_params->conf),
- "Failed to configure cryptodev %u",
- ts_params->valid_devs[0]);
-
- for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
- TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
- ts_params->valid_devs[0], qp_id,
- &ts_params->qp_conf,
- rte_cryptodev_socket_id(ts_params->valid_devs[0])),
- "Failed to setup queue pair %u on cryptodev %u",
- qp_id, ts_params->valid_devs[0]);
- }
-
- rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
-
- /* Start the device */
- TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]),
+ TEST_ASSERT_SUCCESS(rte_cryptodev_start(params->valid_devs[0]),
"Failed to start cryptodev %u",
- ts_params->valid_devs[0]);
+ params->valid_devs[0]);
return TEST_SUCCESS;
}
static void
-ut_teardown_asym(void)
+testsuite_teardown(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_cryptodev_stats stats;
-
- rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
-
- /* Stop the device */
- rte_cryptodev_stop(ts_params->valid_devs[0]);
+ params->qp_conf.mp_session = NULL;
+ params->conf.ff_disable = 0;
+ if (params->op_mpool != NULL) {
+ rte_mempool_free(params->op_mpool);
+ params->op_mpool = NULL;
+ }
+ if (params->session_mpool != NULL) {
+ rte_mempool_free(params->session_mpool);
+ params->session_mpool = NULL;
+ }
+ rte_cryptodev_stop(params->valid_devs[0]);
}
static inline void print_asym_capa(
@@ -1008,8 +940,7 @@ static inline void print_asym_capa(
static int
test_capability(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- uint8_t dev_id = ts_params->valid_devs[0];
+ uint8_t dev_id = params->valid_devs[0];
struct rte_cryptodev_info dev_info;
const struct rte_cryptodev_capabilities *dev_capa;
int i = 0;
@@ -1045,10 +976,9 @@ test_capability(void)
static int
test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1127,10 +1057,9 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
static int
test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1207,10 +1136,9 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
static int
test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1295,10 +1223,9 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
static int
test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1381,10 +1308,9 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
static int
test_mod_inv(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1493,10 +1419,9 @@ test_mod_inv(void)
static int
test_mod_exp(void)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1641,10 +1566,9 @@ test_dh_keygenration(void)
static int
test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1724,10 +1648,9 @@ test_dsa_sign(struct rte_crypto_dsa_op_param *dsa_op)
static int
test_dsa_verify(struct rte_crypto_dsa_op_param *dsa_op)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- uint8_t dev_id = ts_params->valid_devs[0];
+ struct rte_mempool *op_mpool = params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_asym_op *asym_op = NULL;
struct rte_crypto_op *op = NULL, *result_op = NULL;
void *sess = NULL;
@@ -1837,12 +1760,11 @@ test_dsa(void)
static int
test_ecdsa_sign_verify(enum curve curve_id)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ struct rte_mempool *op_mpool = params->op_mpool;
struct crypto_testsuite_ecdsa_params input_params;
void *sess = NULL;
- uint8_t dev_id = ts_params->valid_devs[0];
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_op *result_op = NULL;
uint8_t output_buf_r[TEST_DATA_SIZE];
uint8_t output_buf_s[TEST_DATA_SIZE];
@@ -2038,12 +1960,11 @@ test_ecdsa_sign_verify_all_curve(void)
static int
test_ecpm(enum curve curve_id)
{
- struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
- struct rte_mempool *sess_mpool = ts_params->session_mpool;
- struct rte_mempool *op_mpool = ts_params->op_mpool;
+ struct rte_mempool *sess_mpool = params->session_mpool;
+ struct rte_mempool *op_mpool = params->op_mpool;
struct crypto_testsuite_ecpm_params input_params;
void *sess = NULL;
- uint8_t dev_id = ts_params->valid_devs[0];
+ uint8_t dev_id = params->valid_devs[0];
struct rte_crypto_op *result_op = NULL;
uint8_t output_buf_x[TEST_DATA_SIZE];
uint8_t output_buf_y[TEST_DATA_SIZE];
@@ -2196,25 +2117,54 @@ test_ecpm_all_curve(void)
return overall_status;
}
+static int
+setup_generic(void)
+{
+ memset(self, 0, sizeof(*self));
+ self->op = rte_crypto_op_alloc(params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
+ if (!self->op) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: Failed to allocate asymmetric crypto operation struct",
+ __LINE__);
+ return TEST_FAILED;
+ }
+ return TEST_SUCCESS;
+}
+
+static void
+teardown_generic(void)
+{
+ uint8_t dev_id = params->valid_devs[0];
+
+ if (self->sess != NULL)
+ rte_cryptodev_asym_session_free(dev_id, self->sess);
+ if (self->op != NULL)
+ rte_crypto_op_free(self->op);
+ self->sess = NULL;
+ self->op = NULL;
+ self->result_op = NULL;
+}
+
static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
.suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite",
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_dsa),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic, test_capability),
+ TEST_CASE_ST(setup_generic, teardown_generic, test_dsa),
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_dh_keygenration),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic, test_rsa_enc_dec),
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_enc_dec_crt),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify_crt),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_inv),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
+ TEST_CASE_ST(setup_generic, teardown_generic, test_mod_exp),
+ TEST_CASE_ST(setup_generic, teardown_generic, test_mod_inv),
+ TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -2224,7 +2174,7 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite = {
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
+ TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -2234,15 +2184,15 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = {
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic, test_capability),
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_enc_dec_crt),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify_crt),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic, test_mod_exp),
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_ecdsa_sign_verify_all_curve),
- TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ TEST_CASE_ST(setup_generic, teardown_generic,
test_ecpm_all_curve),
TEST_CASES_END() /**< NULL terminate unit test array */
}
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/4] app/test: remove testsuite calls from ut setup
2023-05-17 21:18 ` [PATCH 1/4] app/test: remove testsuite calls from ut setup Arek Kusztal
@ 2023-05-25 15:18 ` Power, Ciara
0 siblings, 0 replies; 8+ messages in thread
From: Power, Ciara @ 2023-05-25 15:18 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai
Hi Arek,
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday 17 May 2023 22:19
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; Power, Ciara
> <ciara.power@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH 1/4] app/test: remove testsuite calls from ut setup
>
> Unit test setup should be responsible for setting unit test parateres only,
Small typo: parameters
> analogous rules should apply to ut teardown function.
> Cryptodev start/stop functions should be used once - during setting the
> testsuite.
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> app/test/test_cryptodev_asym.c | 310 ++++++++++++++-------------------
> 1 file changed, 130 insertions(+), 180 deletions(-)
>
> diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
> index 9236817650..026fa48c9e 100644
> --- a/app/test/test_cryptodev_asym.c
> +++ b/app/test/test_cryptodev_asym.c
<snip>
Acked-by: Ciara Power <ciara.power@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] app/test: refactor mod exp test case
2023-05-17 21:18 [PATCH 0/4] Replace obsolote test cases Arek Kusztal
2023-05-17 21:18 ` [PATCH 1/4] app/test: remove testsuite calls from ut setup Arek Kusztal
@ 2023-05-17 21:18 ` Arek Kusztal
2023-05-26 14:32 ` Power, Ciara
2023-05-17 21:18 ` [PATCH 3/4] app/test: refactor mod inv tests Arek Kusztal
2023-05-17 21:19 ` [PATCH 4/4] app/test: add rsa kat and pwct tests Arek Kusztal
3 siblings, 1 reply; 8+ messages in thread
From: Arek Kusztal @ 2023-05-17 21:18 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, ciara.power, Arek Kusztal
Refactored modular exponentiation test case.
Added multiple vectors to be checked in KAT tests.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev_asym.c | 201 ++++----
app/test/test_cryptodev_asym_util.h | 9 -
app/test/test_cryptodev_mod_test_vectors.h | 567 +--------------------
3 files changed, 123 insertions(+), 654 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 026fa48c9e..eaf899d352 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -32,6 +32,7 @@
#endif
#define ASYM_TEST_MSG_LEN 256
#define TEST_VECTOR_SIZE 256
+#define DEQ_TIMEOUT 50
static int gbl_driver_id;
struct crypto_testsuite_params_asym {
@@ -63,6 +64,38 @@ static struct test_cases_array test_vector = {0, { NULL } };
static uint32_t test_index;
+static int send(struct rte_crypto_op **op,
+ struct rte_crypto_op **result_op)
+{
+ int ticks = 0;
+
+ if (rte_cryptodev_enqueue_burst(params->valid_devs[0], 0,
+ op, 1) != 1) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: Error sending packet for operation on device %d",
+ __LINE__, params->valid_devs[0]);
+ return TEST_FAILED;
+ }
+ while (rte_cryptodev_dequeue_burst(params->valid_devs[0], 0,
+ result_op, 1) == 0) {
+ rte_delay_ms(1);
+ ticks++;
+ if (ticks >= DEQ_TIMEOUT) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: Cannot dequeue the crypto op on device %d",
+ __LINE__, params->valid_devs[0]);
+ return TEST_FAILED;
+ }
+ }
+ TEST_ASSERT_NOT_NULL(*result_op,
+ "line %u FAILED: Failed to process asym crypto op",
+ __LINE__);
+ TEST_ASSERT_SUCCESS((*result_op)->status,
+ "line %u FAILED: Failed to process asym crypto op, error status received",
+ __LINE__);
+ return TEST_SUCCESS;
+}
+
static int
queue_ops_rsa_sign_verify(void *sess)
{
@@ -1417,113 +1450,60 @@ test_mod_inv(void)
}
static int
-test_mod_exp(void)
+modular_exponentiation(const void *test_data)
{
- struct rte_mempool *op_mpool = params->op_mpool;
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- struct rte_crypto_asym_op *asym_op = NULL;
- struct rte_crypto_op *op = NULL, *result_op = NULL;
- void *sess = NULL;
- int status = TEST_SUCCESS;
+ const struct modex_test_data *vector = test_data;
+ uint8_t input[TEST_DATA_SIZE] = { 0 };
+ uint8_t exponent[TEST_DATA_SIZE] = { 0 };
+ uint8_t modulus[TEST_DATA_SIZE] = { 0 };
+ uint8_t result[TEST_DATA_SIZE] = { 0 };
struct rte_cryptodev_asym_capability_idx cap_idx;
const struct rte_cryptodev_asymmetric_xform_capability *capability;
- uint8_t input[TEST_DATA_SIZE] = {0};
- int ret = 0;
- uint8_t result[sizeof(mod_p)] = { 0 };
+ struct rte_crypto_asym_xform xform = { };
+ const uint8_t dev_id = params->valid_devs[0];
- if (rte_cryptodev_asym_get_xform_enum(&modex_xform.xform_type,
- "modexp")
- < 0) {
- RTE_LOG(ERR, USER1,
- "Invalid ASYM algorithm specified\n");
- return -1;
- }
+ memcpy(input, vector->base.data, vector->base.len);
+ memcpy(exponent, vector->exponent.data, vector->exponent.len);
+ memcpy(modulus, vector->modulus.data, vector->modulus.len);
- /* check for modlen capability */
- cap_idx.type = modex_xform.xform_type;
- capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+ xform.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX;
+ xform.modex.exponent.data = exponent;
+ xform.modex.exponent.length = vector->exponent.len;
+ xform.modex.modulus.data = modulus;
+ xform.modex.modulus.length = vector->modulus.len;
+ cap_idx.type = xform.xform_type;
+ capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
if (capability == NULL) {
RTE_LOG(INFO, USER1,
"Device doesn't support MOD EXP. Test Skipped\n");
return TEST_SKIPPED;
}
-
if (rte_cryptodev_asym_xform_capability_check_modlen(
- capability, modex_xform.modex.modulus.length)) {
- RTE_LOG(ERR, USER1,
- "Invalid MODULUS length specified\n");
- return TEST_SKIPPED;
- }
-
- /* Create op, create session, and process packets. 8< */
- op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
- if (!op) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Failed to allocate asymmetric crypto "
- "operation struct");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- 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 = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- asym_op = op->asym;
- memcpy(input, base, sizeof(base));
- asym_op->modex.base.data = input;
- asym_op->modex.base.length = sizeof(base);
- asym_op->modex.result.data = result;
- asym_op->modex.result.length = sizeof(result);
- /* attach asymmetric crypto session to crypto operations */
- rte_crypto_op_attach_asym_session(op, sess);
-
- RTE_LOG(DEBUG, USER1, "Process ASYM operation");
- /* Process crypto operation */
- if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Error sending packet for operation");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Failed to process asym crypto op");
- status = TEST_FAILED;
- goto error_exit;
+ capability, xform.modex.modulus.length)) {
+ RTE_LOG(INFO, USER1,
+ "Invalid MODULUS length specified, not supported on this device\n"
+ );
+ return TEST_SKIPPED;
}
- /* >8 End of create op, create session, and process packets section. */
- ret = verify_modexp(mod_exp, result_op);
- if (ret) {
- RTE_LOG(ERR, USER1,
- "operation verification failed\n");
- status = TEST_FAILED;
+ if (rte_cryptodev_asym_session_create(dev_id, &xform,
+ params->session_mpool, &self->sess) < 0) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: Session creation failed",
+ __LINE__);
+ return TEST_FAILED;
}
-
-error_exit:
- if (sess != NULL)
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- rte_crypto_op_free(op);
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
+ rte_crypto_op_attach_asym_session(self->op, self->sess);
+ self->op->asym->modex.base.data = input;
+ self->op->asym->modex.base.length = vector->base.len;
+ self->op->asym->modex.result.data = result;
+
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->reminder.data,
+ self->result_op->asym->modex.result.data,
+ self->result_op->asym->modex.result.length,
+ "operation verification failed\n");
+ return TEST_SUCCESS;
}
static int
@@ -2146,6 +2126,12 @@ teardown_generic(void)
self->result_op = NULL;
}
+#define TC_DATA_GENERIC(func, data) \
+ TEST_CASE_NAMED_WITH_DATA( \
+ data.description, \
+ setup_generic, teardown_generic, \
+ func, &data)
+
static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
.suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite",
.setup = testsuite_setup,
@@ -2162,9 +2148,17 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
test_rsa_enc_dec_crt),
TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify_crt),
- TEST_CASE_ST(setup_generic, teardown_generic, test_mod_exp),
TEST_CASE_ST(setup_generic, teardown_generic, test_mod_inv),
TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ /* Modular Exponentiation */
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m128_b20_e3),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m60_b50_e40),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m255_b20_e10),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m448_b50_e40),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -2175,6 +2169,15 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite = {
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ /* Modular Exponentiation */
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m128_b20_e3),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m60_b50_e40),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m255_b20_e10),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m448_b50_e40),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -2189,11 +2192,19 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = {
test_rsa_enc_dec_crt),
TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify_crt),
- TEST_CASE_ST(setup_generic, teardown_generic, test_mod_exp),
TEST_CASE_ST(setup_generic, teardown_generic,
test_ecdsa_sign_verify_all_curve),
TEST_CASE_ST(setup_generic, teardown_generic,
test_ecpm_all_curve),
+ /* Modular Exponentiation */
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m128_b20_e3),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m60_b50_e40),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m255_b20_e10),
+ TC_DATA_GENERIC(modular_exponentiation,
+ modex_test_case_m448_b50_e40),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
diff --git a/app/test/test_cryptodev_asym_util.h b/app/test/test_cryptodev_asym_util.h
index 83dc265dd7..8bdff2ddf8 100644
--- a/app/test/test_cryptodev_asym_util.h
+++ b/app/test/test_cryptodev_asym_util.h
@@ -26,15 +26,6 @@ static inline int verify_modinv(uint8_t *mod_inv,
return 0;
}
-static inline int verify_modexp(uint8_t *mod_exp,
- struct rte_crypto_op *result_op)
-{
- if (memcmp(mod_exp, result_op->asym->modex.result.data,
- result_op->asym->modex.result.length))
- return -1;
- return 0;
-}
-
static inline int verify_ecdsa_sign(uint8_t *sign_r,
uint8_t *sign_s, struct rte_crypto_op *result_op)
{
diff --git a/app/test/test_cryptodev_mod_test_vectors.h b/app/test/test_cryptodev_mod_test_vectors.h
index 807ca7a47e..aa5f3e5334 100644
--- a/app/test/test_cryptodev_mod_test_vectors.h
+++ b/app/test/test_cryptodev_mod_test_vectors.h
@@ -47,9 +47,9 @@ struct modinv_test_data {
uint16_t result_len;
};
+/* ModExp #1 */
static const struct
-modex_test_data modex_test_case[] = {
-{
+modex_test_data modex_test_case_m128_b20_e3 = {
.description = "Modular Exponentiation "
"(mod=128, base=20, exp=3, res=128)",
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
@@ -110,8 +110,11 @@ modex_test_data modex_test_case[] = {
.len = 128
},
.result_len = 128
-},
-{
+};
+
+/* ModExp #2 */
+static const struct
+modex_test_data modex_test_case_m60_b50_e40 = {
.description = "Modular Exponentiation "
"(mod=60, base=50, exp=40, res=60)",
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
@@ -164,143 +167,11 @@ modex_test_data modex_test_case[] = {
.len = 60
},
.result_len = 60
-},
-{
- .description = "Modular Exponentiation "
- "(mod=8, base=65, exp=17, res=8)",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .base = {
- .data = {
- 0x25, 0x74, 0x41, 0xCE, 0xFA, 0x5C, 0x07, 0x2A,
- 0xD1, 0x74, 0xF3, 0x3D, 0xE1, 0xCC, 0xC3, 0x18,
- 0x7E, 0x4A, 0x21, 0x9F, 0x97, 0xA3, 0x26, 0x85,
- 0x85, 0xD9, 0x9B, 0xE3, 0xBA, 0xB3, 0x70, 0xC9,
- 0x26, 0x68, 0xE4, 0xB7, 0x4C, 0x88, 0x48, 0xC1,
- 0x6B, 0xC6, 0x3C, 0x00, 0x8C, 0x6B, 0xC6, 0x11,
- 0xD0, 0xD6, 0x61, 0x5D, 0xEC, 0xAA, 0xBA, 0x3B,
- 0x7D, 0xB3, 0x0D, 0x3F, 0xA5, 0x4D, 0xEE, 0xE4,
- 0xAC
- },
- .len = 65
- },
- .exponent = {
- .data = {
- 0x1C, 0x54, 0x2F, 0xCA, 0xDE, 0x4F, 0x17, 0x38,
- 0x69, 0x87, 0xB4, 0xFF, 0x3A, 0x6C, 0x82, 0x70,
- 0x53
- },
- .len = 17
- },
- .reminder = {
- .data = {
- 0x52, 0x06, 0x1A, 0x35, 0x70, 0x33, 0x78, 0x45
- },
- .len = 8
- },
- .modulus = {
- .data = {
- 0x6B, 0x6D, 0xFA, 0xCB, 0x09, 0x5D, 0x9C, 0xFD
- },
- .len = 8
- },
- .result_len = 8
-},
-{
- .description = "Modular Exponentiation "
- "(mod=100, base=150, exp=192, res=100)",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .base = {
- .data = {
- 0xC1, 0xA1, 0x04, 0xE4, 0x4D, 0x4A, 0xD3, 0x5C,
- 0xB3, 0xD0, 0x16, 0x51, 0xA7, 0xF4, 0x82, 0x6C,
- 0x22, 0xDD, 0x4D, 0xAA, 0x70, 0x30, 0x25, 0xA7,
- 0xFA, 0xA9, 0xF2, 0x20, 0x55, 0x9B, 0xEA, 0x26,
- 0xF6, 0xB5, 0xF8, 0x9C, 0x46, 0x21, 0x85, 0x0E,
- 0x38, 0x73, 0x01, 0xC6, 0x72, 0x67, 0x9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, 0x94, 0x72, 0xFE,
- 0x19, 0x26, 0x50, 0x47, 0x77, 0xAD, 0x0A, 0x45,
- 0x76, 0x4B, 0x22, 0xDB, 0x05, 0x13, 0x67, 0x40,
- 0x9A, 0x36, 0x6C, 0x5E, 0xE8, 0xED, 0x40, 0x60,
- 0x86, 0x40, 0x2F, 0x30, 0x9E, 0x4B, 0x61, 0x73,
- 0x2E, 0x76, 0x8A, 0xB0, 0x49, 0x04, 0x1A, 0x82,
- 0xB7, 0xEF, 0xB2, 0xB5, 0xB4, 0xE0, 0x87, 0xF0,
- 0xB4, 0x53, 0xB2, 0xBE
- },
- .len = 100
- },
- .modulus = {
- .data = {
- 0x54, 0x58, 0x5C, 0xBA, 0xAE, 0xC1, 0xB4, 0x46,
- 0x50, 0xAF, 0xD0, 0xA6, 0x03, 0x9D, 0x74, 0x84,
- 0x6F, 0x89, 0x07, 0xA6, 0x63, 0xE7, 0x34, 0xB2,
- 0x55, 0x0E, 0xD5, 0x42, 0xC9, 0xBF, 0xD1, 0x89,
- 0x54, 0x0B, 0x76, 0xF7, 0x0E, 0xA1, 0x42, 0x02,
- 0x72, 0xDC, 0x28, 0x5A, 0x68, 0x10, 0xA0, 0x84,
- 0xA4, 0x72, 0x4D, 0x40, 0x69, 0xBC, 0x18, 0xC9,
- 0x92, 0x69, 0xB8, 0x52, 0x2A, 0xB1, 0xA3, 0x43,
- 0x80, 0xA9, 0x55, 0x78, 0xEA, 0xD9, 0x54, 0xF4,
- 0x3A, 0xDD, 0x24, 0x4E, 0x22, 0x9D, 0x89, 0x40,
- 0x8F, 0x50, 0xA5, 0xF5, 0x0F, 0xFA, 0x38, 0xBB,
- 0xE8, 0xD7, 0x21, 0x6B, 0xEA, 0xB1, 0x28, 0x48,
- 0xEB, 0x75, 0xB1, 0xC7
- },
- .len = 100
- },
- .result_len = 100
-},
-{
+};
+
+/* ModExp #3 */
+static const struct
+modex_test_data modex_test_case_m255_b20_e10 = {
.description = "Modular Exponentiation "
"(mod=255, base=20, exp=10, res=255)",
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
@@ -394,274 +265,11 @@ modex_test_data modex_test_case[] = {
.len = 255
},
.result_len = 255
-},
-{
- .description = "Modular Exponentiation "
- "(mod=112, base=257, exp=43, res=112)",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .base = {
- .data = {
- 0x53, 0x63, 0xB0, 0x3A, 0x30, 0xDE, 0x07, 0xBC,
- 0xE4, 0x4B, 0x52, 0x37, 0x9C, 0xD8, 0x5A, 0xCD,
- 0x03, 0xE1, 0xEA, 0x6D, 0xDE, 0x4C, 0x19, 0xE6,
- 0xA2, 0x0F, 0xAE, 0x56, 0xCD, 0xB2, 0xB6, 0x5B,
- 0x31, 0xF5, 0x41, 0x48, 0x8D, 0xA2, 0xC7, 0x0C,
- 0x19, 0x32, 0x6D, 0x58, 0x10, 0xD5, 0xF0, 0x64,
- 0xF9, 0xF5, 0xD7, 0xFE, 0x37, 0x4A, 0xD8, 0xE3,
- 0xBF, 0xDF, 0xCB, 0x45, 0xD5, 0xBF, 0xB9, 0x2A,
- 0x60, 0xF8, 0x52, 0xB0, 0xB5, 0x22, 0x76, 0xBD,
- 0xD3, 0x0D, 0xD4, 0xE1, 0x42, 0xC4, 0x8C, 0x47,
- 0x2D, 0x04, 0x25, 0x1B, 0xFB, 0x21, 0xFD, 0x80,
- 0xC0, 0xCE, 0x9D, 0x32, 0x76, 0x8E, 0x18, 0x28,
- 0xDC, 0x0F, 0x44, 0x37, 0xF8, 0x61, 0x45, 0x93,
- 0xD3, 0x62, 0x21, 0xEE, 0x8B, 0x89, 0x8B, 0xAF,
- 0x8B, 0xE9, 0xA5, 0xD2, 0x00, 0xF5, 0xFF, 0xE6,
- 0xE0, 0x56, 0x9D, 0x41, 0x13, 0xBC, 0xD6, 0x6E,
- 0xC9, 0xE8, 0xE8, 0xC7, 0x61, 0x00, 0x7D, 0x91,
- 0x59, 0xAC, 0x6A, 0x24, 0x86, 0x3C, 0x50, 0xFB,
- 0x49, 0xC4, 0xB9, 0x41, 0xCD, 0xF0, 0xD9, 0xE7,
- 0xE1, 0x54, 0x3F, 0x17, 0x3B, 0xC7, 0x12, 0x20,
- 0x6E, 0xC5, 0x80, 0x11, 0xA5, 0x78, 0x72, 0xCA,
- 0xBC, 0x90, 0xB7, 0xC5, 0xFF, 0x78, 0xE5, 0x71,
- 0x62, 0x4C, 0xCC, 0x6C, 0xEA, 0x76, 0xE3, 0xB6,
- 0x00, 0x54, 0x31, 0x72, 0x5A, 0xFE, 0x14, 0xC3,
- 0x60, 0x3A, 0x79, 0x97, 0x26, 0x87, 0x69, 0x8D,
- 0x44, 0x8E, 0x8B, 0xE0, 0xBC, 0x5C, 0x9F, 0xDE,
- 0xD0, 0x90, 0xA2, 0x85, 0xC8, 0x3E, 0x7E, 0xA0,
- 0x42, 0xE2, 0x3B, 0xEE, 0x0C, 0x59, 0x1E, 0x72,
- 0x62, 0xA5, 0xEE, 0x20, 0xE0, 0xFE, 0x0D, 0xD3,
- 0x9F, 0xA9, 0x84, 0xBC, 0xD0, 0x6E, 0x5E, 0xC2,
- 0x0B, 0xF2, 0xAE, 0xB6, 0xE6, 0xC6, 0x88, 0xF9,
- 0x51, 0xF8, 0x02, 0x08, 0xC6, 0x99, 0x73, 0xF2,
- 0x36
- },
- .len = 257
- },
- .exponent = {
- .data = {
- 0xCA, 0x5C, 0x73, 0xF7, 0x8B, 0x1F, 0x95, 0xE4,
- 0x0E, 0x9B, 0x47, 0xDC, 0x03, 0x96, 0x75, 0xB4,
- 0x48, 0x74, 0x73, 0xBE, 0xF8, 0x92, 0x80, 0xE4,
- 0x93, 0x5D, 0x87, 0x7D, 0x74, 0xF7, 0x45, 0xEF,
- 0x8E, 0x53, 0x9C, 0x03, 0xB0, 0xD6, 0xF3, 0xBF,
- 0x86, 0xB2, 0xCD
- },
- .len = 43
- },
- .reminder = {
- .data = {
- 0x01, 0x0E, 0x8C, 0x1B, 0x19, 0xF6, 0xB0, 0x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E1, 0x88, 0xD0, 0x20, 0x04, 0x36,
- 0xA4, 0xA0, 0xB0, 0x3B, 0x61, 0x9B, 0x83, 0xDB,
- 0x05, 0x77, 0x5A, 0x5E, 0x87, 0xA6, 0xBE, 0x6A,
- 0x2A, 0xB4, 0x30, 0x10, 0x8D, 0x3B, 0xBC, 0x84,
- 0x9E, 0xB2, 0x21, 0x7E, 0xAC, 0x67, 0x94, 0x9F,
- 0xF1, 0x32, 0x3C, 0xF0, 0x94, 0x83, 0xF8, 0x19
- },
- .len = 112
- },
- .result_len = 112
-},
-{
- .description = "Modular Exponentiation "
- "(mod=299, base=240, exp=321, res=299)",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .base = {
- .data = {
- 0xAF, 0xE4, 0xCF, 0x9F, 0x7C, 0x20, 0x72, 0xE9,
- 0x50, 0x2E, 0xE5, 0xE4, 0xEF, 0x80, 0x28, 0xB3,
- 0x3A, 0x92, 0xAC, 0xCD, 0xF1, 0x6B, 0x7D, 0x83,
- 0x78, 0x4E, 0x9B, 0x30, 0x1E, 0xF4, 0x11, 0x15,
- 0x49, 0xAC, 0x06, 0xA2, 0x92, 0xB9, 0x91, 0x1B,
- 0xE8, 0xC8, 0xBC, 0x8A, 0x6F, 0xB2, 0xB8, 0x7C,
- 0xC5, 0xD3, 0x68, 0x60, 0xA4, 0x37, 0x7A, 0x6E,
- 0x3A, 0x1C, 0xAE, 0xAC, 0x70, 0x7B, 0x03, 0xE0,
- 0xDC, 0x7D, 0x51, 0x2E, 0x04, 0xC1, 0xD4, 0xA8,
- 0x5A, 0xE1, 0xE8, 0xAD, 0x83, 0x0C, 0x0C, 0x2D,
- 0x93, 0x8A, 0x07, 0x25, 0xC6, 0xE1, 0xAB, 0xD7,
- 0x2F, 0xC4, 0x14, 0x2E, 0x68, 0x89, 0xA7, 0xEA,
- 0x4E, 0x7B, 0xC4, 0x05, 0xD4, 0xB7, 0xC1, 0x9B,
- 0x9D, 0x8D, 0x58, 0x33, 0xE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0xAB, 0x6E, 0xBE,
- 0x79, 0xE4, 0x0F, 0xCE, 0x9C, 0x59, 0xF2, 0xF4,
- 0x26, 0xAB, 0x0F
- },
- .len = 299
- },
- .result_len = 299
-},
-{
+};
+
+/* ModExp #4 */
+static const struct
+modex_test_data modex_test_case_m448_b50_e40 = {
.description = "Modular Exponentiation "
"(mod=448, base=50, exp=40, res=448)",
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
@@ -810,107 +418,6 @@ modex_test_data modex_test_case[] = {
.len = 448
},
.result_len = 448
-},
-{
- .description = "Modular Exponentiation "
- "(mod=19, base=500, exp=35, res=19)",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .base = {
- .data = {
- 0x42, 0xE5, 0x6F, 0xF7, 0xEF, 0x8F, 0xAB, 0x6F,
- 0xF5, 0xE2, 0xD2, 0x97, 0x68, 0x0D, 0x52, 0xDD,
- 0x3D, 0x62, 0xC4, 0xC4, 0xDE, 0xD2, 0x07, 0x50,
- 0x1B, 0xA9, 0x5F, 0xAE, 0x42, 0xCB, 0x5E, 0x0B,
- 0xC0, 0x41, 0xFE, 0xEF, 0x22, 0xA6, 0x4E, 0x35,
- 0x80, 0x61, 0x22, 0x92, 0x65, 0x77, 0x45, 0x84,
- 0x6C, 0x03, 0x7C, 0xEF, 0xC0, 0x49, 0x31, 0x87,
- 0x86, 0x9B, 0x2E, 0x28, 0xA1, 0x55, 0x2D, 0x3C,
- 0x68, 0x3D, 0x69, 0x0E, 0x98, 0xD6, 0x40, 0xFD,
- 0x0B, 0x4C, 0x5F, 0xC7, 0x95, 0xF1, 0x53, 0x7C,
- 0xCC, 0x12, 0x3F, 0x8C, 0x7A, 0x24, 0x73, 0xE7,
- 0x33, 0x20, 0xBD, 0x0C, 0xD2, 0x9C, 0x12, 0x20,
- 0xC0, 0xC0, 0xA9, 0x16, 0x7E, 0x6B, 0x1D, 0x1F,
- 0xFE, 0x63, 0x8A, 0x22, 0x75, 0xDC, 0xF0, 0x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5F, 0x4A,
- 0x8A, 0x45, 0xBE, 0xDD, 0x89, 0xE2, 0x2A, 0xA7,
- 0xBC, 0xE9, 0x84, 0x53, 0x9D, 0xF4, 0x39, 0xB7,
- 0xDB, 0x3A, 0x17, 0xF7, 0x27, 0x39, 0xDF, 0x8A,
- 0xF0, 0x72, 0xD6, 0x23, 0x1B, 0x1C, 0xD9, 0x48,
- 0xF4, 0x2E, 0x54, 0xA3
- },
- .len = 500
- },
- .exponent = {
- .data = {
- 0xE7, 0xF1, 0x97, 0x29, 0x62, 0x0B, 0x99, 0x89,
- 0x99, 0xC1, 0x63, 0xA2, 0xB7, 0x29, 0xAD, 0x0E,
- 0x84, 0x3B, 0x86, 0x82, 0xC4, 0xDD, 0xC4, 0xE2,
- 0xA7, 0xD4, 0xBA, 0x91, 0x2C, 0xB5, 0xD6, 0xD4,
- 0x74, 0x1D, 0xE1
- },
- .len = 35
- },
- .reminder = {
- .data = {
- 0x67, 0x9F, 0xF7, 0x57, 0xD7, 0xF8, 0xF8, 0x90,
- 0x4E, 0xB5, 0x34, 0xE8, 0xAF, 0x14, 0xC6, 0x94,
- 0x5F, 0xA1, 0x03
- },
- .len = 19
- },
- .modulus = {
- .data = {
- 0x9C, 0xE7, 0xE7, 0x14, 0x6E, 0x07, 0x71, 0xD2,
- 0xD1, 0xB3, 0x59, 0x9B, 0x63, 0xDB, 0x58, 0x8D,
- 0x5E, 0x84, 0xA0
- },
- .len = 19
- },
- .result_len = 19
-}
};
static const struct
@@ -1000,29 +507,6 @@ uint8_t mod_p[] = {
0x55
};
-uint8_t mod_e[] = {0x01, 0x00, 0x01};
-/* >8 End of MODEX data. */
-
-/* Precomputed modular exponentiation for verification */
-uint8_t mod_exp[] = {
- 0x2C, 0x60, 0x75, 0x45, 0x98, 0x9D, 0xE0, 0x72,
- 0xA0, 0x9D, 0x3A, 0x9E, 0x03, 0x38, 0x73, 0x3C,
- 0x31, 0x83, 0x04, 0xFE, 0x75, 0x43, 0xE6, 0x17,
- 0x5C, 0x01, 0x29, 0x51, 0x69, 0x33, 0x62, 0x2D,
- 0x78, 0xBE, 0xAE, 0xC4, 0xBC, 0xDE, 0x7E, 0x2C,
- 0x77, 0x84, 0xF2, 0xC5, 0x14, 0xB5, 0x2F, 0xF7,
- 0xC5, 0x94, 0xEF, 0x86, 0x75, 0x75, 0xB5, 0x11,
- 0xE5, 0x0E, 0x0A, 0x29, 0x76, 0xE2, 0xEA, 0x32,
- 0x0E, 0x43, 0x77, 0x7E, 0x2C, 0x27, 0xAC, 0x3B,
- 0x86, 0xA5, 0xDB, 0xC9, 0x48, 0x40, 0xE8, 0x99,
- 0x9A, 0x0A, 0x3D, 0xD6, 0x74, 0xFA, 0x2E, 0x2E,
- 0x5B, 0xAF, 0x8C, 0x99, 0x44, 0x2A, 0x67, 0x38,
- 0x27, 0x41, 0x59, 0x9D, 0xB8, 0x51, 0xC9, 0xF7,
- 0x43, 0x61, 0x31, 0x6E, 0xF1, 0x25, 0x38, 0x7F,
- 0xAE, 0xC6, 0xD0, 0xBB, 0x29, 0x76, 0x3F, 0x46,
- 0x2E, 0x1B, 0xE4, 0x67, 0x71, 0xE3, 0x87, 0x5A
-};
-
/* Precomputed modular inverse for verification */
uint8_t mod_inv[] = {
0x52, 0xb1, 0xa3, 0x8c, 0xc5, 0x8a, 0xb9, 0x1f,
@@ -1043,23 +527,6 @@ uint8_t mod_inv[] = {
0x9a, 0x66, 0x9a, 0x3a, 0xc1, 0xb8, 0x4b, 0xc3
};
-/* MODEX vector. 8< */
-struct rte_crypto_asym_xform modex_xform = {
- .next = NULL,
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
- .modex = {
- .modulus = {
- .data = mod_p,
- .length = sizeof(mod_p)
- },
- .exponent = {
- .data = mod_e,
- .length = sizeof(mod_e)
- }
- }
-};
-/* >8 End of MODEX vector. */
-
struct rte_crypto_asym_xform modinv_xform = {
.next = NULL,
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV,
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 2/4] app/test: refactor mod exp test case
2023-05-17 21:18 ` [PATCH 2/4] app/test: refactor mod exp test case Arek Kusztal
@ 2023-05-26 14:32 ` Power, Ciara
0 siblings, 0 replies; 8+ messages in thread
From: Power, Ciara @ 2023-05-26 14:32 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday 17 May 2023 22:19
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; Power, Ciara
> <ciara.power@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH 2/4] app/test: refactor mod exp test case
>
> Refactored modular exponentiation test case.
> Added multiple vectors to be checked in KAT tests.
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
<snip>
Acked-by: Ciara Power <ciara.power@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] app/test: refactor mod inv tests
2023-05-17 21:18 [PATCH 0/4] Replace obsolote test cases Arek Kusztal
2023-05-17 21:18 ` [PATCH 1/4] app/test: remove testsuite calls from ut setup Arek Kusztal
2023-05-17 21:18 ` [PATCH 2/4] app/test: refactor mod exp test case Arek Kusztal
@ 2023-05-17 21:18 ` Arek Kusztal
2023-05-26 14:47 ` Power, Ciara
2023-05-17 21:19 ` [PATCH 4/4] app/test: add rsa kat and pwct tests Arek Kusztal
3 siblings, 1 reply; 8+ messages in thread
From: Arek Kusztal @ 2023-05-17 21:18 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, ciara.power, Arek Kusztal
Added new modular multiplicative inverse function.
Now it handles changes to the generic setup.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev_asym.c | 140 ++++++---------------
app/test/test_cryptodev_asym_util.h | 9 --
app/test/test_cryptodev_mod_test_vectors.h | 64 +---------
3 files changed, 41 insertions(+), 172 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index eaf899d352..7bdd7baa34 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -594,17 +594,6 @@ static int
load_test_vectors(void)
{
uint32_t i = 0, v_size = 0;
- /* Load MODINV vector*/
- v_size = RTE_DIM(modinv_test_case);
- for (i = 0; i < v_size; i++) {
- if (test_vector.size >= (TEST_VECTOR_SIZE)) {
- RTE_LOG(DEBUG, USER1,
- "TEST_VECTOR_SIZE too small\n");
- return -1;
- }
- test_vector.address[test_vector.size] = &modinv_test_case[i];
- test_vector.size++;
- }
/* Load RSA vector*/
v_size = RTE_DIM(rsa_test_case_list);
for (i = 0; i < v_size; i++) {
@@ -1339,32 +1328,26 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
}
static int
-test_mod_inv(void)
+modular_multiplicative_inverse(const void *test_data)
{
- struct rte_mempool *op_mpool = params->op_mpool;
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- struct rte_crypto_asym_op *asym_op = NULL;
- struct rte_crypto_op *op = NULL, *result_op = NULL;
- void *sess = NULL;
- int status = TEST_SUCCESS;
+ const struct modinv_test_data *vector = test_data;
+ uint8_t input[TEST_DATA_SIZE] = { 0 };
+ uint8_t modulus[TEST_DATA_SIZE] = { 0 };
+ uint8_t result[TEST_DATA_SIZE] = { 0 };
struct rte_cryptodev_asym_capability_idx cap_idx;
const struct rte_cryptodev_asymmetric_xform_capability *capability;
- uint8_t input[TEST_DATA_SIZE] = {0};
- int ret = 0;
- uint8_t result[sizeof(mod_p)] = { 0 };
+ struct rte_crypto_asym_xform xform = { };
+ const uint8_t dev_id = params->valid_devs[0];
- if (rte_cryptodev_asym_get_xform_enum(
- &modinv_xform.xform_type, "modinv") < 0) {
- RTE_LOG(ERR, USER1,
- "Invalid ASYM algorithm specified\n");
- return -1;
- }
+ memcpy(input, vector->base.data, vector->base.len);
+ memcpy(modulus, vector->modulus.data, vector->modulus.len);
- cap_idx.type = modinv_xform.xform_type;
+ xform.xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV;
+ xform.modex.modulus.data = modulus;
+ xform.modex.modulus.length = vector->modulus.len;
+ cap_idx.type = xform.xform_type;
capability = rte_cryptodev_asym_capability_get(dev_id,
&cap_idx);
-
if (capability == NULL) {
RTE_LOG(INFO, USER1,
"Device doesn't support MOD INV. Test Skipped\n");
@@ -1372,81 +1355,31 @@ test_mod_inv(void)
}
if (rte_cryptodev_asym_xform_capability_check_modlen(
- capability,
- modinv_xform.modinv.modulus.length)) {
- RTE_LOG(ERR, USER1,
- "Invalid MODULUS length specified\n");
- return TEST_SKIPPED;
- }
-
- 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 = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- /* generate crypto op data structure */
- op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
- if (!op) {
+ capability,
+ xform.modinv.modulus.length)) {
RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Failed to allocate asymmetric crypto "
- "operation struct");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- asym_op = op->asym;
- memcpy(input, base, sizeof(base));
- asym_op->modinv.base.data = input;
- asym_op->modinv.base.length = sizeof(base);
- asym_op->modinv.result.data = result;
- asym_op->modinv.result.length = sizeof(result);
-
- /* attach asymmetric crypto session to crypto operations */
- rte_crypto_op_attach_asym_session(op, sess);
-
- RTE_LOG(DEBUG, USER1, "Process ASYM operation");
-
- /* Process crypto operation */
- if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Error sending packet for operation");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: %s",
- __LINE__, "Failed to process asym crypto op");
- status = TEST_FAILED;
- goto error_exit;
+ "Invalid MODULUS length specified\n");
+ return TEST_SKIPPED;
}
-
- ret = verify_modinv(mod_inv, result_op);
- if (ret) {
- RTE_LOG(ERR, USER1,
- "operation verification failed\n");
- status = TEST_FAILED;
+ if (rte_cryptodev_asym_session_create(dev_id, &xform,
+ params->session_mpool, &self->sess) < 0) {
+ RTE_LOG(ERR, USER1, "line %u FAILED: Session creation failed",
+ __LINE__);
+ return TEST_FAILED;
}
+ rte_crypto_op_attach_asym_session(self->op, self->sess);
-error_exit:
- if (sess)
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- rte_crypto_op_free(op);
+ self->op->asym->modinv.base.data = input;
+ self->op->asym->modinv.base.length = vector->base.len;
+ self->op->asym->modinv.result.data = result;
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->inverse.data,
+ self->result_op->asym->modinv.result.data,
+ self->result_op->asym->modinv.result.length,
+ "operation verification failed\n");
+ return TEST_SUCCESS;
}
static int
@@ -2148,8 +2081,10 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
test_rsa_enc_dec_crt),
TEST_CASE_ST(setup_generic, teardown_generic,
test_rsa_sign_verify_crt),
- TEST_CASE_ST(setup_generic, teardown_generic, test_mod_inv),
TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ /* Modular Multiplicative Inverse */
+ TC_DATA_GENERIC(modular_multiplicative_inverse,
+ modinv_test_case),
/* Modular Exponentiation */
TC_DATA_GENERIC(modular_exponentiation,
modex_test_case_m128_b20_e3),
@@ -2169,6 +2104,9 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite = {
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ /* Modular Multiplicative Inverse */
+ TC_DATA_GENERIC(modular_multiplicative_inverse,
+ modinv_test_case),
/* Modular Exponentiation */
TC_DATA_GENERIC(modular_exponentiation,
modex_test_case_m128_b20_e3),
diff --git a/app/test/test_cryptodev_asym_util.h b/app/test/test_cryptodev_asym_util.h
index 8bdff2ddf8..19044a58ad 100644
--- a/app/test/test_cryptodev_asym_util.h
+++ b/app/test/test_cryptodev_asym_util.h
@@ -17,15 +17,6 @@ static inline int rsa_verify(struct rsa_test_data *rsa_param,
return 0;
}
-static inline int verify_modinv(uint8_t *mod_inv,
- struct rte_crypto_op *result_op)
-{
- if (memcmp(mod_inv, result_op->asym->modinv.result.data,
- result_op->asym->modinv.result.length))
- return -1;
- return 0;
-}
-
static inline int verify_ecdsa_sign(uint8_t *sign_r,
uint8_t *sign_s, struct rte_crypto_op *result_op)
{
diff --git a/app/test/test_cryptodev_mod_test_vectors.h b/app/test/test_cryptodev_mod_test_vectors.h
index aa5f3e5334..079d562c51 100644
--- a/app/test/test_cryptodev_mod_test_vectors.h
+++ b/app/test/test_cryptodev_mod_test_vectors.h
@@ -420,9 +420,9 @@ modex_test_data modex_test_case_m448_b50_e40 = {
.result_len = 448
};
+/* ModInv #1 */
static const struct
-modinv_test_data modinv_test_case[] = {
-{
+modinv_test_data modinv_test_case = {
.description = "Modular Inverse (mod=128, base=20, exp=3, inv=128)",
.xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV,
.base = {
@@ -476,66 +476,6 @@ modinv_test_data modinv_test_case[] = {
.len = 128
},
.result_len = 128
-}
-};
-
-/* modular operation test data */
-uint8_t base[] = {
- 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85,
- 0xAE, 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD,
- 0xA8, 0xEB, 0x7E, 0x78, 0xA0, 0x50
-};
-
-/* MODEX data. 8< */
-uint8_t mod_p[] = {
- 0x00, 0xb3, 0xa1, 0xaf, 0xb7, 0x13, 0x08, 0x00,
- 0x0a, 0x35, 0xdc, 0x2b, 0x20, 0x8d, 0xa1, 0xb5,
- 0xce, 0x47, 0x8a, 0xc3, 0x80, 0xf4, 0x7d, 0x4a,
- 0xa2, 0x62, 0xfd, 0x61, 0x7f, 0xb5, 0xa8, 0xde,
- 0x0a, 0x17, 0x97, 0xa0, 0xbf, 0xdf, 0x56, 0x5a,
- 0x3d, 0x51, 0x56, 0x4f, 0x70, 0x70, 0x3f, 0x63,
- 0x6a, 0x44, 0x5b, 0xad, 0x84, 0x0d, 0x3f, 0x27,
- 0x6e, 0x3b, 0x34, 0x91, 0x60, 0x14, 0xb9, 0xaa,
- 0x72, 0xfd, 0xa3, 0x64, 0xd2, 0x03, 0xa7, 0x53,
- 0x87, 0x9e, 0x88, 0x0b, 0xc1, 0x14, 0x93, 0x1a,
- 0x62, 0xff, 0xb1, 0x5d, 0x74, 0xcd, 0x59, 0x63,
- 0x18, 0x11, 0x3d, 0x4f, 0xba, 0x75, 0xd4, 0x33,
- 0x4e, 0x23, 0x6b, 0x7b, 0x57, 0x44, 0xe1, 0xd3,
- 0x03, 0x13, 0xa6, 0xf0, 0x8b, 0x60, 0xb0, 0x9e,
- 0xee, 0x75, 0x08, 0x9d, 0x71, 0x63, 0x13, 0xcb,
- 0xa6, 0x81, 0x92, 0x14, 0x03, 0x22, 0x2d, 0xde,
- 0x55
-};
-
-/* Precomputed modular inverse for verification */
-uint8_t mod_inv[] = {
- 0x52, 0xb1, 0xa3, 0x8c, 0xc5, 0x8a, 0xb9, 0x1f,
- 0xb6, 0x82, 0xf5, 0x6a, 0x9a, 0xde, 0x8d, 0x2e,
- 0x62, 0x4b, 0xac, 0x49, 0x21, 0x1d, 0x30, 0x4d,
- 0x32, 0xac, 0x1f, 0x40, 0x6d, 0x52, 0xc7, 0x9b,
- 0x6c, 0x0a, 0x82, 0x3a, 0x2c, 0xaf, 0x6b, 0x6d,
- 0x17, 0xbe, 0x43, 0xed, 0x97, 0x78, 0xeb, 0x4c,
- 0x92, 0x6f, 0xcf, 0xed, 0xb1, 0x09, 0xcb, 0x27,
- 0xc2, 0xde, 0x62, 0xfd, 0x21, 0xe6, 0xbd, 0x4f,
- 0xfe, 0x7a, 0x1b, 0x50, 0xfe, 0x10, 0x4a, 0xb0,
- 0xb7, 0xcf, 0xdb, 0x7d, 0xca, 0xc2, 0xf0, 0x1c,
- 0x39, 0x48, 0x6a, 0xb5, 0x4d, 0x8c, 0xfe, 0x63,
- 0x91, 0x9c, 0x21, 0xc3, 0x0e, 0x76, 0xad, 0x44,
- 0x8d, 0x54, 0x33, 0x99, 0xe1, 0x80, 0x19, 0xba,
- 0xb5, 0xac, 0x7d, 0x9c, 0xce, 0x91, 0x2a, 0xd9,
- 0x2c, 0xe1, 0x16, 0xd6, 0xd7, 0xcf, 0x9d, 0x05,
- 0x9a, 0x66, 0x9a, 0x3a, 0xc1, 0xb8, 0x4b, 0xc3
-};
-
-struct rte_crypto_asym_xform modinv_xform = {
- .next = NULL,
- .xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV,
- .modinv = {
- .modulus = {
- .data = mod_p,
- .length = sizeof(mod_p)
- }
- }
};
#endif /* TEST_CRYPTODEV_MOD_TEST_VECTORS_H__ */
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 3/4] app/test: refactor mod inv tests
2023-05-17 21:18 ` [PATCH 3/4] app/test: refactor mod inv tests Arek Kusztal
@ 2023-05-26 14:47 ` Power, Ciara
0 siblings, 0 replies; 8+ messages in thread
From: Power, Ciara @ 2023-05-26 14:47 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday 17 May 2023 22:19
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; Power, Ciara
> <ciara.power@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH 3/4] app/test: refactor mod inv tests
>
> Added new modular multiplicative inverse function.
> Now it handles changes to the generic setup.
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
Acked-by: Ciara Power <ciara.power@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] app/test: add rsa kat and pwct tests
2023-05-17 21:18 [PATCH 0/4] Replace obsolote test cases Arek Kusztal
` (2 preceding siblings ...)
2023-05-17 21:18 ` [PATCH 3/4] app/test: refactor mod inv tests Arek Kusztal
@ 2023-05-17 21:19 ` Arek Kusztal
3 siblings, 0 replies; 8+ messages in thread
From: Arek Kusztal @ 2023-05-17 21:19 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, ciara.power, Arek Kusztal
Added RSA PWCT and KAT tests. Now it complies
with setup/teardown logic.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev_asym.c | 1050 ++++++--------------
app/test/test_cryptodev_asym_util.h | 10 -
app/test/test_cryptodev_rsa_test_vectors.h | 600 ++++++-----
3 files changed, 581 insertions(+), 1079 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 7bdd7baa34..2c5a1120e9 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Cavium Networks
- * Copyright (c) 2019 Intel Corporation
+ * Copyright (c) 2019-2023 Intel Corporation
*/
#include <rte_bus_vdev.h>
@@ -62,741 +62,6 @@ struct test_cases_array {
};
static struct test_cases_array test_vector = {0, { NULL } };
-static uint32_t test_index;
-
-static int send(struct rte_crypto_op **op,
- struct rte_crypto_op **result_op)
-{
- int ticks = 0;
-
- if (rte_cryptodev_enqueue_burst(params->valid_devs[0], 0,
- op, 1) != 1) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: Error sending packet for operation on device %d",
- __LINE__, params->valid_devs[0]);
- return TEST_FAILED;
- }
- while (rte_cryptodev_dequeue_burst(params->valid_devs[0], 0,
- result_op, 1) == 0) {
- rte_delay_ms(1);
- ticks++;
- if (ticks >= DEQ_TIMEOUT) {
- RTE_LOG(ERR, USER1,
- "line %u FAILED: Cannot dequeue the crypto op on device %d",
- __LINE__, params->valid_devs[0]);
- return TEST_FAILED;
- }
- }
- TEST_ASSERT_NOT_NULL(*result_op,
- "line %u FAILED: Failed to process asym crypto op",
- __LINE__);
- TEST_ASSERT_SUCCESS((*result_op)->status,
- "line %u FAILED: Failed to process asym crypto op, error status received",
- __LINE__);
- return TEST_SUCCESS;
-}
-
-static int
-queue_ops_rsa_sign_verify(void *sess)
-{
- struct rte_mempool *op_mpool = params->op_mpool;
- uint8_t dev_id = params->valid_devs[0];
- struct rte_crypto_op *op, *result_op;
- struct rte_crypto_asym_op *asym_op;
- uint8_t output_buf[TEST_DATA_SIZE];
- int status = TEST_SUCCESS;
-
- /* Set up crypto op data structure */
- op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
- if (!op) {
- RTE_LOG(ERR, USER1, "Failed to allocate asymmetric crypto "
- "operation struct\n");
- return TEST_FAILED;
- }
-
- asym_op = op->asym;
-
- /* Compute sign on the test vector */
- asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_SIGN;
-
- asym_op->rsa.message.data = rsaplaintext.data;
- asym_op->rsa.message.length = rsaplaintext.len;
- asym_op->rsa.sign.length = 0;
- asym_op->rsa.sign.data = output_buf;
- 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);
-
- /* Attach asymmetric crypto session to crypto operations */
- rte_crypto_op_attach_asym_session(op, sess);
-
- RTE_LOG(DEBUG, USER1, "Process ASYM operation\n");
-
- /* Process crypto operation */
- if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
- RTE_LOG(ERR, USER1, "Error sending packet for sign\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1, "Failed to process sign op\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- debug_hexdump(stdout, "signed message", asym_op->rsa.sign.data,
- asym_op->rsa.sign.length);
- asym_op = result_op->asym;
-
- /* Verify sign */
- asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY;
- 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) {
- RTE_LOG(ERR, USER1, "Error sending packet for verify\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1, "Failed to process verify op\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- status = TEST_SUCCESS;
- if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
- RTE_LOG(ERR, USER1, "Failed to process sign-verify op\n");
- status = TEST_FAILED;
- }
-
-error_exit:
-
- rte_crypto_op_free(op);
-
- return status;
-}
-
-static int
-queue_ops_rsa_enc_dec(void *sess)
-{
- struct rte_mempool *op_mpool = params->op_mpool;
- uint8_t dev_id = params->valid_devs[0];
- struct rte_crypto_op *op, *result_op;
- struct rte_crypto_asym_op *asym_op;
- uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
- int ret, status = TEST_SUCCESS;
-
- /* Set up crypto op data structure */
- op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
- if (!op) {
- RTE_LOG(ERR, USER1, "Failed to allocate asymmetric crypto "
- "operation struct\n");
- return TEST_FAILED;
- }
-
- asym_op = op->asym;
-
- /* Compute encryption on the test vector */
- asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_ENCRYPT;
-
- asym_op->rsa.message.data = rsaplaintext.data;
- asym_op->rsa.cipher.data = cipher_buf;
- asym_op->rsa.cipher.length = 0;
- asym_op->rsa.message.length = rsaplaintext.len;
- 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);
-
- /* Attach asymmetric crypto session to crypto operations */
- rte_crypto_op_attach_asym_session(op, sess);
-
- RTE_LOG(DEBUG, USER1, "Process ASYM operation\n");
-
- /* Process crypto operation */
- if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
- RTE_LOG(ERR, USER1, "Error sending packet for encryption\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1, "Failed to process encryption op\n");
- status = TEST_FAILED;
- goto error_exit;
- }
- debug_hexdump(stdout, "encrypted message", asym_op->rsa.cipher.data,
- asym_op->rsa.cipher.length);
-
- /* Use the resulted output as decryption Input vector*/
- asym_op = result_op->asym;
- asym_op->rsa.message.length = 0;
- asym_op->rsa.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT;
- 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) {
- RTE_LOG(ERR, USER1, "Error sending packet for decryption\n");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- RTE_LOG(ERR, USER1, "Failed to process decryption op\n");
- status = TEST_FAILED;
- goto error_exit;
- }
- status = TEST_SUCCESS;
- ret = rsa_verify(&rsaplaintext, result_op);
- if (ret)
- status = TEST_FAILED;
-
-error_exit:
-
- rte_crypto_op_free(op);
-
- return status;
-}
-static int
-test_cryptodev_asym_ver(struct rte_crypto_op *op,
- struct rte_crypto_asym_xform *xform_tc,
- union test_case_structure *data_tc,
- struct rte_crypto_op *result_op)
-{
- int status = TEST_FAILED;
- int ret = 0;
- uint8_t *data_expected = NULL, *data_received = NULL;
- size_t data_size = 0;
-
- switch (data_tc->modex.xform_type) {
- case RTE_CRYPTO_ASYM_XFORM_MODEX:
- data_expected = data_tc->modex.reminder.data;
- data_received = result_op->asym->modex.result.data;
- data_size = result_op->asym->modex.result.length;
- break;
- case RTE_CRYPTO_ASYM_XFORM_MODINV:
- data_expected = data_tc->modinv.inverse.data;
- data_received = result_op->asym->modinv.result.data;
- data_size = result_op->asym->modinv.result.length;
- break;
- case RTE_CRYPTO_ASYM_XFORM_RSA:
- if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) {
- data_size = xform_tc->rsa.n.length;
- data_received = result_op->asym->rsa.cipher.data;
- data_expected = data_tc->rsa_data.ct.data;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
- data_size = xform_tc->rsa.n.length;
- data_expected = data_tc->rsa_data.pt.data;
- data_received = result_op->asym->rsa.message.data;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
- data_size = xform_tc->rsa.n.length;
- data_expected = data_tc->rsa_data.sign.data;
- data_received = result_op->asym->rsa.sign.data;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
- data_size = xform_tc->rsa.n.length;
- data_expected = data_tc->rsa_data.pt.data;
- data_received = result_op->asym->rsa.cipher.data;
- }
- break;
- case RTE_CRYPTO_ASYM_XFORM_DH:
- case RTE_CRYPTO_ASYM_XFORM_DSA:
- case RTE_CRYPTO_ASYM_XFORM_NONE:
- case RTE_CRYPTO_ASYM_XFORM_UNSPECIFIED:
- default:
- break;
- }
- ret = memcmp(data_expected, data_received, data_size);
- if (!ret && data_size)
- status = TEST_SUCCESS;
-
- return status;
-}
-
-static int
-test_cryptodev_asym_op(struct crypto_testsuite_params_asym *params,
- union test_case_structure *data_tc,
- char *test_msg, int sessionless, enum rte_crypto_asym_op_type type,
- enum rte_crypto_rsa_priv_key_type key_type)
-{
- struct rte_crypto_asym_op *asym_op = NULL;
- struct rte_crypto_op *op = NULL;
- struct rte_crypto_op *result_op = NULL;
- struct rte_crypto_asym_xform xform_tc;
- void *sess = NULL;
- struct rte_cryptodev_asym_capability_idx cap_idx;
- const struct rte_cryptodev_asymmetric_xform_capability *capability;
- uint8_t dev_id = params->valid_devs[0];
- uint8_t input[TEST_DATA_SIZE] = {0};
- uint8_t *result = NULL;
-
- int ret, status = TEST_SUCCESS;
-
- xform_tc.next = NULL;
- xform_tc.xform_type = data_tc->modex.xform_type;
-
- cap_idx.type = xform_tc.xform_type;
- capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
-
- if (capability == NULL) {
- RTE_LOG(INFO, USER1,
- "Device doesn't support MODEX. Test Skipped\n");
- return TEST_SKIPPED;
- }
-
- /* Generate crypto op data structure */
- op = rte_crypto_op_alloc(params->op_mpool,
- RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
-
- if (!op) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u FAILED: %s",
- __LINE__, "Failed to allocate asymmetric crypto "
- "operation struct");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- asym_op = op->asym;
-
- switch (xform_tc.xform_type) {
- case RTE_CRYPTO_ASYM_XFORM_MODEX:
- result = rte_zmalloc(NULL, data_tc->modex.result_len, 0);
- xform_tc.modex.modulus.data = data_tc->modex.modulus.data;
- xform_tc.modex.modulus.length = data_tc->modex.modulus.len;
- xform_tc.modex.exponent.data = data_tc->modex.exponent.data;
- xform_tc.modex.exponent.length = data_tc->modex.exponent.len;
- memcpy(input, data_tc->modex.base.data,
- data_tc->modex.base.len);
- asym_op->modex.base.data = input;
- asym_op->modex.base.length = data_tc->modex.base.len;
- asym_op->modex.result.data = result;
- asym_op->modex.result.length = data_tc->modex.result_len;
- if (rte_cryptodev_asym_xform_capability_check_modlen(capability,
- xform_tc.modex.modulus.length)) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u "
- "FAILED: %s", __LINE__,
- "Invalid MODULUS length specified");
- status = TEST_FAILED;
- goto error_exit;
- }
- break;
- case RTE_CRYPTO_ASYM_XFORM_MODINV:
- result = rte_zmalloc(NULL, data_tc->modinv.result_len, 0);
- xform_tc.modinv.modulus.data = data_tc->modinv.modulus.data;
- xform_tc.modinv.modulus.length = data_tc->modinv.modulus.len;
- memcpy(input, data_tc->modinv.base.data,
- data_tc->modinv.base.len);
- asym_op->modinv.base.data = input;
- asym_op->modinv.base.length = data_tc->modinv.base.len;
- asym_op->modinv.result.data = result;
- asym_op->modinv.result.length = data_tc->modinv.result_len;
- if (rte_cryptodev_asym_xform_capability_check_modlen(capability,
- xform_tc.modinv.modulus.length)) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u "
- "FAILED: %s", __LINE__,
- "Invalid MODULUS length specified");
- status = TEST_FAILED;
- goto error_exit;
- }
- break;
- case RTE_CRYPTO_ASYM_XFORM_RSA:
- result = rte_zmalloc(NULL, data_tc->rsa_data.n.len, 0);
- op->asym->rsa.op_type = type;
- xform_tc.rsa.e.data = data_tc->rsa_data.e.data;
- xform_tc.rsa.e.length = data_tc->rsa_data.e.len;
- xform_tc.rsa.n.data = data_tc->rsa_data.n.data;
- xform_tc.rsa.n.length = data_tc->rsa_data.n.len;
-
- if (key_type == RTE_RSA_KEY_TYPE_EXP) {
- xform_tc.rsa.d.data = data_tc->rsa_data.d.data;
- xform_tc.rsa.d.length = data_tc->rsa_data.d.len;
- } else {
- xform_tc.rsa.qt.p.data = data_tc->rsa_data.p.data;
- xform_tc.rsa.qt.p.length = data_tc->rsa_data.p.len;
- xform_tc.rsa.qt.q.data = data_tc->rsa_data.q.data;
- xform_tc.rsa.qt.q.length = data_tc->rsa_data.q.len;
- xform_tc.rsa.qt.dP.data = data_tc->rsa_data.dP.data;
- xform_tc.rsa.qt.dP.length = data_tc->rsa_data.dP.len;
- xform_tc.rsa.qt.dQ.data = data_tc->rsa_data.dQ.data;
- xform_tc.rsa.qt.dQ.length = data_tc->rsa_data.dQ.len;
- xform_tc.rsa.qt.qInv.data = data_tc->rsa_data.qInv.data;
- xform_tc.rsa.qt.qInv.length = data_tc->rsa_data.qInv.len;
- }
-
- xform_tc.rsa.key_type = key_type;
- 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;
- asym_op->rsa.message.length = data_tc->rsa_data.pt.len;
- asym_op->rsa.cipher.data = result;
- asym_op->rsa.cipher.length = data_tc->rsa_data.n.len;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
- asym_op->rsa.message.data = result;
- asym_op->rsa.message.length = data_tc->rsa_data.n.len;
- asym_op->rsa.cipher.data = data_tc->rsa_data.ct.data;
- asym_op->rsa.cipher.length = data_tc->rsa_data.ct.len;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_SIGN) {
- asym_op->rsa.sign.data = result;
- asym_op->rsa.sign.length = data_tc->rsa_data.n.len;
- asym_op->rsa.message.data = data_tc->rsa_data.pt.data;
- asym_op->rsa.message.length = data_tc->rsa_data.pt.len;
- } else if (op->asym->rsa.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) {
- asym_op->rsa.cipher.data = result;
- asym_op->rsa.cipher.length = data_tc->rsa_data.n.len;
- asym_op->rsa.sign.data = data_tc->rsa_data.sign.data;
- asym_op->rsa.sign.length = data_tc->rsa_data.sign.len;
- }
- break;
- case RTE_CRYPTO_ASYM_XFORM_DH:
- case RTE_CRYPTO_ASYM_XFORM_DSA:
- case RTE_CRYPTO_ASYM_XFORM_NONE:
- case RTE_CRYPTO_ASYM_XFORM_UNSPECIFIED:
- default:
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u "
- "FAILED: %s", __LINE__,
- "Invalid ASYM algorithm specified");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- if (!sessionless) {
- ret = rte_cryptodev_asym_session_create(dev_id, &xform_tc,
- params->session_mpool, &sess);
- if (ret < 0) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u "
- "FAILED: %s", __LINE__,
- "Session creation failed");
- status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- rte_crypto_op_attach_asym_session(op, sess);
- } else {
- asym_op->xform = &xform_tc;
- op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
- }
- RTE_LOG(DEBUG, USER1, "Process ASYM operation");
-
- /* Process crypto operation */
- if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u FAILED: %s",
- __LINE__, "Error sending packet for operation");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0)
- rte_pause();
-
- if (result_op == NULL) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u FAILED: %s",
- __LINE__, "Failed to process asym crypto op");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- if (test_cryptodev_asym_ver(op, &xform_tc, data_tc, result_op) != TEST_SUCCESS) {
- snprintf(test_msg, ASYM_TEST_MSG_LEN,
- "line %u FAILED: %s",
- __LINE__, "Verification failed ");
- status = TEST_FAILED;
- goto error_exit;
- }
-
- if (!sessionless)
- snprintf(test_msg, ASYM_TEST_MSG_LEN, "PASS");
- else
- snprintf(test_msg, ASYM_TEST_MSG_LEN, "SESSIONLESS PASS");
-
-error_exit:
- if (sess != NULL)
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- rte_crypto_op_free(op);
-
- rte_free(result);
-
- return status;
-}
-
-static int
-test_one_case(const void *test_case, int sessionless)
-{
- int status = TEST_SUCCESS, i = 0;
- char test_msg[ASYM_TEST_MSG_LEN + 1];
-
- /* Map the case to union */
- union test_case_structure tc;
- memcpy(&tc, test_case, sizeof(tc));
-
- if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX
- || tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {
- status = test_cryptodev_asym_op(params, &tc, test_msg,
- sessionless, 0, 0);
- printf(" %u) TestCase %s %s\n", test_index++,
- tc.modex.description, test_msg);
- } else {
- for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
- if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
- if (tc.rsa_data.op_type_flags & (1 << i)) {
- if (tc.rsa_data.key_exp) {
- status = test_cryptodev_asym_op(
- params, &tc,
- test_msg, sessionless, i,
- RTE_RSA_KEY_TYPE_EXP);
- }
- if (status)
- break;
- if (tc.rsa_data.key_qt && (i ==
- RTE_CRYPTO_ASYM_OP_DECRYPT ||
- i == RTE_CRYPTO_ASYM_OP_SIGN)) {
- status = test_cryptodev_asym_op(
- params,
- &tc, test_msg, sessionless, i,
- RTE_RSA_KEY_TYPE_QT);
- }
- if (status)
- break;
- }
- }
- }
- printf(" %u) TestCase %s %s\n", test_index++,
- tc.modex.description, test_msg);
- }
-
- return status;
-}
-
-static int
-load_test_vectors(void)
-{
- uint32_t i = 0, v_size = 0;
- /* Load RSA vector*/
- v_size = RTE_DIM(rsa_test_case_list);
- for (i = 0; i < v_size; i++) {
- if (test_vector.size >= (TEST_VECTOR_SIZE)) {
- RTE_LOG(DEBUG, USER1,
- "TEST_VECTOR_SIZE too small\n");
- return -1;
- }
- test_vector.address[test_vector.size] = &rsa_test_case_list[i];
- test_vector.size++;
- }
- return 0;
-}
-
-static int
-test_one_by_one(void)
-{
- int status = TEST_SUCCESS;
- uint32_t i = 0;
- uint8_t dev_id = params->valid_devs[0];
- struct rte_cryptodev_info dev_info;
- int sessionless = 0;
-
- rte_cryptodev_info_get(dev_id, &dev_info);
- if ((dev_info.feature_flags &
- RTE_CRYPTODEV_FF_ASYM_SESSIONLESS)) {
- sessionless = 1;
- }
-
- /* Go through all test cases */
- test_index = 0;
- for (i = 0; i < test_vector.size; i++) {
- if (test_one_case(test_vector.address[i], 0) != TEST_SUCCESS)
- status = TEST_FAILED;
- }
- if (sessionless) {
- for (i = 0; i < test_vector.size; i++) {
- if (test_one_case(test_vector.address[i], 1)
- != TEST_SUCCESS)
- status = TEST_FAILED;
- }
- }
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
- return status;
-}
-
-static int
-test_rsa_sign_verify(void)
-{
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- void *sess = NULL;
- struct rte_cryptodev_info dev_info;
- int ret, status = TEST_SUCCESS;
-
- /* Test case supports op with exponent key only,
- * Check in PMD feature flag for RSA exponent key type support.
- */
- rte_cryptodev_info_get(dev_id, &dev_info);
- if (!(dev_info.feature_flags &
- RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
- RTE_LOG(INFO, USER1, "Device doesn't support sign op with "
- "exponent key type. Test Skipped\n");
- return TEST_SKIPPED;
- }
-
- ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool, &sess);
-
- if (ret < 0) {
- RTE_LOG(ERR, USER1, "Session creation failed for "
- "sign_verify\n");
- status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- status = queue_ops_rsa_sign_verify(sess);
-
-error_exit:
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
-}
-
-static int
-test_rsa_enc_dec(void)
-{
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- void *sess = NULL;
- struct rte_cryptodev_info dev_info;
- int ret, status = TEST_SUCCESS;
-
- /* Test case supports op with exponent key only,
- * Check in PMD feature flag for RSA exponent key type support.
- */
- rte_cryptodev_info_get(dev_id, &dev_info);
- if (!(dev_info.feature_flags &
- RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP)) {
- RTE_LOG(INFO, USER1, "Device doesn't support decrypt op with "
- "exponent key type. Test skipped\n");
- return TEST_SKIPPED;
- }
-
- ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform, sess_mpool, &sess);
-
- if (ret < 0) {
- RTE_LOG(ERR, USER1, "Session creation failed for enc_dec\n");
- status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- status = queue_ops_rsa_enc_dec(sess);
-
-error_exit:
-
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
-}
-
-static int
-test_rsa_sign_verify_crt(void)
-{
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- void *sess = NULL;
- struct rte_cryptodev_info dev_info;
- 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.
- */
- rte_cryptodev_info_get(dev_id, &dev_info);
- if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
- RTE_LOG(INFO, USER1, "Device doesn't support sign op with "
- "quintuple key type. Test skipped\n");
- return TEST_SKIPPED;
- }
-
- ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool, &sess);
-
- if (ret < 0) {
- RTE_LOG(ERR, USER1, "Session creation failed for "
- "sign_verify_crt\n");
- status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- status = queue_ops_rsa_sign_verify(sess);
-
-error_exit:
-
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
-}
-
-static int
-test_rsa_enc_dec_crt(void)
-{
- struct rte_mempool *sess_mpool = params->session_mpool;
- uint8_t dev_id = params->valid_devs[0];
- void *sess = NULL;
- struct rte_cryptodev_info dev_info;
- 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.
- */
- rte_cryptodev_info_get(dev_id, &dev_info);
- if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
- RTE_LOG(INFO, USER1, "Device doesn't support decrypt op with "
- "quintuple key type. Test skipped\n");
- return TEST_SKIPPED;
- }
-
- ret = rte_cryptodev_asym_session_create(dev_id, &rsa_xform_crt, sess_mpool, &sess);
-
- if (ret < 0) {
- RTE_LOG(ERR, USER1, "Session creation failed for "
- "enc_dec_crt\n");
- status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
- goto error_exit;
- }
-
- status = queue_ops_rsa_enc_dec(sess);
-
-error_exit:
-
- rte_cryptodev_asym_session_free(dev_id, sess);
-
- TEST_ASSERT_EQUAL(status, 0, "Test failed");
-
- return status;
-}
-
static int
testsuite_setup(void)
{
@@ -809,7 +74,6 @@ testsuite_setup(void)
memset(params, 0, sizeof(*params));
test_vector.size = 0;
- load_test_vectors();
/* Device, op pool and session configuration for asymmetric crypto. 8< */
params->op_mpool = rte_crypto_op_pool_create(
@@ -995,6 +259,283 @@ test_capability(void)
return TEST_SUCCESS;
}
+static int send(struct rte_crypto_op **op,
+ struct rte_crypto_op **result_op)
+{
+ int ticks = 0;
+
+ if (rte_cryptodev_enqueue_burst(params->valid_devs[0], 0,
+ op, 1) != 1) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: Error sending packet for operation on device %d",
+ __LINE__, params->valid_devs[0]);
+ return TEST_FAILED;
+ }
+ while (rte_cryptodev_dequeue_burst(params->valid_devs[0], 0,
+ result_op, 1) == 0) {
+ rte_delay_ms(1);
+ ticks++;
+ if (ticks >= DEQ_TIMEOUT) {
+ RTE_LOG(ERR, USER1,
+ "line %u FAILED: Cannot dequeue the crypto op on device %d",
+ __LINE__, params->valid_devs[0]);
+ return TEST_FAILED;
+ }
+ }
+ TEST_ASSERT_NOT_NULL(*result_op,
+ "line %u FAILED: Failed to process asym crypto op",
+ __LINE__);
+ TEST_ASSERT_SUCCESS((*result_op)->status,
+ "line %u FAILED: Failed to process asym crypto op, error status received",
+ __LINE__);
+ return TEST_SUCCESS;
+}
+
+#define SET_RSA_PARAM(arg, vector, coef) \
+ uint8_t coef[TEST_DATA_SIZE] = { }; \
+ memcpy(coef, vector->coef.data, vector->coef.len); \
+ arg.coef.data = coef; \
+ arg.coef.length = vector->coef.len
+
+#define SET_RSA_PARAM_QT(arg, vector, coef) \
+ uint8_t coef[TEST_DATA_SIZE] = { }; \
+ memcpy(coef, vector->coef.data, vector->coef.len); \
+ arg.qt.coef.data = coef; \
+ arg.qt.coef.length = vector->coef.len
+
+static int
+RSA_Sign_Verify(const struct rsa_test_data_2 *vector)
+{
+ uint8_t output_buf[TEST_DATA_SIZE];
+
+ self->op->asym->rsa.op_type = RTE_CRYPTO_ASYM_OP_SIGN;
+ self->op->asym->rsa.sign.length = 0;
+ self->op->asym->rsa.sign.data = output_buf;
+ SET_RSA_PARAM(self->op->asym->rsa, vector, message);
+ self->op->asym->rsa.padding.type = vector->padding;
+ rte_crypto_op_attach_asym_session(self->op, self->sess);
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op (RSA Signature)");
+
+ self->op->asym->rsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY;
+ self->op->asym->rsa.padding.type = vector->padding;
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op (RSA Verify)");
+
+ return TEST_SUCCESS;
+}
+
+static int
+RSA_Encrypt(const struct rsa_test_data_2 *vector, uint8_t *cipher_buf)
+{
+ self->result_op = NULL;
+ /* Compute encryption on the test vector */
+ self->op->asym->rsa.op_type = RTE_CRYPTO_ASYM_OP_ENCRYPT;
+ self->op->asym->rsa.cipher.data = cipher_buf;
+ self->op->asym->rsa.cipher.length = 0;
+ SET_RSA_PARAM(self->op->asym->rsa, vector, message);
+ self->op->asym->rsa.padding.type = vector->padding;
+
+ rte_crypto_op_attach_asym_session(self->op, self->sess);
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op (Enryption)");
+
+ return 0;
+}
+
+static int
+RSA_Decrypt(const struct rsa_test_data_2 *vector, uint8_t *plaintext,
+ const int use_op)
+{
+ uint8_t cipher[TEST_DATA_SIZE] = { 0 };
+
+ if (use_op == 0) {
+ memcpy(cipher, vector->cipher.data, vector->cipher.len);
+ self->op->asym->rsa.cipher.data = cipher;
+ self->op->asym->rsa.cipher.length = vector->cipher.len;
+ }
+ self->result_op = NULL;
+ self->op->asym->rsa.message.data = plaintext;
+ self->op->asym->rsa.message.length = 0;
+ self->op->asym->rsa.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT;
+ self->op->asym->rsa.padding.type = vector->padding;
+ rte_crypto_op_attach_asym_session(self->op, self->sess);
+ TEST_ASSERT_SUCCESS(send(&self->op, &self->result_op),
+ "Failed to process crypto op (Decryption)");
+ return 0;
+}
+
+static void
+RSA_key_init_Exp(struct rte_crypto_asym_xform *xform,
+ const struct rsa_test_data_2 *vector)
+{
+ SET_RSA_PARAM(xform->rsa, vector, n);
+ SET_RSA_PARAM(xform->rsa, vector, e);
+ SET_RSA_PARAM(xform->rsa, vector, d);
+ xform->rsa.key_type = RTE_RSA_KEY_TYPE_EXP;
+}
+
+static void
+RSA_key_init_CRT(struct rte_crypto_asym_xform *xform,
+ const struct rsa_test_data_2 *vector)
+{
+ SET_RSA_PARAM(xform->rsa, vector, n);
+ SET_RSA_PARAM(xform->rsa, vector, e);
+ SET_RSA_PARAM_QT(xform->rsa, vector, p);
+ SET_RSA_PARAM_QT(xform->rsa, vector, q);
+ SET_RSA_PARAM_QT(xform->rsa, vector, dP);
+ SET_RSA_PARAM_QT(xform->rsa, vector, dQ);
+ SET_RSA_PARAM_QT(xform->rsa, vector, qInv);
+ xform->rsa.key_type = RTE_RSA_KEY_TYPE_QT;
+}
+
+typedef void (*rsa_key_init_t)(struct rte_crypto_asym_xform *,
+ const struct rsa_test_data_2 *);
+
+static int
+RSA_Init_Session(const struct rsa_test_data_2 *vector,
+ rsa_key_init_t key_init)
+{
+ const uint8_t dev_id = params->valid_devs[0];
+ struct rte_cryptodev_info dev_info;
+ struct rte_crypto_asym_xform xform = { };
+ int ret = 0;
+
+ key_init(&xform, vector);
+ xform.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
+
+ rte_cryptodev_info_get(dev_id, &dev_info);
+ if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
+ RTE_LOG(INFO, USER1,
+ "Device doesn't support decrypt op with quintuple key type. Test skipped\n");
+ return TEST_SKIPPED;
+ }
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform,
+ params->session_mpool, &self->sess);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Session creation failed for enc_dec_crt\n");
+ return (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED;
+ }
+ return 0;
+}
+
+static int
+PWCT_RSA_Encrypt_Decrypt(const void *data)
+{
+ uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
+ uint8_t message[TEST_DATA_SIZE] = {0};
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Encrypt(vector, cipher_buf),
+ "RSA: Failed to encrypt");
+ TEST_ASSERT_SUCCESS(RSA_Decrypt(vector, message, 1),
+ "RSA: Failed to decrypt");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->message.data,
+ self->result_op->asym->rsa.message.data,
+ vector->message.len,
+ "operation verification failed\n");
+ return TEST_SUCCESS;
+}
+
+static int
+PWCT_RSA_CRT_Encrypt_Decrypt(const void *data)
+{
+ uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
+ uint8_t message[TEST_DATA_SIZE] = {0};
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_CRT);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Encrypt(vector, cipher_buf),
+ "RSA: Failed to encrypt");
+ TEST_ASSERT_SUCCESS(RSA_Decrypt(vector, message, 1),
+ "RSA: Failed to decrypt");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->message.data,
+ self->result_op->asym->rsa.message.data,
+ vector->message.len,
+ "operation verification failed\n");
+ return TEST_SUCCESS;
+}
+
+static int
+PWCT_RSA_Sign_Verify(const void *data)
+{
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Sign_Verify(vector),
+ "Failed to process RSA operation");
+ return TEST_SUCCESS;
+}
+
+static int
+PWCT_RSA_Sign_Verify_CRT(const void *data)
+{
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_CRT);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Sign_Verify(vector),
+ "Failed to process RSA operation");
+ return TEST_SUCCESS;
+}
+
+static int
+KAT_RSA_Encrypt(const void *data)
+{
+ uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Encrypt(vector, cipher_buf),
+ "RSA: Failed to encrypt");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->cipher.data,
+ self->result_op->asym->rsa.cipher.data,
+ vector->cipher.len,
+ "operation verification failed\n");
+ return 0;
+}
+
+static int
+KAT_RSA_Decrypt(const void *data)
+{
+ uint8_t message[TEST_DATA_SIZE] = {0};
+ const struct rsa_test_data_2 *vector = data;
+ int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
+
+ if (ret) {
+ RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
+ return ret;
+ }
+ TEST_ASSERT_SUCCESS(RSA_Decrypt(vector, message, 0),
+ "RSA: Failed to encrypt");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->message.data,
+ self->result_op->asym->rsa.message.data,
+ vector->message.len,
+ "operation verification failed\n");
+ return 0;
+}
+
static int
test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
{
@@ -2074,14 +1615,15 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = {
TEST_CASE_ST(setup_generic, teardown_generic, test_dsa),
TEST_CASE_ST(setup_generic, teardown_generic,
test_dh_keygenration),
- TEST_CASE_ST(setup_generic, teardown_generic, test_rsa_enc_dec),
- TEST_CASE_ST(setup_generic, teardown_generic,
- test_rsa_sign_verify),
- TEST_CASE_ST(setup_generic, teardown_generic,
- test_rsa_enc_dec_crt),
- TEST_CASE_ST(setup_generic, teardown_generic,
- test_rsa_sign_verify_crt),
- TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ /* RSA */
+ TC_DATA_GENERIC(PWCT_RSA_Encrypt_Decrypt,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_CRT_Encrypt_Decrypt,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_Sign_Verify,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_Sign_Verify_CRT,
+ RSA_vector_128_20_3_PKCS1),
/* Modular Multiplicative Inverse */
TC_DATA_GENERIC(modular_multiplicative_inverse,
modinv_test_case),
@@ -2103,7 +1645,10 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite = {
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(setup_generic, teardown_generic, test_one_by_one),
+ TC_DATA_GENERIC(KAT_RSA_Encrypt,
+ RSA_vector_128_20_3_None),
+ TC_DATA_GENERIC(KAT_RSA_Decrypt,
+ RSA_vector_128_20_3_None),
/* Modular Multiplicative Inverse */
TC_DATA_GENERIC(modular_multiplicative_inverse,
modinv_test_case),
@@ -2126,10 +1671,15 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = {
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(setup_generic, teardown_generic, test_capability),
- TEST_CASE_ST(setup_generic, teardown_generic,
- test_rsa_enc_dec_crt),
- TEST_CASE_ST(setup_generic, teardown_generic,
- test_rsa_sign_verify_crt),
+ /* RSA */
+ TC_DATA_GENERIC(PWCT_RSA_Encrypt_Decrypt,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_CRT_Encrypt_Decrypt,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_Sign_Verify,
+ RSA_vector_128_20_3_PKCS1),
+ TC_DATA_GENERIC(PWCT_RSA_Sign_Verify_CRT,
+ RSA_vector_128_20_3_PKCS1),
TEST_CASE_ST(setup_generic, teardown_generic,
test_ecdsa_sign_verify_all_curve),
TEST_CASE_ST(setup_generic, teardown_generic,
diff --git a/app/test/test_cryptodev_asym_util.h b/app/test/test_cryptodev_asym_util.h
index 19044a58ad..25d3e4b797 100644
--- a/app/test/test_cryptodev_asym_util.h
+++ b/app/test/test_cryptodev_asym_util.h
@@ -7,16 +7,6 @@
/* Below Apis compare resulted buffer to original test vector */
-static inline int rsa_verify(struct rsa_test_data *rsa_param,
- struct rte_crypto_op *result_op)
-{
- if (memcmp(rsa_param->data,
- result_op->asym->rsa.message.data,
- result_op->asym->rsa.message.length))
- return -1;
- return 0;
-}
-
static inline int verify_ecdsa_sign(uint8_t *sign_r,
uint8_t *sign_s, struct rte_crypto_op *result_op)
{
diff --git a/app/test/test_cryptodev_rsa_test_vectors.h b/app/test/test_cryptodev_rsa_test_vectors.h
index 04539a1ecf..ecc2af50ff 100644
--- a/app/test/test_cryptodev_rsa_test_vectors.h
+++ b/app/test/test_cryptodev_rsa_test_vectors.h
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Cavium Networks
+ * Copyright (c) 2019-2023 Intel Corporation
*/
#ifndef TEST_CRYPTODEV_RSA_TEST_VECTORS_H__
@@ -18,11 +19,11 @@ struct rsa_test_data_2 {
struct {
uint8_t data[DATA_SIZE];
uint16_t len;
- } pt;
+ } message;
struct {
uint8_t data[DATA_SIZE];
uint16_t len;
- } ct;
+ } cipher;
struct {
uint8_t data[DATA_SIZE];
uint16_t len;
@@ -67,341 +68,302 @@ struct rsa_test_data_2 {
};
static const struct
-rsa_test_data_2 rsa_test_case_list[] = {
- {
- .description = "RSA Encryption Decryption "
- "(n=128, pt=20, e=3) EXP, QT",
- .xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
- .op_type_flags = 1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT |
- 1UL << RTE_CRYPTO_ASYM_OP_DECRYPT,
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},
- .ct = {
- .data = {
- 0x3D, 0x8D, 0x2F, 0x85, 0xC0, 0xB7, 0x21, 0x3E,
- 0x5B, 0x4A, 0x96, 0xB2, 0x85, 0x35, 0xAF, 0x0C,
- 0x62, 0xE9, 0x73, 0xEF, 0x77, 0x76, 0x19, 0xD5,
- 0x92, 0xF7, 0x1D, 0xB0, 0x15, 0x69, 0x65, 0x82,
- 0x32, 0x30, 0x4E, 0x29, 0xE7, 0x83, 0xAD, 0x23,
- 0x66, 0xD9, 0x91, 0x9B, 0xFF, 0x01, 0x10, 0x3B,
- 0xB2, 0xF8, 0x78, 0x14, 0xD2, 0x6E, 0x3C, 0x59,
- 0x6E, 0x1A, 0x90, 0x3C, 0x5A, 0xB3, 0x0B, 0x60,
- 0xE2, 0x71, 0xCC, 0xF5, 0x0C, 0x57, 0x19, 0x03,
- 0x5B, 0x04, 0x46, 0x7E, 0x13, 0x5B, 0xFF, 0x2C,
- 0x01, 0x19, 0x75, 0x86, 0x6A, 0xAE, 0x60, 0xFB,
- 0x0A, 0x4C, 0x14, 0x1A, 0xBC, 0x0E, 0x86, 0xF1,
- 0x13, 0x10, 0xB3, 0x03, 0x8E, 0x66, 0x6F, 0xA5,
- 0x53, 0x80, 0x5A, 0x91, 0xE6, 0x7C, 0x3C, 0x38,
- 0x15, 0xB6, 0x69, 0x3E, 0xF6, 0x54, 0xB0, 0x60,
- 0x83, 0xE9, 0x2B, 0xF3, 0x26, 0x53, 0x3E, 0x11
- },
- .len = 128,
+ .len = 20,
+ },
+ .cipher = {
+ .data = {
},
- .e = {
- .data = {
- 0x01, 0x00, 0x01
- },
- .len = 3,
+ .len = 128,
+ },
+ .e = {
+ .data = {
+ 0x01, 0x00, 0x01
},
- .d = {
- .data = {
- 0x24, 0xd7, 0xea, 0xf4, 0x7f, 0xe0, 0xca, 0x31,
- 0x4d, 0xee, 0xc4, 0xa1, 0xbe, 0xab, 0x06, 0x61,
- 0x32, 0xe7, 0x51, 0x46, 0x27, 0xdf, 0x72,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, 0x7f, 0x4d, 0x60, 0xc8, 0x8d,
- 0x34, 0xb8, 0x17, 0x84, 0xbc, 0xd4, 0xe9, 0x79,
- 0x95, 0x75, 0x19, 0x37, 0xe0, 0xcc, 0xfe, 0x4c,
- 0x5d, 0x49, 0x53, 0x61, 0x29, 0xf1, 0xdc, 0x82,
- 0x03, 0x96, 0x7d, 0x95, 0x4f, 0xdd, 0x3c, 0x0a,
- 0x64, 0x8a, 0x43, 0x2f, 0x95, 0x4a, 0xed, 0xdd
- },
- .len = 64,
+ .len = 128,
+ },
+ .p = {
+ .data = {
+ 0xdc, 0xba, 0x00, 0x01, 0x57, 0x93, 0xe3, 0x05,
+ 0xed, 0x61, 0x9a, 0xa3, 0xaf, 0x6a, 0xd3, 0x47,
+ 0x8f, 0x2d, 0x1e, 0x7f, 0x4d, 0x60, 0xc8, 0x8d,
+ 0x34, 0xb8, 0x17, 0x84, 0xbc, 0xd4, 0xe9, 0x79,
+ 0x95, 0x75, 0x19, 0x37, 0xe0, 0xcc, 0xfe, 0x4c,
+ 0x5d, 0x49, 0x53, 0x61, 0x29, 0xf1, 0xdc, 0x82,
+ 0x03, 0x96, 0x7d, 0x95, 0x4f, 0xdd, 0x3c, 0x0a,
+ 0x64, 0x8a, 0x43, 0x2f, 0x95, 0x4a, 0xed, 0xdd
},
- .q = {
- .data = {
- 0xd0, 0x56, 0x7a, 0x0a, 0xd5, 0x95, 0xa4, 0x85,
- 0x53, 0x35, 0xa1, 0x48, 0x07, 0x6a, 0x7c, 0x08,
- 0xe0, 0xfd, 0x4b, 0x88, 0x77, 0xa6, 0x15, 0x23,
- 0x0f, 0xbf, 0x14, 0x46, 0x11, 0xee, 0x95, 0xc7,
- 0x5e, 0x77, 0x65, 0xa2, 0xb5, 0x50, 0xdf, 0x19,
- 0x07, 0xc7, 0x72, 0xdb, 0x29, 0xf6, 0x54, 0x86,
- 0xe1, 0xb3, 0x97, 0x0a, 0x28, 0x64, 0x3a, 0x38,
- 0xa6, 0x7d, 0x13, 0xc3, 0x79, 0xaa, 0x56, 0xd9
- },
- .len = 64,
+ .len = 64,
+ },
+ .q = {
+ .data = {
+ 0xd0, 0x56, 0x7a, 0x0a, 0xd5, 0x95, 0xa4, 0x85,
+ 0x53, 0x35, 0xa1, 0x48, 0x07, 0x6a, 0x7c, 0x08,
+ 0xe0, 0xfd, 0x4b, 0x88, 0x77, 0xa6, 0x15, 0x23,
+ 0x0f, 0xbf, 0x14, 0x46, 0x11, 0xee, 0x95, 0xc7,
+ 0x5e, 0x77, 0x65, 0xa2, 0xb5, 0x50, 0xdf, 0x19,
+ 0x07, 0xc7, 0x72, 0xdb, 0x29, 0xf6, 0x54, 0x86,
+ 0xe1, 0xb3, 0x97, 0x0a, 0x28, 0x64, 0x3a, 0x38,
+ 0xa6, 0x7d, 0x13, 0xc3, 0x79, 0xaa, 0x56, 0xd9
},
- .dP = {
- .data = {
- 0xc5, 0x43, 0x0d, 0x82, 0x25, 0x8c, 0xab, 0x55,
- 0xbe, 0xc2, 0x7d, 0xfb, 0x4f, 0x68, 0x3f, 0x0e,
- 0x32, 0xec, 0xf5, 0xd6, 0x7b, 0x86, 0xc5, 0x75,
- 0x3c, 0xea, 0x51, 0x4a, 0x75, 0xa0, 0x2a, 0x50,
- 0x58, 0xbb, 0xe0, 0x1f, 0xca, 0x2e, 0x2a, 0x0e,
- 0x81, 0x48, 0x68, 0xd5, 0xeb, 0x30, 0x96, 0x0b,
- 0x33, 0xbd, 0xa8, 0xda, 0x6a, 0x17, 0xa3, 0xf2,
- 0xfd, 0xcb, 0x7b, 0x23, 0xe9, 0x5e, 0x9f, 0x99
- },
- .len = 64,
+ .len = 64,
+ },
+ .dP = {
+ .data = {
+ 0xc5, 0x43, 0x0d, 0x82, 0x25, 0x8c, 0xab, 0x55,
+ 0xbe, 0xc2, 0x7d, 0xfb, 0x4f, 0x68, 0x3f, 0x0e,
+ 0x32, 0xec, 0xf5, 0xd6, 0x7b, 0x86, 0xc5, 0x75,
+ 0x3c, 0x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
},
- .qInv = {
- .data = {
- 0x59, 0xbd, 0xb1, 0x37, 0xeb, 0x4e, 0xcf, 0x68,
- 0xe7, 0x85, 0x91, 0xbb, 0xc0, 0xdb, 0x8e, 0x41,
- 0x91, 0x4a, 0xc0, 0xb1, 0xc5, 0xe8, 0x91, 0xf6,
- 0xc7, 0x5a, 0x98, 0x1a, 0x8a, 0x0f, 0x45, 0xb2,
- 0x5b, 0xff, 0x7a, 0x2d, 0x98, 0x89, 0x55, 0xd9,
- 0xbf, 0x6e, 0xdd, 0x2d, 0xd4, 0xe8, 0x0a, 0xaa,
- 0xae, 0x2a, 0xc4, 0x16, 0xb5, 0xba, 0xe1, 0x69,
- 0x71, 0x94, 0xdd, 0xa0, 0xf5, 0x1e, 0x6d, 0xcc
- },
- .len = 64,
+ .len = 64,
+ },
+ .qInv = {
+ .data = {
+ 0x59, 0xbd, 0xb1, 0x37, 0xeb, 0x4e, 0xcf, 0x68,
+ 0xe7, 0x85, 0x91, 0xbb, 0xc0, 0xdb, 0x8e, 0x41,
+ 0x91, 0x4a, 0xc0, 0xb1, 0xc5, 0xe8, 0x91, 0xf6,
+ 0xc7, 0x5a, 0x98, 0x1a, 0x8a, 0x0f, 0x45, 0xb2,
+ 0x5b, 0xff, 0x7a, 0x2d, 0x98, 0x89, 0x55, 0xd9,
+ 0xbf, 0x6e, 0xdd, 0x2d, 0xd4, 0xe8, 0x0a, 0xaa,
+ 0xae, 0x2a, 0xc4, 0x16, 0xb5, 0xba, 0xe1, 0x69,
+ 0x71, 0x94, 0xdd, 0xa0, 0xf5, 0x1e, 0x6d, 0xcc
},
- .padding = RTE_CRYPTO_RSA_PADDING_NONE,
- .key_exp = 1,
- .key_qt = 1,
- }
-};
-
-struct rsa_test_data {
- uint8_t data[TEST_DATA_SIZE];
- unsigned int len;
-};
-
-struct rsa_test_data rsaplaintext = {
- .data = {
- 0xf8, 0xba, 0x1a, 0x55, 0xd0, 0x2f, 0x85, 0xae,
- 0x96, 0x7b, 0xb6, 0x2f, 0xb6, 0xcd, 0xa8, 0xeb,
- 0x7e, 0x78, 0xa0, 0x50
+ .len = 64,
},
- .len = 20
-};
-
-uint8_t rsa_n[] = {
- 0xb3, 0xa1, 0xaf, 0xb7, 0x13, 0x08, 0x00,
- 0x0a, 0x35, 0xdc, 0x2b, 0x20, 0x8d, 0xa1, 0xb5,
- 0xce, 0x47, 0x8a, 0xc3, 0x80, 0xf4, 0x7d, 0x4a,
- 0xa2, 0x62, 0xfd, 0x61, 0x7f, 0xb5, 0xa8, 0xde,
- 0x0a, 0x17, 0x97, 0xa0, 0xbf, 0xdf, 0x56, 0x5a,
- 0x3d, 0x51, 0x56, 0x4f, 0x70, 0x70, 0x3f, 0x63,
- 0x6a, 0x44, 0x5b, 0xad, 0x84, 0x0d, 0x3f, 0x27,
- 0x6e, 0x3b, 0x34, 0x91, 0x60, 0x14, 0xb9, 0xaa,
- 0x72, 0xfd, 0xa3, 0x64, 0xd2, 0x03, 0xa7, 0x53,
- 0x87, 0x9e, 0x88, 0x0b, 0xc1, 0x14, 0x93, 0x1a,
- 0x62, 0xff, 0xb1, 0x5d, 0x74, 0xcd, 0x59, 0x63,
- 0x18, 0x11, 0x3d, 0x4f, 0xba, 0x75, 0xd4, 0x33,
- 0x4e, 0x23, 0x6b, 0x7b, 0x57, 0x44, 0xe1, 0xd3,
- 0x03, 0x13, 0xa6, 0xf0, 0x8b, 0x60, 0xb0, 0x9e,
- 0xee, 0x75, 0x08, 0x9d, 0x71, 0x63, 0x13, 0xcb,
- 0xa6, 0x81, 0x92, 0x14, 0x03, 0x22, 0x2d, 0xde,
- 0x55
-};
-
-uint8_t rsa_d[] = {
- 0x24, 0xd7, 0xea, 0xf4, 0x7f, 0xe0, 0xca, 0x31,
- 0x4d, 0xee, 0xc4, 0xa1, 0xbe, 0xab, 0x06, 0x61,
- 0x32, 0xe7, 0x51, 0x46, 0x27, 0xdf, 0x72, 0xe9,
- 0x6f, 0xa8, 0x4c, 0xd1, 0x26, 0xef, 0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5b, 0xaf,
- 0x83, 0xed, 0x3b, 0x84, 0x68, 0x15, 0x18, 0x6b,
- 0x4c, 0x32, 0xac, 0x6f, 0x38, 0x96, 0xa2, 0xb5,
- 0xdb, 0x14, 0xe2, 0x70, 0x9c, 0x73, 0x29, 0x09
-};
-
-uint8_t rsa_qInv[] = {
- 0x59, 0xbd, 0xb1, 0x37, 0xeb, 0x4e, 0xcf, 0x68,
- 0xe7, 0x85, 0x91, 0xbb, 0xc0, 0xdb, 0x8e, 0x41,
- 0x91, 0x4a, 0xc0, 0xb1, 0xc5, 0xe8, 0x91, 0xf6,
- 0xc7, 0x5a, 0x98, 0x1a, 0x8a, 0x0f, 0x45, 0xb2,
- 0x5b, 0xff, 0x7a, 0x2d, 0x98, 0x89, 0x55, 0xd9,
- 0xbf, 0x6e, 0xdd, 0x2d, 0xd4, 0xe8, 0x0a, 0xaa,
- 0xae, 0x2a, 0xc4, 0x16, 0xb5, 0xba, 0xe1, 0x69,
- 0x71, 0x94, 0xdd, 0xa0, 0xf5, 0x1e, 0x6d, 0xcc
-};
-
-/** rsa xform using exponent key */
-struct rte_crypto_asym_xform rsa_xform = {
- .next = NULL,
+static const struct
+rsa_test_data_2 RSA_vector_128_20_3_None = {
+ .description =
+ "RSA Encryption Decryption (n=128, pt=20, e=3) EXP, QT",
.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
- .rsa = {
- .n = {
- .data = rsa_n,
- .length = sizeof(rsa_n)
+ .op_type_flags = 1UL << RTE_CRYPTO_ASYM_OP_ENCRYPT |
+ 1UL << RTE_CRYPTO_ASYM_OP_DECRYPT,
+ .message = {
+ .data = {
+ 0x00, 0x02, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0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0x1A, 0x90, 0x3C, 0x5A, 0xB3, 0x0B, 0x60,
+ 0xE2, 0x71, 0xCC, 0xF5, 0x0C, 0x57, 0x19, 0x03,
+ 0x5B, 0x04, 0x46, 0x7E, 0x13, 0x5B, 0xFF, 0x2C,
+ 0x01, 0x19, 0x75, 0x86, 0x6A, 0xAE, 0x60, 0xFB,
+ 0x0A, 0x4C, 0x14, 0x1A, 0xBC, 0x0E, 0x86, 0xF1,
+ 0x13, 0x10, 0xB3, 0x03, 0x8E, 0x66, 0x6F, 0xA5,
+ 0x53, 0x80, 0x5A, 0x91, 0xE6, 0x7C, 0x3C, 0x38,
+ 0x15, 0xB6, 0x69, 0x3E, 0xF6, 0x54, 0xB0, 0x60,
+ 0x83, 0xE9, 0x2B, 0xF3, 0x26, 0x53, 0x3E, 0x11
},
- .key_type = RTE_RSA_KEY_TYPE_EXP,
- .d = {
- .data = rsa_d,
- .length = sizeof(rsa_d)
- }
- }
-};
-
-/** rsa xform using quintuple key */
-struct rte_crypto_asym_xform rsa_xform_crt = {
- .next = NULL,
- .xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
- .rsa = {
- .n = {
- .data = rsa_n,
- .length = sizeof(rsa_n)
+ .len = 128,
+ },
+ .e = {
+ .data = {
+ 0x01, 0x00, 0x01
},
- .e = {
- .data = rsa_e,
- .length = sizeof(rsa_e)
+ .len = 3,
+ },
+ .d = {
+ .data = {
+ 0x24, 0xd7, 0xea, 0xf4, 0x7f, 0xe0, 0xca, 0x31,
+ 0x4d, 0xee, 0xc4, 0xa1, 0xbe, 0xab, 0x06, 0x61,
+ 0x32, 0xe7, 0x51, 0x46, 0x27, 0xdf, 0x72, 0xe9,
+ 0x6f, 0xa8, 0x4c, 0xd1, 0x26, 0xef, 0x65, 0xeb,
+ 0x67, 0xff, 0x5f, 0xa7, 0x3b, 0x25, 0xb9, 0x08,
+ 0x8e, 0xa0, 0x47, 0x56, 0xe6, 0x8e, 0xf9, 0xd3,
+ 0x18, 0x06, 0x3d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4f, 0xba, 0x75, 0xd4, 0x33, 0x4e,
+ 0x23, 0x6b, 0x7b, 0x57, 0x44, 0xe1, 0xd3, 0x03,
+ 0x13, 0xa6, 0xf0, 0x8b, 0x60, 0xb0, 0x9e, 0xee,
+ 0x75, 0x08, 0x9d, 0x71, 0x63, 0x13, 0xcb, 0xa6,
+ 0x81, 0x92, 0x14, 0x03, 0x22, 0x2d, 0xde, 0x55
},
- .key_type = RTE_RSA_KEY_TYPE_QT,
- .qt = {
- .p = {
- .data = rsa_p,
- .length = sizeof(rsa_p)
- },
- .q = {
- .data = rsa_q,
- .length = sizeof(rsa_q)
- },
- .dP = {
- .data = rsa_dP,
- .length = sizeof(rsa_dP)
- },
- .dQ = {
- .data = rsa_dQ,
- .length = sizeof(rsa_dQ)
- },
- .qInv = {
- .data = rsa_qInv,
- .length = sizeof(rsa_qInv)
- },
- }
- }
+ .len = 128,
+ },
+ .p = {
+ .data = {
+ 0xdc, 0xba, 0x00, 0x01, 0x57, 0x93, 0xe3, 0x05,
+ 0xed, 0x61, 0x9a, 0xa3, 0xaf, 0x6a, 0xd3, 0x47,
+ 0x8f, 0x2d, 0x1e, 0x7f, 0x4d, 0x60, 0xc8, 0x8d,
+ 0x34, 0xb8, 0x17, 0x84, 0xbc, 0xd4, 0xe9, 0x79,
+ 0x95, 0x75, 0x19, 0x37, 0xe0, 0xcc, 0xfe, 0x4c,
+ 0x5d, 0x49, 0x53, 0x61, 0x29, 0xf1, 0xdc, 0x82,
+ 0x03, 0x96, 0x7d, 0x95, 0x4f, 0xdd, 0x3c, 0x0a,
+ 0x64, 0x8a, 0x43, 0x2f, 0x95, 0x4a, 0xed, 0xdd
+ },
+ .len = 64,
+ },
+ .q = {
+ .data = {
+ 0xd0, 0x56, 0x7a, 0x0a, 0xd5, 0x95, 0xa4, 0x85,
+ 0x53, 0x35, 0xa1, 0x48, 0x07, 0x6a, 0x7c, 0x08,
+ 0xe0, 0xfd, 0x4b, 0x88, 0x77, 0xa6, 0x15, 0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14, 0xe2, 0x70, 0x9c, 0x73, 0x29, 0x09
+ },
+ .len = 64,
+ },
+ .qInv = {
+ .data = {
+ 0x59, 0xbd, 0xb1, 0x37, 0xeb, 0x4e, 0xcf, 0x68,
+ 0xe7, 0x85, 0x91, 0xbb, 0xc0, 0xdb, 0x8e, 0x41,
+ 0x91, 0x4a, 0xc0, 0xb1, 0xc5, 0xe8, 0x91, 0xf6,
+ 0xc7, 0x5a, 0x98, 0x1a, 0x8a, 0x0f, 0x45, 0xb2,
+ 0x5b, 0xff, 0x7a, 0x2d, 0x98, 0x89, 0x55, 0xd9,
+ 0xbf, 0x6e, 0xdd, 0x2d, 0xd4, 0xe8, 0x0a, 0xaa,
+ 0xae, 0x2a, 0xc4, 0x16, 0xb5, 0xba, 0xe1, 0x69,
+ 0x71, 0x94, 0xdd, 0xa0, 0xf5, 0x1e, 0x6d, 0xcc
+ },
+ .len = 64,
+ },
+ .padding = RTE_CRYPTO_RSA_PADDING_NONE,
};
#endif /* TEST_CRYPTODEV_RSA_TEST_VECTORS_H__ */
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread