Skip to content

Implementing missing macros to openssl compatibility layer - #10520

Open
Roy-Carter wants to merge 6 commits into
wolfSSL:masterfrom
Roy-Carter:feature/extending_comp_layer
Open

Implementing missing macros to openssl compatibility layer #10520
Roy-Carter wants to merge 6 commits into
wolfSSL:masterfrom
Roy-Carter:feature/extending_comp_layer

Conversation

@Roy-Carter

Copy link
Copy Markdown
Contributor

Description

Implementing as part of migration to wolfssl
SSL_set_ciphersuites
X509_add1_ext_i2d
sk_GENERAL_NAME_new_null
EC_KEY_oct2key

Testing

unitests to each functionality added

Checklist

  • [ *] added tests
  • [ *] updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl second part of the functions i've implemented , split the PR's for clarity of checks .

@Roy-Carter
Roy-Carter force-pushed the feature/extending_comp_layer branch from 54ef2e4 to 413e8ac Compare May 24, 2026 11:04
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@dgarske errors seemed related to master diff. both tests worked for me locally , I rebased , can we re-run workflow?

@Roy-Carter
Roy-Carter force-pushed the feature/extending_comp_layer branch from 413e8ac to 62138a2 Compare May 29, 2026 12:42
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl @dgarske I've rebased to master , seems related to new changes added .

@dgarske

dgarske commented May 29, 2026

Copy link
Copy Markdown
Member

Jenkins okay to test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the OpenSSL compatibility layer with aliases and implementations for several missing APIs used during migration to wolfSSL.

Changes:

  • Adds compatibility mappings for SSL_set_ciphersuites, X509_add1_ext_i2d, sk_GENERAL_NAME_new_null, and EC_KEY_oct2key.
  • Implements wolfSSL_X509_add1_ext_i2d and wolfSSL_EC_KEY_oct2key.
  • Adds unit tests covering the new compatibility APIs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wolfssl/ssl.h Declares the new X509 extension helper.
wolfssl/openssl/ssl.h Adds OpenSSL compatibility macros for SSL, X509, and GENERAL_NAME APIs.
wolfssl/openssl/ec.h Declares and maps EC_KEY_oct2key.
src/x509.c Implements wolfSSL_X509_add1_ext_i2d.
src/pk_ec.c Implements wolfSSL_EC_KEY_oct2key.
tests/api.c Adds API tests for the new compatibility additions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/x509.c Outdated
Comment thread src/x509.c
Comment thread tests/api.c
Comment thread tests/api.c

@julek-wolfssl julek-wolfssl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Roy-Carter please address copilot review. Thanks.

@Roy-Carter
Roy-Carter force-pushed the feature/extending_comp_layer branch from 62138a2 to 653ec68 Compare June 7, 2026 07:53
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl can we re-run workflow ?

@Roy-Carter
Roy-Carter requested a review from julek-wolfssl June 7, 2026 07:54
julek-wolfssl
julek-wolfssl previously approved these changes Jun 8, 2026
@julek-wolfssl

Copy link
Copy Markdown
Member
$ ./autogen.sh && ./configure --enable-all && make check
...
FAILURES:
   871: test_wolfSSL_X509_add_ext
   929: test_wolfSSL_X509_add1_ext_i2d_flags

 End API Tests
 Failed/Skipped/Passed/All: 2/182/1432/1616

@Roy-Carter

Copy link
Copy Markdown
Contributor Author

can we re-run workflow @julek-wolfssl

also writing here about our ticket , I think it might've been closed / I lost perms to write on it even though I did send emails there it seems as if zendesk link is unavailable

Comment thread tests/api.c Outdated
ExpectNotNull(ctx = SSL_CTX_new(wolfSSLv23_client_method()));
ExpectNotNull(ssl = SSL_new(ctx));

ExpectIntEQ(SSL_set_ciphersuites(ssl, "TLS_AES_128_GCM_SHA256"), 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With --disable-errorstrings

   1309: test_wolfSSL_SSL_set_ciphersuites                  :
ERROR - tests/api.c line 2537 failed with:
    expected: wolfSSL_set_cipher_list(ssl, "TLS_AES_128_GCM_SHA256") == 1
    result:   0 != 1
 failed (  0.00002)
ERROR - tests/api.c line 36346 failed with:
    expected: Test failed
    result:   ret 0

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

Roy-Carter and others added 5 commits July 28, 2026 08:57
cipher_names[] only holds the IANA suite name when error strings are
built in, so lean builds could not match "TLS_AES_128_GCM_SHA256".
Gate the test on BUILD_TLS_AES_128_GCM_SHA256 and fall back to the
wolfSSL suite name.

Also build the basicConstraints ASN1_OBJECT with OBJ_nid2obj() so it
carries a real OID encoding, not just a hand-set type.
Removing an extension left state behind: the freed altName list was still
referenced by the altNamesNext retrieval hint (use after free through
X509_get_next_altname()), and the cached subject key ID string, the encoded
extended key usage and the per-extension set flags kept the removed extension
observable.

X509V3_ADD_SILENT only suppresses error reporting in OpenSSL, so
X509V3_ADD_DEFAULT on an existing extension fails either way.

REPLACE and REPLACE_EXISTING now encode the new extension before dropping the
old one, so a failure no longer destroys the existing extension.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

tests/api.c:21462

  • test_san_first_dns() truncates the copied DNS name to fit dnsBuf, but it reports the original (untruncated) length in outLen. This makes outLen inconsistent with the returned string and can lead callers to read past the end of the buffer when they trust outLen.
    src/pk_ec.c:4754
  • wolfSSL_EC_POINT_new() takes a const WOLFSSL_EC_GROUP*. Casting away const here is unnecessary and can mask real const-correctness issues (and may trigger compiler warnings with -Wcast-qual).
        point = wolfSSL_EC_POINT_new((WOLFSSL_EC_GROUP*)group);

@julek-wolfssl

Copy link
Copy Markdown
Member

retest this please

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.

5 participants