mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-05 13:34:14 +02:00
Merge pull request #8264 from dgarske/various_20241206
Various cleanups and fixes
This commit is contained in:
+44
-28
@@ -9926,7 +9926,7 @@ EVP_TEST_END:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(6,0,0))
|
||||
#if !defined(WOLFSSL_NO_AES_CFB_1_8)
|
||||
static wc_test_ret_t aescfb1_test(void)
|
||||
{
|
||||
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
||||
@@ -10093,7 +10093,7 @@ EVP_TEST_END:
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
#if !defined(WOLFCRYPT_ONLY) && !defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_128_cfb1(), key1, iv, msg1, sizeof(msg1),
|
||||
cipher, sizeof(msg1));
|
||||
if (ret != 0) {
|
||||
@@ -10126,7 +10126,7 @@ EVP_TEST_END:
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
#if !defined(WOLFCRYPT_ONLY) && !defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_192_cfb1(), key2, iv2, msg2, sizeof(msg2),
|
||||
cipher, sizeof(msg2));
|
||||
if (ret != 0) {
|
||||
@@ -10160,7 +10160,7 @@ EVP_TEST_END:
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
#if !defined(WOLFCRYPT_ONLY) && !defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_256_cfb1(), key3, iv3, msg3, sizeof(msg3),
|
||||
cipher, sizeof(msg3));
|
||||
if (ret != 0) {
|
||||
@@ -10304,7 +10304,8 @@ EVP_TEST_END:
|
||||
|
||||
#ifdef WOLFSSL_AES_128
|
||||
/* 128 key tests */
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) && \
|
||||
!defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_128_cfb8(), key1, iv, msg1, sizeof(msg1),
|
||||
cipher1, sizeof(cipher1));
|
||||
if (ret != 0) {
|
||||
@@ -10350,7 +10351,8 @@ EVP_TEST_END:
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
if (XMEMCMP(cipher, cipher2, sizeof(msg2)) != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) && \
|
||||
!defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_192_cfb8(), key2, iv2, msg2, sizeof(msg2),
|
||||
cipher2, sizeof(msg2));
|
||||
if (ret != 0) {
|
||||
@@ -10373,7 +10375,8 @@ EVP_TEST_END:
|
||||
if (XMEMCMP(cipher, cipher3, sizeof(cipher3)) != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) && \
|
||||
!defined(HAVE_FIPS)
|
||||
ret = EVP_test(wolfSSL_EVP_aes_256_cfb8(), key3, iv3, msg3, sizeof(msg3),
|
||||
cipher3, sizeof(msg3));
|
||||
if (ret != 0) {
|
||||
@@ -10399,7 +10402,7 @@ EVP_TEST_END:
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* !HAVE_SELFTEST && !HAVE_FIPS */
|
||||
#endif /* !WOLFSSL_NO_AES_CFB_1_8 */
|
||||
#endif /* WOLFSSL_AES_CFB */
|
||||
|
||||
#ifndef HAVE_RENESAS_SYNC
|
||||
@@ -14269,7 +14272,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_cfb_test(void)
|
||||
ret = aescfb_test_0();
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
#if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS)
|
||||
#if !defined(WOLFSSL_NO_AES_CFB_1_8)
|
||||
ret = aescfb1_test();
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
@@ -21853,8 +21856,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
|
||||
#endif
|
||||
|
||||
#if !defined(WC_NO_RNG) && !defined(WC_NO_RSA_OAEP) && \
|
||||
((!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_PUBLIC_MP)) && !defined(WOLF_CRYPTO_CB_ONLY_RSA)
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY) && defined(WOLFSSL_PUBLIC_MP) && \
|
||||
!defined(WOLF_CRYPTO_CB_ONLY_RSA)
|
||||
idx = (word32)ret;
|
||||
XMEMSET(plain, 0, plainSz);
|
||||
do {
|
||||
@@ -54595,17 +54598,20 @@ static wc_test_ret_t mp_test_shift(mp_int* a, mp_int* r1, WC_RNG* rng)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
for (i = 0; i < 4; i++) {
|
||||
mp_copy(r1, a);
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || (!defined(NO_RSA) && \
|
||||
defined(WC_RSA_BLINDING) && !defined(WOLFSSL_RSA_VERIFY_ONLY))
|
||||
ret = mp_lshd(r1, i);
|
||||
if (ret != MP_OKAY)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
#ifndef WOLFSSL_SP_MATH
|
||||
#ifndef WOLFSSL_SP_MATH
|
||||
mp_rshd(r1, i);
|
||||
#else
|
||||
#else
|
||||
mp_rshb(r1, i * SP_WORD_SIZE);
|
||||
#endif
|
||||
#endif
|
||||
ret = mp_cmp(a, r1);
|
||||
if (ret != MP_EQ)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
#endif
|
||||
}
|
||||
#ifndef WOLFSSL_SP_MATH
|
||||
for (i = 0; i < DIGIT_BIT+1; i++) {
|
||||
@@ -54970,7 +54976,7 @@ static wc_test_ret_t mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
|
||||
mp_zero(NULL);
|
||||
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || defined(WC_RSA_BLINDING) || \
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY)
|
||||
!defined(WOLFSSL_RSA_PUBLIC_ONLY)
|
||||
ret = mp_lshd(NULL, 0);
|
||||
if (ret != WC_NO_ERR_TRACE(MP_VAL))
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
@@ -55299,7 +55305,8 @@ static wc_test_ret_t mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
#endif
|
||||
|
||||
#if (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \
|
||||
#if (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \
|
||||
!defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(HAVE_ECC) || !defined(NO_DSA) || defined(OPENSSL_EXTRA)
|
||||
ret = mp_invmod(NULL, NULL, NULL);
|
||||
if (ret != WC_NO_ERR_TRACE(MP_VAL))
|
||||
@@ -56002,7 +56009,8 @@ static wc_test_ret_t mp_test_cmp(mp_int* a, mp_int* b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || !defined(WOLFSSL_RSA_VERIFY_ONLY)
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || (!defined(NO_RSA) && \
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
static wc_test_ret_t mp_test_shbd(mp_int* a, mp_int* b, WC_RNG* rng)
|
||||
{
|
||||
wc_test_ret_t ret;
|
||||
@@ -56071,9 +56079,8 @@ static wc_test_ret_t mp_test_shbd(mp_int* a, mp_int* b, WC_RNG* rng)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \
|
||||
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \
|
||||
!defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || \
|
||||
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
static wc_test_ret_t mp_test_div(mp_int* a, mp_int* d, mp_int* r, mp_int* rem,
|
||||
WC_RNG* rng)
|
||||
{
|
||||
@@ -56624,8 +56631,9 @@ static wc_test_ret_t mp_test_mul_sqr(mp_int* a, mp_int* b, mp_int* r1, mp_int* r
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || !defined(NO_DSA) || \
|
||||
defined(OPENSSL_EXTRA)
|
||||
#if (!defined(NO_RSA) && \
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(HAVE_ECC) || !defined(NO_DSA) || defined(OPENSSL_EXTRA)
|
||||
static wc_test_ret_t mp_test_invmod(mp_int* a, mp_int* m, mp_int* r)
|
||||
{
|
||||
wc_test_ret_t ret;
|
||||
@@ -57026,7 +57034,14 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void)
|
||||
#endif
|
||||
WOLFSSL_ENTER("mp_test");
|
||||
|
||||
#if !defined(WOLFSSL_RSA_PUBLIC_ONLY) || !defined(NO_DH) || defined(HAVE_ECC)
|
||||
ret = mp_init_multi(a, b, r1, r2, NULL, NULL);
|
||||
#else
|
||||
ret = mp_init(a);
|
||||
ret |= mp_init(b);
|
||||
ret |= mp_init(r1);
|
||||
ret |= mp_init(r2);
|
||||
#endif
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
|
||||
|
||||
@@ -57234,7 +57249,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void)
|
||||
#endif
|
||||
if ((ret = mp_test_cmp(a, r1)) != 0)
|
||||
goto done;
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || !defined(WOLFSSL_RSA_VERIFY_ONLY)
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || (!defined(NO_RSA) && \
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
if ((ret = mp_test_shbd(a, b, &rng)) != 0)
|
||||
goto done;
|
||||
#endif
|
||||
@@ -57242,9 +57258,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void)
|
||||
if ((ret = mp_test_set_is_bit(a)) != 0)
|
||||
goto done;
|
||||
#endif
|
||||
#if defined(WOLFSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \
|
||||
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \
|
||||
!defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
#if !defined(NO_DH) || defined(HAVE_ECC) || \
|
||||
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY))
|
||||
if ((ret = mp_test_div(a, b, r1, r2, &rng)) != 0)
|
||||
goto done;
|
||||
#endif
|
||||
@@ -57269,8 +57284,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t mp_test(void)
|
||||
#endif
|
||||
if ((ret = mp_test_mul_sqr(a, b, r1, r2, &rng)) != 0)
|
||||
goto done;
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || !defined(NO_DSA) || \
|
||||
defined(OPENSSL_EXTRA)
|
||||
#if (!defined(NO_RSA) && \
|
||||
!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(HAVE_ECC) || !defined(NO_DSA) || defined(OPENSSL_EXTRA)
|
||||
if ((ret = mp_test_invmod(a, b, r1)) != 0)
|
||||
goto done;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user