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

20241024-opensslcoexist-opensslextra #8132

Merged

Conversation

douzzer
Copy link
Contributor

@douzzer douzzer commented Oct 31, 2024

Globally remap & refactor conflicting symbols to allow -DOPENSSL_EXTRA -DOPENSSL_COEXIST, or equivalently, --enable-opensslextra --enable-opensslcoexist.

No functional changes.

Several compat symbols that were formerly enums are now macros.

All library source is refactored to use only native symbols in all code gated in with --enable-all-crypto --enable-opensslextra.

wolfcrypt/test/test.c is similarly refactored to use only native symbols.

examples/ and tests/ are unmodified except for header setup to disable OPENSSL_COEXIST and TEST_OPENSSL_COEXIST.

tested with wolfssl-multi-test.sh ... super-quick-check all-crypto-openssl-extra-coexist-with-suites all-crypto-openssl-extra-coexist-smallstack all-crypto-openssl-extra-coexist-TEST_OPENSSL_COEXIST, the latter 3 of which add thorough testing of the newly allowed build settings.

if (bio->type == WOLFSSL_BIO_FILE && bio->shutdown == BIO_CLOSE) {
if (bio->type == WOLFSSL_BIO_FILE &&
bio->shutdown == WOLFSSL_BIO_CLOSE)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move brace up to previous line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the typography is much clearer the way I have it -- I use this technique routinely to avoid visual running together of the condition and the enclosed statements.

src/pk.c Outdated
@@ -3857,15 +3858,15 @@ static int wolfssl_rsa_sig_encode(int hashAlg, const unsigned char* hash,
ret = 0;
}

if ((ret == 1) && (hashAlg != NID_undef) &&
(padding == RSA_PKCS1_PADDING)) {
if ((ret == 1) && (hashAlg != wc_NID_undef) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wc_NID_undef => WC_NID_undef

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done -- turns out they were all macros. I misremembered them as enums.

src/ssl.c Outdated
@@ -14624,15 +14628,15 @@ int wolfSSL_CIPHER_get_auth_nid(const WOLFSSL_CIPHER* cipher)
{"SRP", NID_auth_srp},
{"ECDSA", NID_auth_ecdsa},
{"None", NID_auth_null},
{NULL, NID_undef}
{NULL, wc_NID_undef}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change all NIDs over.
NID_auth_ecdsa is definitely in OpenSSL.

Copy link
Contributor Author

@douzzer douzzer Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK yeah good idea, close the deal. the ones done in the first round were just what was necessary to get OPENSSL_EXTRA clean.

src/ssl_asn1.c Outdated
@@ -1019,7 +1019,7 @@ static void wolfssl_asn1_integer_reset_data(WOLFSSL_ASN1_INTEGER* a)
/* No data, not negative. */
a->negative = 0;
/* Set type to positive INTEGER. */
a->type = V_ASN1_INTEGER;
a->type = WOLFSSL_ASN1_TYPE_INTEGER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOLFSSL_V_ASN1_INTEGER

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup better. fixed globally for all WOLFSSL_ASN1_TYPE_*s.

src/tls13.c Outdated
@@ -5285,7 +5285,7 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
defined(WOLFSSL_WPAS_SMALL)
/* Check if client has disabled TLS 1.2 */
if (args->pv.minor == TLSv1_2_MINOR &&
(ssl->options.mask & SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2) {
(ssl->options.mask & WOLFSSL_OP_NO_TLSv1_2) == WOLFSSL_OP_NO_TLSv1_2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line too long

…A -DOPENSSL_COEXIST, or equivalently, --enable-opensslextra --enable-opensslcoexist.

No functional changes.

Several compat symbols that were formerly enums are now macros.

All library source is refactored to use only native symbols in all code gated in with --enable-all-crypto --enable-opensslextra.

wolfcrypt/test/test.c is similarly refactored to use only native symbols.

examples/ and tests/ are unmodified except for header setup to disable OPENSSL_COEXIST and TEST_OPENSSL_COEXIST.
…SN1_TYPE_* -- some are used in non-OPENSSL_EXTRA builds, e.g. when -DWOLFSSL_X509_NAME_AVAILABLE.
…T: cover -DWOLFSSL_QUIC, fix -DNO_ASN, rename WOLFSSL_ASN1_TYPE_* to WOLFSSL_V_ASN1_*, completed nativization of NID_*, and switch to prefix WC_NID_ rather than wc_NID_.
…T: cover -DWOLFSSL_QUIC, fix -DNO_ASN, rename WOLFSSL_ASN1_TYPE_* to WOLFSSL_V_ASN1_*, completed nativization of NID_*, and switch to prefix WC_NID_ rather than wc_NID_.
@douzzer douzzer force-pushed the 20241024-opensslcoexist-opensslextra branch from 2f96291 to 39e8cb5 Compare October 31, 2024 05:10
@douzzer douzzer requested a review from SparkiDev October 31, 2024 05:13
configure.ac:
* add --enable-all-osp to separate OSP meta-feature sets from --enable-all, allowing --enable-all --disable-all-osp --disable-opensslall (e.g. for testing OPENSSL_COEXIST).
* fix enable_all_crypto=yes in enable-all to be conditional on "$enable_all_crypto" = "".
* move enable_rsapss=yes from enable-all to enable-all-crypto.

examples/ and testsuite/: #undef OPENSSL_COEXIST unconditionally rather than only if defined(OPENSSL_EXTRA), to capture -DOPENSSL_EXTRA_X509_SMALL or any other such variants.
@douzzer
Copy link
Contributor Author

douzzer commented Oct 31, 2024

retest this please ("FAIL: scripts/openssl.test" in fips-all-rolling-releases-single.sh linuxv5:v5.0.0)

@@ -23,6 +23,19 @@
#ifndef TESTS_UNIT_H
#define TESTS_UNIT_H

#ifdef HAVE_CONFIG_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including config.h can only happen in the .c files.

@dgarske dgarske removed their assignment Nov 1, 2024
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing config.h include in the test header.

@dgarske dgarske merged commit 836b741 into wolfSSL:master Nov 1, 2024
142 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants