Skip to content

Commit

Permalink
Fix issues with testapp and remove extra args.
Browse files Browse the repository at this point in the history
Signed-off-by: Yogaraj Alamenda <[email protected]>
Co-authored-by: Yogaraj Alamenda <[email protected]>
  • Loading branch information
Premkumarx and Yogaraj-Alamenda committed May 10, 2023
1 parent 278be78 commit e42d23e
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 250 deletions.
17 changes: 6 additions & 11 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ static char *tls_version = NULL;
static char *digest_kdf = NULL;
static int prf_op = -1;
static int hkdf_op = -1;
static int ecx_op = -1;
static int explicit_engine = 0;
static int async_jobs = 1;
static int sw_fallback = 0;
Expand Down Expand Up @@ -236,8 +235,8 @@ static const option_data ecdh_choices[] = {
{"ecdhb283", 0, TEST_ECDH, B_CURVE_283, 0},
{"ecdhb409", 0, TEST_ECDH, B_CURVE_409, 0},
{"ecdhb571", 0, TEST_ECDH, B_CURVE_571, 0},
{"ecdhx25519", 0, TEST_ECX, 0, 0},
{"ecdhx448", 0, TEST_ECX, 0, 1},
{"ecdhx25519", 0, TEST_ECX, X_CURVE_25519, 0},
{"ecdhx448", 0, TEST_ECX, X_CURVE_448, 0},
{"ecdhsm2", 0, TEST_ECDH, P_CURVE_SM2, 0},
};

Expand Down Expand Up @@ -915,7 +914,6 @@ static void handle_option(int argc, char *argv[], int *index)
printf ("name %s\n", ecdh_choices[i].name);
curve = ecdh_choices[i].curve_name;
test_alg = ecdh_choices[i].test_alg;
ecx_op = ecdh_choices[i].op;
break;
}
} else if (!strncmp(option, "ecdsa", strlen("ecdsa"))) {
Expand Down Expand Up @@ -1114,7 +1112,6 @@ static void performance_test(void)
info->test_params->async_jobs = async_jobs;
info->test_params->prf_op = prf_op;
info->test_params->hkdf_op = hkdf_op;
info->test_params->ecx_op = ecx_op;
info->test_params->jobs = OPENSSL_malloc(sizeof(ASYNC_JOB*)*async_jobs);
if (info->test_params->jobs == NULL) {
WARN("# FAIL: Unable to allocate info->test_params->jobs\n");
Expand Down Expand Up @@ -1337,7 +1334,6 @@ static void functional_test(void)
args.async_jobs = async_jobs;
args.prf_op = prf_op;
args.hkdf_op = hkdf_op;
args.ecx_op = ecx_op;
args.jobs = OPENSSL_malloc(sizeof(ASYNC_JOB*)*async_jobs);
if (args.jobs == NULL) {
WARN("# FAIL: Unable to allocate args.jobs\n");
Expand Down Expand Up @@ -1377,8 +1373,9 @@ static void functional_test(void)
} else if (test_alg == TEST_TYPE_MAX - 1) {
args.count = &test_count;
tests_run(&args, 0);
} else
} else {
tests_run(&args, 0);
}

for (i =0; i < async_jobs; i++)
ASYNC_WAIT_CTX_free(args.awcs[i]);
Expand Down Expand Up @@ -1508,12 +1505,10 @@ int main(int argc, char *argv[])
printf("\tPRF Operation: %d\n", prf_op);
if (hkdf_op != -1)
printf("\tHKDF Operation: %d\n", hkdf_op);
if (ecx_op != -1)
printf("\tECX Operation: %s\n", ecx_op ? "X448" : "X25519");
printf("\tSW Fallback: %s\n", sw_fallback ? "Yes" : "No");
printf("\n");

if (enable_perf == 0)
if (!enable_perf)
functional_test();
else
performance_test();
Expand All @@ -1523,7 +1518,7 @@ int main(int argc, char *argv[])
enable_external_polling,
enable_event_driven_polling, sw_fallback);
#ifdef QAT_OPENSSL_PROVIDER
else if (provider)
if (provider)
tests_cleanup_provider(provider);
#endif

