Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression testing: fix compilation for unusual configs #7699

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21465,6 +21465,7 @@ int wolfSSL_curve_is_disabled(const WOLFSSL* ssl, word16 curve_id)
#define CURVE_NAME(c) XSTR_SIZEOF((c)), (c)

const WOLF_EC_NIST_NAME kNistCurves[] = {
#ifdef HAVE_ECC
{CURVE_NAME("P-160"), NID_secp160r1, WOLFSSL_ECC_SECP160R1},
{CURVE_NAME("P-160-2"), NID_secp160r2, WOLFSSL_ECC_SECP160R2},
{CURVE_NAME("P-192"), NID_X9_62_prime192v1, WOLFSSL_ECC_SECP192R1},
Expand All @@ -21479,6 +21480,7 @@ const WOLF_EC_NIST_NAME kNistCurves[] = {
{CURVE_NAME("B-256"), NID_brainpoolP256r1, WOLFSSL_ECC_BRAINPOOLP256R1},
{CURVE_NAME("B-384"), NID_brainpoolP384r1, WOLFSSL_ECC_BRAINPOOLP384R1},
{CURVE_NAME("B-512"), NID_brainpoolP512r1, WOLFSSL_ECC_BRAINPOOLP512R1},
#endif
#ifdef HAVE_CURVE25519
{CURVE_NAME("X25519"), NID_X25519, WOLFSSL_ECC_X25519},
#endif
Expand All @@ -21489,7 +21491,7 @@ const WOLF_EC_NIST_NAME kNistCurves[] = {
{CURVE_NAME("KYBER_LEVEL1"), WOLFSSL_KYBER_LEVEL1, WOLFSSL_KYBER_LEVEL1},
{CURVE_NAME("KYBER_LEVEL3"), WOLFSSL_KYBER_LEVEL3, WOLFSSL_KYBER_LEVEL1},
{CURVE_NAME("KYBER_LEVEL5"), WOLFSSL_KYBER_LEVEL5, WOLFSSL_KYBER_LEVEL1},
#if defined(WOLFSSL_WC_KYBER) || defined(HAVE_LIBOQS)
#if (defined(WOLFSSL_WC_KYBER) || defined(HAVE_LIBOQS)) && defined(HAVE_ECC)
{CURVE_NAME("P256_KYBER_LEVEL1"), WOLFSSL_P256_KYBER_LEVEL1, WOLFSSL_P256_KYBER_LEVEL1},
{CURVE_NAME("P384_KYBER_LEVEL3"), WOLFSSL_P384_KYBER_LEVEL3, WOLFSSL_P256_KYBER_LEVEL1},
{CURVE_NAME("P521_KYBER_LEVEL5"), WOLFSSL_P521_KYBER_LEVEL5, WOLFSSL_P256_KYBER_LEVEL1},
Expand All @@ -21498,11 +21500,13 @@ const WOLF_EC_NIST_NAME kNistCurves[] = {
#ifdef WOLFSSL_SM2
{CURVE_NAME("SM2"), NID_sm2, WOLFSSL_ECC_SM2P256V1},
#endif
#ifdef HAVE_ECC
/* Alternative curve names */
{CURVE_NAME("prime256v1"), NID_X9_62_prime256v1, WOLFSSL_ECC_SECP256R1},
{CURVE_NAME("secp256r1"), NID_X9_62_prime256v1, WOLFSSL_ECC_SECP256R1},
{CURVE_NAME("secp384r1"), NID_secp384r1, WOLFSSL_ECC_SECP384R1},
{CURVE_NAME("secp521r1"), NID_secp521r1, WOLFSSL_ECC_SECP521R1},
#endif
#ifdef WOLFSSL_SM2
{CURVE_NAME("sm2p256v1"), NID_sm2, WOLFSSL_ECC_SM2P256V1},
#endif
Expand Down
13 changes: 8 additions & 5 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -11339,7 +11339,8 @@ static int test_wolfSSL_UseMaxFragment(void)
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);

#if defined(OPENSSL_EXTRA) && defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES)
#if defined(OPENSSL_EXTRA) && defined(HAVE_MAX_FRAGMENT) && \
defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES)
/* check negotiated max fragment size */
{
WOLFSSL *ssl_c = NULL;
Expand All @@ -11354,8 +11355,10 @@ static int test_wolfSSL_UseMaxFragment(void)
ExpectIntEQ(wolfSSL_UseMaxFragment(ssl_c, WOLFSSL_MFL_2_8),
WOLFSSL_SUCCESS);
ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
#ifndef NO_SESSION_CACHE
ExpectIntEQ(SSL_SESSION_get_max_fragment_length(
wolfSSL_get_session(ssl_c)), WOLFSSL_MFL_2_8);
#endif

wolfSSL_free(ssl_c);
wolfSSL_free(ssl_s);
Expand Down Expand Up @@ -34035,21 +34038,21 @@ static int test_wolfSSL_ASN1_UNIVERSALSTRING_to_string(void)
static int test_wolfSSL_ASN1_GENERALIZEDTIME_free(void)
{
EXPECT_DECLS;
#if defined(OPENSSL_EXTRA)
#if defined(OPENSSL_EXTRA) && !defined(NO_ASN_TIME)
WOLFSSL_ASN1_GENERALIZEDTIME* asn1_gtime = NULL;

ExpectNotNull(asn1_gtime = ASN1_GENERALIZEDTIME_new());
if (asn1_gtime != NULL)
XMEMCPY(asn1_gtime->data, "20180504123500Z", ASN_GENERALIZED_TIME_SIZE);
ASN1_GENERALIZEDTIME_free(asn1_gtime);
#endif /* OPENSSL_EXTRA */
#endif /* OPENSSL_EXTRA && !NO_ASN_TIME */
return EXPECT_RESULT();
}

static int test_wolfSSL_ASN1_GENERALIZEDTIME_print(void)
{
EXPECT_DECLS;
#if defined(OPENSSL_EXTRA) && !defined(NO_BIO)
#if defined(OPENSSL_EXTRA) && !defined(NO_ASN_TIME) && !defined(NO_BIO)
WOLFSSL_ASN1_GENERALIZEDTIME* gtime = NULL;
BIO* bio = NULL;
unsigned char buf[24];
Expand Down Expand Up @@ -34087,7 +34090,7 @@ static int test_wolfSSL_ASN1_GENERALIZEDTIME_print(void)
BIO_free(bio);

wolfSSL_ASN1_GENERALIZEDTIME_free(gtime);
#endif /* OPENSSL_EXTRA */
#endif /* OPENSSL_EXTRA && !NO_ASN_TIME && !NO_BIO */
return EXPECT_RESULT();
}

Expand Down