| 1341 | } |
| 1342 | |
| 1343 | static int |
| 1344 | test_dsa_verify(struct rte_crypto_dsa_op_param *dsa_op) |
| 1345 | { |
| 1346 | struct crypto_testsuite_params_asym *ts_params = &testsuite_params; |
| 1347 | struct rte_mempool *op_mpool = ts_params->op_mpool; |
| 1348 | struct rte_mempool *sess_mpool = ts_params->session_mpool; |
| 1349 | uint8_t dev_id = ts_params->valid_devs[0]; |
| 1350 | struct rte_crypto_asym_op *asym_op = NULL; |
| 1351 | struct rte_crypto_op *op = NULL, *result_op = NULL; |
| 1352 | void *sess = NULL; |
| 1353 | int status = TEST_SUCCESS; |
| 1354 | int ret; |
| 1355 | |
| 1356 | ret = rte_cryptodev_asym_session_create(dev_id, &dsa_xform, sess_mpool, &sess); |
| 1357 | if (ret < 0) { |
| 1358 | RTE_LOG(ERR, USER1, |
| 1359 | "line %u FAILED: %s", __LINE__, |
| 1360 | "Session creation failed"); |
| 1361 | status = (ret == -ENOTSUP) ? TEST_SKIPPED : TEST_FAILED; |
| 1362 | goto error_exit; |
| 1363 | } |
| 1364 | /* set up crypto op data structure */ |
| 1365 | op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); |
| 1366 | if (!op) { |
| 1367 | RTE_LOG(ERR, USER1, |
| 1368 | "line %u FAILED: %s", |
| 1369 | __LINE__, "Failed to allocate asymmetric crypto " |
| 1370 | "operation struct"); |
| 1371 | status = TEST_FAILED; |
| 1372 | goto error_exit; |
| 1373 | } |
| 1374 | asym_op = op->asym; |
| 1375 | asym_op->dsa = *dsa_op; |
| 1376 | |
| 1377 | debug_hexdump(stdout, "p: ", dsa_xform.dsa.p.data, |
| 1378 | dsa_xform.dsa.p.length); |
| 1379 | debug_hexdump(stdout, "q: ", dsa_xform.dsa.q.data, |
| 1380 | dsa_xform.dsa.q.length); |
| 1381 | debug_hexdump(stdout, "g: ", dsa_xform.dsa.g.data, |
| 1382 | dsa_xform.dsa.g.length); |
| 1383 | |
| 1384 | /* attach asymmetric crypto session to crypto operations */ |
| 1385 | rte_crypto_op_attach_asym_session(op, sess); |
| 1386 | |
| 1387 | debug_hexdump(stdout, "r:", |
| 1388 | asym_op->dsa.r.data, asym_op->dsa.r.length); |
| 1389 | debug_hexdump(stdout, "s:", |
| 1390 | asym_op->dsa.s.data, asym_op->dsa.s.length); |
| 1391 | |
| 1392 | RTE_LOG(DEBUG, USER1, "Process ASYM verify operation"); |
| 1393 | /* Test PMD DSA sign verification using signer public key */ |
| 1394 | asym_op->dsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY; |
| 1395 | |
| 1396 | /* copy signer public key */ |
| 1397 | asym_op->dsa.y.data = dsa_test_params.y.data; |
| 1398 | asym_op->dsa.y.length = dsa_test_params.y.length; |
| 1399 | |
| 1400 | /* Process crypto operation */ |
no test coverage detected