Expand Down
19 changes: 4 additions & 15 deletions test/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ struct test_params_t {
char *digest_kdf;
int prf_op;
int hkdf_op;
int ecx_op;
int explicit_engine;
int sign_only;
int verify_only;
int encrypt_only;
int decrypt_only;
int rsa_all;
int padding;
int async_jobs;
ASYNC_JOB **jobs;
ASYNC_WAIT_CTX **awcs;
Expand All @@ -97,19 +97,6 @@ struct async_additional_args_dsa {
int local_verify;
};

struct async_additional_args_rsa {
int sign_only;
int verify_only;
int encrypt_only;
int decrypt_only;
int rsa_all;
int padding;
};

struct async_additional_args_kdf {
int operation;
};

#ifdef QAT_OPENSSL_3
struct async_args_callback {
int job_ready;
Expand Down Expand Up @@ -201,7 +188,9 @@ enum curve_name {
B_CURVE_409,
B_CURVE_571,
P_CURVE_SM2,
CURVE_TYPE_MAX
X_CURVE_25519,
X_CURVE_448,
CURVE_TYPE_MAX,
};

#define SSL_MAX_DIGEST 6
Expand Down
145 changes: 74 additions & 71 deletions test/tests_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,89 +176,92 @@ static unsigned char dsa1024_g[] = {
0x6A, 0x7E, 0xD8, 0x32, 0xED, 0x0E, 0x02, 0xB8,
};

/* dsa 2048-256 */
static unsigned char dsa2048_priv[] = {
0x32, 0x67, 0x92, 0xf6, 0xc4, 0xe2, 0xe2, 0xe8, 0xa0, 0x8b, 0x6b, 0x45,
0x0c, 0x8a, 0x76, 0xb0, 0xee, 0xcf, 0x91, 0xa7,
0x69, 0xC7, 0x54, 0x8C, 0x21, 0xD0, 0xDF, 0xEA, 0x6B, 0x9A, 0x51, 0xC9,
0xEA, 0xD4, 0xE2, 0x7C, 0x33, 0xD3, 0xB3, 0xF1, 0x80, 0x31, 0x6E, 0x5B,
0xCA, 0xB9, 0x2C, 0x93, 0x3F, 0x0E, 0x4D, 0xBC
};

static unsigned char dsa2048_pub[] = {
0x17, 0x8f, 0xa8, 0x11, 0x84, 0x92, 0xec, 0x83, 0x47, 0xc7, 0x6a, 0xb0,
0x92, 0xaf, 0x5a, 0x20, 0x37, 0xa3, 0x64, 0x79, 0xd2, 0xd0, 0x3d, 0xcd,
0xe0, 0x61, 0x88, 0x88, 0x21, 0xcc, 0x74, 0x5d, 0xce, 0x4c, 0x51, 0x47,
0xf0, 0xc5, 0x5c, 0x4c, 0x82, 0x7a, 0xaf, 0x72, 0xad, 0xb9, 0xe0, 0x53,
0xf2, 0x78, 0xb7, 0xf0, 0xb5, 0x48, 0x7f, 0x8a, 0x3a, 0x18, 0xd1, 0x9f,
0x8b, 0x7d, 0xa5, 0x47, 0xb7, 0x95,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, 0x77, 0xDD, 0xA6,
0xF7, 0x11, 0x25, 0xA7, 0x45, 0x6F, 0xEA, 0x15, 0x3E, 0x43, 0x32, 0x56,
0xA2, 0x26, 0x1C, 0x6A, 0x06, 0xED, 0x36, 0x93, 0x79, 0x7E, 0x79, 0x95,
0xFA, 0xD5, 0xAA, 0xBB, 0xCF, 0xBE, 0x3E, 0xDA, 0x27, 0x41, 0xE3, 0x75,
0x40, 0x4A, 0xE2, 0x5B
};

static unsigned char dsa2048_q[] = {
0x97, 0xE7, 0x33, 0x4D, 0xD3, 0x94, 0x3E, 0x0B, 0xDB, 0x62, 0x74, 0xC6,
0xA1, 0x08, 0xDD, 0x19, 0xA3, 0x75, 0x17, 0x1B,
0xF2, 0xC3, 0x11, 0x93, 0x74, 0xCE, 0x76, 0xC9, 0x35, 0x69, 0x90, 0xB4,
0x65, 0x37, 0x4A, 0x17, 0xF2, 0x3F, 0x9E, 0xD3, 0x50, 0x89, 0xBD, 0x96,
0x9F, 0x61, 0xC6, 0xDD, 0xE9, 0x99, 0x8C, 0x1F
};

static unsigned char dsa2048_g[] = {
0x2C, 0x78, 0x16, 0x59, 0x34, 0x63, 0xF4, 0xF3, 0x92, 0xFC, 0xB5, 0xA5,
0x4F, 0x13, 0xDE, 0x2F, 0x1C, 0xA4, 0x3C, 0xAE, 0xAD, 0x38, 0x3F, 0x7E,
0x90, 0xBF, 0x96, 0xA6, 0xAE, 0x25, 0x90, 0x72, 0xF5, 0x8E, 0x80, 0x0C,
0x39, 0x1C, 0xD9, 0xEC, 0xBA, 0x90, 0x5B, 0x3A, 0xE8, 0x58, 0x6C, 0x9E,
0x30, 0x42, 0x37, 0x02, 0x31, 0x82, 0xBC, 0x6A, 0xDF, 0x6A, 0x09, 0x29,
0xE3, 0xC0, 0x46, 0xD1, 0xCB, 0x85, 0xEC, 0x0C, 0x30, 0x5E, 0xEA, 0xC8,
0x39, 0x8E, 0x22, 0x9F, 0x22, 0x10, 0xD2, 0x34, 0x61, 0x68, 0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,
0xBA, 0x9A, 0xE3, 0xF1, 0xDD, 0x24, 0x87, 0x19, 0x98, 0x74, 0x39, 0x3C,
0xD4, 0xD8, 0x32, 0x18, 0x68, 0x00, 0x65, 0x47, 0x60, 0xE1, 0xE3, 0x4C,
0x09, 0xE4, 0xD1, 0x55, 0x17, 0x9F, 0x9E, 0xC0, 0xDC, 0x44, 0x73, 0xF9,
0x96, 0xBD, 0xCE, 0x6E, 0xED, 0x1C, 0xAB, 0xED, 0x8B, 0x6F, 0x11, 0x6F,
0x7A, 0xD9, 0xCF, 0x50, 0x5D, 0xF0, 0xF9, 0x98, 0xE3, 0x4A, 0xB2, 0x75,
0x14, 0xB0, 0xFF, 0xE7
};

typedef struct testdsa_st {
Expand Down Expand Up @@ -513,7 +516,7 @@ static int run_dsa(void *args)
dsa_verify_ctx = EVP_PKEY_CTX_new(dsa_key, NULL);
if (dsa_verify_ctx == NULL
|| EVP_PKEY_verify_init(dsa_verify_ctx) <= 0
|| EVP_PKEY_verify(dsa_verify_ctx, buf2, sigsize, buf, 36) <= 0){
|| EVP_PKEY_verify(dsa_verify_ctx, buf2, sigsize, buf, 20) <= 0){
WARN("# FAIL DSA verify init failed! \n");
goto end;
}
Expand Down
31 changes: 9 additions & 22 deletions test/tests_ecdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ static int test_ecdh_curve(ENGINE * e,
}
}
if (!ret) {
if (!ecdh_negative_testcount )
if (!ecdh_negative_testcount ) {
INFO("# PASS verify for ECDH.\n");
else {
} else {
INFO("# FAIL verify for ECDH.\n");
BIO_printf(out,"Negative scenario %d: verify Passed unexpectedly ",
ecdh_negative_testcount );
Expand All @@ -387,7 +387,7 @@ static int test_ecdh_curve(ENGINE * e,
BIO_puts(out,"\nTesting key generation with ");
BIO_puts(out,text);
BIO_puts(out,"\n");
}
}

key1 = get_ec_key(nid);
key2 = get_ec_key(nid);
Expand Down Expand Up @@ -574,7 +574,7 @@ EVP_PKEY *get_ec_key(const int nid)
static int run_ecdh(void *args)
{
BN_CTX *ctx = NULL;
int i = 0, j = 0;
int i = 0;
BIO *out = NULL;
int ret = 1;

Expand Down Expand Up @@ -610,24 +610,11 @@ static int run_ecdh(void *args)
if(enable_negative > 0)
ecdh_negative_testcount = ECDH_NEGATIVE_TESTCOUNT;

if (curve) {
for (i = 0; i <= ecdh_negative_testcount; i++) {
if (test_ecdh_curve(e, get_nid(curve), ecdh_curve_name(curve),
ctx, count, print_output, verify, out, kdf, i) < 0) {
ret = 0;
}
}
}
else {
for (i = 0; i <= ecdh_negative_testcount; i++) {
for (j = 1; j < CURVE_TYPE_MAX; j++) {
if (test_ecdh_curve(e, get_nid(j), ecdh_curve_name(j), ctx,
count, print_output, verify, out, kdf, i) < 0) {
ret = 0;
}
}
}
}
for (i = 0; i <= ecdh_negative_testcount; i++) {
if (test_ecdh_curve(e, get_nid(curve), ecdh_curve_name(curve),
ctx, count, print_output, verify, out, kdf, i) < 0)
ret = 0;
}
err:
if (ret != 1)
ERR_print_errors_fp(stderr);
Expand Down
14 changes: 3 additions & 11 deletions test/tests_ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@ static int test_ecdsa(int count, int size, ENGINE * e, int print_output,
******************************************************************************/
static int run_ecdsa(void *args)
{
int i = 0;
int ret = 1;

TEST_PARAMS *temp_args = (TEST_PARAMS *)args;
Expand All @@ -615,16 +614,9 @@ static int run_ecdsa(void *args)

RAND_seed(rnd_seed, sizeof(rnd_seed));

if (!curve) {
for (i = 1; i < CURVE_TYPE_MAX; i++) {
if (test_ecdsa(count, size, e, print, verify, i,
ne) < 0)
ret = 0;
}
} else if (test_ecdsa(count, size, e, print, verify, curve,
ne) < 0) {
ret = 0;
}
if (test_ecdsa(count, size, e, print, verify, curve, ne) < 0)
ret = 0;

return ret;
}

Expand Down
Loading

0 comments on commit e42d23e

Please sign in to comment.