mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 03:07:29 +02:00
lkm_testcrypto.c: refactor subtests at end of dh_test() to use ERROR_OUT() with proper codes.
This commit is contained in:
@ -14646,27 +14646,29 @@ static int dh_test(void)
|
|||||||
#endif /* WOLFSSL_DH_EXTRA */
|
#endif /* WOLFSSL_DH_EXTRA */
|
||||||
|
|
||||||
ret = dh_generate_test(&rng);
|
ret = dh_generate_test(&rng);
|
||||||
if (ret == 0)
|
if (ret != 0)
|
||||||
ret = dh_fips_generate_test(&rng);
|
ERROR_OUT(-7954, done);
|
||||||
|
|
||||||
|
ret = dh_fips_generate_test(&rng);
|
||||||
|
if (ret != 0)
|
||||||
|
ERROR_OUT(-7955, done);
|
||||||
|
|
||||||
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
|
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
|
||||||
if (ret == 0)
|
ret = dh_test_check_pubvalue();
|
||||||
ret = dh_test_check_pubvalue();
|
if (ret != 0)
|
||||||
|
ERROR_OUT(-7956, done);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Specialized code for key gen when using FFDHE-2048 and FFDHE-3072. */
|
/* Specialized code for key gen when using FFDHE-2048 and FFDHE-3072. */
|
||||||
#ifdef HAVE_FFDHE_2048
|
#ifdef HAVE_FFDHE_2048
|
||||||
if (ret == 0) {
|
ret = dh_test_ffdhe(&rng, wc_Dh_ffdhe2048_Get());
|
||||||
ret = dh_test_ffdhe(&rng, wc_Dh_ffdhe2048_Get());
|
if (ret != 0)
|
||||||
if (ret != 0)
|
ERROR_OUT(-7957, done);
|
||||||
printf("error with FFDHE 2048\n");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FFDHE_3072
|
#ifdef HAVE_FFDHE_3072
|
||||||
if (ret == 0) {
|
ret = dh_test_ffdhe(&rng, wc_Dh_ffdhe3072_Get());
|
||||||
ret = dh_test_ffdhe(&rng, wc_Dh_ffdhe3072_Get());
|
if (ret != 0)
|
||||||
if (ret != 0)
|
ERROR_OUT(-7958, done);
|
||||||
printf("error with FFDHE 3072\n");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wc_FreeDhKey(&key);
|
wc_FreeDhKey(&key);
|
||||||
@ -14674,12 +14676,12 @@ static int dh_test(void)
|
|||||||
|
|
||||||
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) && \
|
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) && \
|
||||||
!defined(WOLFSSL_OLD_PRIME_CHECK)
|
!defined(WOLFSSL_OLD_PRIME_CHECK)
|
||||||
if (ret == 0) {
|
/* Test Check Key */
|
||||||
/* Test Check Key */
|
ret = wc_DhSetCheckKey(&key, dh_p, sizeof(dh_p), dh_g, sizeof(dh_g),
|
||||||
ret = wc_DhSetCheckKey(&key, dh_p, sizeof(dh_p), dh_g, sizeof(dh_g),
|
NULL, 0, 0, &rng);
|
||||||
NULL, 0, 0, &rng);
|
if (ret != 0)
|
||||||
keyInit = 1; /* DhSetCheckKey also initializes the key, free it */
|
ERROR_OUT(-7959, done);
|
||||||
}
|
keyInit = 1; /* DhSetCheckKey also initializes the key, free it */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
Reference in New Issue
Block a user