Skip to content

Add OpenSSL compat: BIO_get_new_index, i2d_PUBKEY_bio, OpenSSL_version - #10294

Open
Roy-Carter wants to merge 9 commits into
wolfSSL:masterfrom
Roy-Carter:feature/extra_enhancement_to_compatibility_layer
Open

Add OpenSSL compat: BIO_get_new_index, i2d_PUBKEY_bio, OpenSSL_version#10294
Roy-Carter wants to merge 9 commits into
wolfSSL:masterfrom
Roy-Carter:feature/extra_enhancement_to_compatibility_layer

Conversation

@Roy-Carter

Copy link
Copy Markdown
Contributor

Description

As part of the continuous of the integration of openssl to wolfssl i've come across a few missing functions needed for OpenSSL-compat APIs: BIO_get_new_index() (unique custom BIO type IDs, 128–255), i2d_PUBKEY_bio() (write public-key DER to a BIO), and OpenSSL_version(type) handling for the six standard OPENSSL_* selector constants (plus unknown → version string). Headers/macros updated under OPENSSL_EXTRA / !NO_BIO as appropriate.

Testing

Ran ./tests/unit.test with -~BIO_get_new_index, -~OpenSSL_version, and -~i2d_PUBKEY_bio (substring filters). All passed.

Checklist

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

@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl can you please run the workflow on this ?

@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@dgarske

dgarske commented Apr 23, 2026

Copy link
Copy Markdown
Member

Okay to test. Contributor agreement on file.

@github-actions

github-actions Bot commented Apr 23, 2026

Copy link
Copy Markdown

@Roy-Carter

Roy-Carter commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

hey @julek-wolfssl would you mind checking why the packaging test failed ? looks like a false positive , I don't see any errors there on the log regarding the build process of wolfssl which can relate to my code , or maybe I missed something

@dgarske dgarske 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.

�[1;38;5;243m--enable-leantls --enable-session-ticket --enable-sni --enable-opensslextra
  Testing DEFAULT: --enable-leantls --enable-session-ticket --enable-sni --enable-opensslextra --disable-shared
  Configure RESULT = 0
  
  make[2]: warning: -j9 forced in submake: resetting jobserver mode.
  /usr/bin/ld: tests/unit_test-api.o: in function `test_wolfSSL_i2d_PUBKEY_bio':
  api.c:(.text+0xcb74): undefined reference to `wolfSSL_i2d_PUBKEY_bio'
  /usr/bin/ld: api.c:(.text+0xcbc9): undefined reference to `wolfSSL_i2d_PUBKEY_bio'

  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:7709: tests/unit.test] Error 1
  make[1]: *** [Makefile:11517: all-recursive] Error 1

@Roy-Carter
Roy-Carter force-pushed the feature/extra_enhancement_to_compatibility_layer branch from 4a8f2a7 to 12e2b22 Compare April 26, 2026 06:58
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@dgarske @julek-wolfssl can we re-test ? fixed build errors

@julek-wolfssl

Copy link
Copy Markdown
Member

Retest this please.

Comment thread tests/api.c Outdated
@Roy-Carter
Roy-Carter force-pushed the feature/extra_enhancement_to_compatibility_layer branch from 12e2b22 to c3a8004 Compare April 29, 2026 10:03
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

openvpn test failed due to what seems like diffs from master and not my code , i rebased to master can we re-run workflow @julek-wolfssl

@Roy-Carter
Roy-Carter force-pushed the feature/extra_enhancement_to_compatibility_layer branch from 4dfa2fc to 74bd323 Compare May 8, 2026 14:59
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl @dgarske can we re-run workflows ? there was a conflict on two of the test files

@dgarske

dgarske commented May 8, 2026

Copy link
Copy Markdown
Member

Jenkins retest this please

@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.

Please rebase before pushing to this branch.

Comment thread wolfcrypt/src/evp_pk.c
Comment thread src/ssl.c Outdated
Comment thread tests/api.c Outdated
@dgarske dgarske assigned wolfSSL-Bot and unassigned julek-wolfssl Jun 9, 2026
@Roy-Carter
Roy-Carter force-pushed the feature/extra_enhancement_to_compatibility_layer branch from 68f5f12 to e127cb1 Compare June 21, 2026 12:17
@Roy-Carter

Copy link
Copy Markdown
Contributor Author

@julek-wolfssl not sure what it is but error is not recreating locally but i just rebased :

Also , regarding our ticket of Cato I see for some reason I don't have an access to it and I wrote a few extra messages there but not sure if it got to you . can you check ?

PASS: testsuite/testsuite.test
PASS: scripts/unit.test
============================================================================
Testsuite summary for wolfssl 5.9.1
============================================================================
# TOTAL: 21
# PASS:  16
# SKIP:  5
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory '/home/roy/Desktop/wolfssl'
make[3]: Leaving directory '/home/roy/Desktop/wolfssl'
make[2]: Leaving directory '/home/roy/Desktop/wolfssl'
make[1]: Leaving directory '/home/roy/Desktop/wolfssl'
root@roycart-LL-IL:/home/roy/Desktop/wolfssl# 

@Roy-Carter
Roy-Carter requested a review from julek-wolfssl June 21, 2026 12:18
@julek-wolfssl

Copy link
Copy Markdown
Member

@Roy-Carter
I think you can gate that specific test on OPENSSL_COEXIST. Its picking up the system libssl and we can skip that test when actually using libssl.

@julek-wolfssl

Copy link
Copy Markdown
Member

@Roy-Carter The exact test failing is test_wolfSSL_OpenSSL_version

@julek-wolfssl

Copy link
Copy Markdown
Member

Hi @Roy-Carter, would you like me to make the final changes on this PR?

@Roy-Carter

Copy link
Copy Markdown
Contributor Author

Hey @julek-wolfssl , yes that'll be great. unfortunately I'm filled up with work so I didn't manage to get into these here . If you can please take over the other 2 also (AFAIK there were okay, just minor test fixes)
All the code is already integrate on our side for now .

Much appreciated !

Roy-Carter and others added 8 commits July 28, 2026 08:58
wolfSSL_OpenSSL_version() was declared with either an int or a void
parameter list depending on OPENSSL_VERSION_NUMBER. That macro does not
evaluate the same way in the library and in the application: with
OPENSSL_COEXIST the library additionally pulls in the real OpenSSL
headers and gets their version number, while an application that turns
coexist off gets wolfSSL's default. The two builds then disagreed on the
argument list and the selector read garbage, so OpenSSL_version() always
hit the default case. Give the function a single unconditional
signature.

Also match the test guards for wolfSSL_i2d_PUBKEY_bio and
wolfSSL_OpenSSL_version to the guards on their implementations.
@julek-wolfssl
julek-wolfssl force-pushed the feature/extra_enhancement_to_compatibility_layer branch from e127cb1 to 5919a9d Compare July 28, 2026 14:26
@julek-wolfssl
julek-wolfssl requested a review from Copilot July 28, 2026 16:49

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 10 out of 10 changed files in this pull request and generated no new comments.

The Linux kernel build compiles with -Werror=date-time, so OPENSSL_BUILT_ON
broke libwolfssl.ko.
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