* [PATCH] app/test-crypto-perf: validate rsa modlen
@ 2025-08-20 18:36 Sucharitha Sarananaga
0 siblings, 0 replies; only message in thread
From: Sucharitha Sarananaga @ 2025-08-20 18:36 UTC (permalink / raw)
To: dev; +Cc: anoobj, gakhil, kai.ji, Sucharitha Sarananaga
Added a check to verify that user configured modlen supported
or not.
Signed-off-by: Sucharitha Sarananaga <ssarananaga@marvell.com>
---
app/test-crypto-perf/cperf_options_parsing.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 0e0dc4fd06..0c7c57ce42 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1361,6 +1361,7 @@ is_valid_chained_op(struct cperf_options *options)
int
cperf_options_check(struct cperf_options *options)
{
+ uint16_t modlen;
int i;
if (options->op_type == CPERF_CIPHER_ONLY ||
@@ -1557,8 +1558,6 @@ cperf_options_check(struct cperf_options *options)
}
if (options->rsa_modlen) {
- uint16_t modlen = options->rsa_modlen / 8;
-
if (options->op_type != CPERF_ASYM_RSA) {
RTE_LOG(ERR, USER1, "Option rsa-modlen should be used only with "
" optype: rsa.\n");
@@ -1567,7 +1566,8 @@ cperf_options_check(struct cperf_options *options)
if (options->rsa_keytype == RTE_RSA_KEY_TYPE_QT) {
for (i = 0; i < (int)RTE_DIM(rsa_qt_perf_data); i++) {
- if (rsa_qt_perf_data[i].n.length == modlen) {
+ modlen = rsa_qt_perf_data[i].n.length * 8;
+ if (options->rsa_modlen == modlen) {
options->rsa_data =
(struct cperf_rsa_test_data *)&rsa_qt_perf_data[i];
break;
@@ -1582,7 +1582,8 @@ cperf_options_check(struct cperf_options *options)
}
} else if (options->rsa_keytype == RTE_RSA_KEY_TYPE_EXP) {
for (i = 0; i < (int)RTE_DIM(rsa_exp_perf_data); i++) {
- if (rsa_exp_perf_data[i].n.length == modlen) {
+ modlen = rsa_exp_perf_data[i].n.length * 8;
+ if (options->rsa_modlen == modlen) {
options->rsa_data =
(struct cperf_rsa_test_data *)&rsa_exp_perf_data[i];
break;
@@ -1597,7 +1598,8 @@ cperf_options_check(struct cperf_options *options)
}
} else {
for (i = 0; i < (int)RTE_DIM(rsa_pub_perf_data); i++) {
- if (rsa_pub_perf_data[i].n.length == modlen) {
+ modlen = rsa_pub_perf_data[i].n.length * 8;
+ if (options->rsa_modlen == modlen) {
options->rsa_data =
(struct cperf_rsa_test_data *)&rsa_pub_perf_data[i];
break;
--
2.49.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-20 18:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-20 18:36 [PATCH] app/test-crypto-perf: validate rsa modlen Sucharitha Sarananaga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).