-
Notifications
You must be signed in to change notification settings - Fork 28
Initial option to replace openssl default provider #260
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cf77626
Initial draft of option to replace openssl default provider
ColtonWilley d81f133
New test framework for standlone binary testing, including tests vali…
ColtonWilley 819787b
Add default stub cleanup handling
ColtonWilley c29534b
Update with explicit provider name checks, add workflow for replace d…
ColtonWilley 34c8074
Allow error output from env script
ColtonWilley db2cf27
Fix libdefault installation
ColtonWilley 2ae0832
Clarify script comments
ColtonWilley f9befa3
Only install libdefault into openssl install location
ColtonWilley 59b84e9
Add logic to check for replace default mismatch and error
ColtonWilley bb0bc10
Rename patch and add a readme
ColtonWilley 639088d
Accurate version info in readme
ColtonWilley 9c50664
Update patch name in script
ColtonWilley 664aadb
Check for patch mismatch even if openssl is not installed, update readme
ColtonWilley c8fa541
Merge branch 'master' of github.com:ColtonWilley/wolfProvider into wp…
ColtonWilley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Replace Default Tests | ||
|
|
||
| # START OF COMMON SECTION | ||
| on: | ||
| push: | ||
| branches: [ 'master', 'main', 'release/**' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| # END OF COMMON SECTION | ||
|
|
||
| jobs: | ||
| replace_default_test: | ||
| name: Replace Default Test | ||
| runs-on: ubuntu-22.04 | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| matrix: | ||
| # Test both standard and replace-default builds | ||
| replace_default: ['', '--replace-default'] | ||
| # Test with stable versions | ||
| wolfssl_ref: ['v5.8.0-stable'] | ||
| openssl_ref: ['openssl-3.5.0'] | ||
| steps: | ||
| - name: Checkout wolfProvider | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Build wolfProvider ${{ matrix.replace_default && 'with replace-default' || 'standard' }} | ||
| run: | | ||
| OPENSSL_TAG=${{ matrix.openssl_ref }} \ | ||
| WOLFSSL_TAG=${{ matrix.wolfssl_ref }} \ | ||
| ./scripts/build-wolfprovider.sh ${{ matrix.replace_default }} | ||
|
|
||
| - name: Run standalone test suite | ||
| run: | | ||
| ./test/standalone/runners/run_standalone_tests.sh | ||
|
|
||
| - name: Print errors on failure | ||
| if: ${{ failure() }} | ||
| run: | | ||
| # Build failure log | ||
| if [ -f scripts/build-release.log ]; then | ||
| echo "=== Build log (last 50 lines) ===" | ||
| tail -n 50 scripts/build-release.log | ||
| fi | ||
|
|
||
| # Test suite failure log | ||
| if [ -f test-suite.log ]; then | ||
| echo "=== Test suite log ===" | ||
| cat test-suite.log | ||
| fi | ||
|
|
||
| # Standalone test failures | ||
| if [ -d test/standalone/runners/test_results ]; then | ||
| for log in test/standalone/runners/test_results/*.log; do | ||
| if [ -f "$log" ]; then | ||
| echo "=== $log ===" | ||
| cat "$log" | ||
| fi | ||
| done | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Makefile | ||
| Makefile.in | ||
| .deps/ | ||
| .libs/ | ||
| *.la | ||
| *.lo | ||
| *.o | ||
| aclocal.m4 | ||
| autom4te.cache/ | ||
| config.log | ||
| config.status | ||
| configure | ||
| libtool | ||
| *.so | ||
| *.so.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| lib_LTLIBRARIES = libdefault.la | ||
| libdefault_la_SOURCES = wp_default_stub.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # libdefault - Default Provider Stub Library | ||
|
|
||
| Minimal autotools build for a stub version of the default provider. | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| # Generate build system | ||
| ./autogen.sh | ||
|
|
||
| # Configure and build | ||
| ./configure | ||
| make | ||
|
|
||
| # Clean build artifacts | ||
| make clean | ||
| ``` | ||
|
|
||
| ## Output | ||
|
|
||
| The build produces `libdefault.so` in the `.libs/` directory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| autoreconf -fiv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| AC_INIT([libdefault], [1.0], [[email protected]]) | ||
| AM_INIT_AUTOMAKE([-Wall -Werror foreign]) | ||
| AC_PROG_CC | ||
| AM_PROG_AR | ||
| LT_INIT | ||
| AC_CONFIG_FILES([Makefile]) | ||
| AC_OUTPUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright (C) 2006-2024 wolfSSL Inc. | ||
| * | ||
| * This file is part of wolfProvider. | ||
| * | ||
| * wolfProvider is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * wolfProvider is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with wolfProvider. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include <openssl/provider.h> | ||
|
|
||
| /* Prototype of public function that initializes the wolfSSL provider. */ | ||
| OSSL_provider_init_fn wolfssl_provider_init; | ||
|
|
||
| /* Prototype for the wolfprov_provider_init function */ | ||
| int wolfprov_provider_init(const OSSL_CORE_HANDLE* handle, | ||
padelsbach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const OSSL_DISPATCH* in, | ||
| const OSSL_DISPATCH** out, | ||
| void** provCtx); | ||
|
|
||
| /* | ||
| * Provider implementation stub | ||
| */ | ||
| int wolfprov_provider_init(const OSSL_CORE_HANDLE* handle, | ||
padelsbach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const OSSL_DISPATCH* in, | ||
| const OSSL_DISPATCH** out, | ||
| void** provCtx) | ||
| { | ||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # OpenSSL Default Provider Replacement Patch | ||
|
|
||
| > **Note**: For comprehensive Open Source Project (OSP) patches and integration work, visit the main wolfSSL OSP repository: **https://github.com/wolfSSL/osp/tree/master/wolfProvider** | ||
|
|
||
| This directory contains the patch for replacing OpenSSL's default provider with wolfProvider. | ||
|
|
||
| ## Purpose | ||
|
|
||
| The patch modifies OpenSSL's provider registration to substitute wolfProvider as the "default" provider, ensuring that all default provider operations are handled by wolfProvider instead of OpenSSL's built-in implementation. | ||
|
|
||
| ## Compatibility | ||
|
|
||
| - **Supported Versions**: OpenSSL 3.0 and later | ||
| - **Patch Target**: `crypto/provider_predefined.c` | ||
|
|
||
| This directory contains only the OpenSSL default provider replacement functionality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| diff --git a/crypto/provider_predefined.c b/crypto/provider_predefined.c | ||
| index 068e0b7..499a9ca 100644 | ||
| --- a/crypto/provider_predefined.c | ||
| +++ b/crypto/provider_predefined.c | ||
| @@ -10,21 +10,15 @@ | ||
| #include <openssl/core.h> | ||
| #include "provider_local.h" | ||
|
|
||
| -OSSL_provider_init_fn ossl_default_provider_init; | ||
| +OSSL_provider_init_fn wolfprov_provider_init; | ||
| OSSL_provider_init_fn ossl_base_provider_init; | ||
| OSSL_provider_init_fn ossl_null_provider_init; | ||
| -OSSL_provider_init_fn ossl_fips_intern_provider_init; | ||
| -#ifdef STATIC_LEGACY | ||
| -OSSL_provider_init_fn ossl_legacy_provider_init; | ||
| -#endif | ||
| const OSSL_PROVIDER_INFO ossl_predefined_providers[] = { | ||
| #ifdef FIPS_MODULE | ||
| - { "fips", NULL, ossl_fips_intern_provider_init, NULL, 1 }, | ||
| + { "fips", NULL, wolfprov_provider_init, NULL, 1 }, | ||
| #else | ||
| - { "default", NULL, ossl_default_provider_init, NULL, 1 }, | ||
| -# ifdef STATIC_LEGACY | ||
| - { "legacy", NULL, ossl_legacy_provider_init, NULL, 0 }, | ||
| -# endif | ||
| + { "default", NULL, wolfprov_provider_init, NULL, 1 }, | ||
| + { "legacy", NULL, wolfprov_provider_init, NULL, 0 }, | ||
| { "base", NULL, ossl_base_provider_init, NULL, 0 }, | ||
| { "null", NULL, ossl_null_provider_init, NULL, 0 }, | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.