-
Notifications
You must be signed in to change notification settings - Fork 28
Add new option to enable unit testing for replace default mode #331
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
padelsbach
merged 4 commits into
wolfSSL:master
from
ColtonWilley:wp_enable_replace_default_unit_test
Dec 8, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
66d9738
Add new option to enable unit testing for replace default mode, direc…
ColtonWilley 874e660
changes per review comments, name change, consistency checks, documen…
ColtonWilley 129f0cc
Update simple.yml to test with new enable default replace testing option
ColtonWilley ef7537d
Update replace default testing README and script checks
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
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,92 @@ | ||
| #!/bin/bash | ||
| # | ||
| # 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/>. | ||
| # | ||
|
|
||
| # | ||
| # Patch libcrypto.num to export internal provider functions | ||
| # | ||
| # This script appends 6 internal provider symbols to OpenSSL's libcrypto.num | ||
| # file, making them available for direct provider loading in wolfprovider unit tests. | ||
| # | ||
|
|
||
| set -e | ||
|
|
||
| # OPENSSL_SOURCE_DIR should be set by the caller (utils-openssl.sh) | ||
| if [ -z "$OPENSSL_SOURCE_DIR" ]; then | ||
| echo "ERROR: OPENSSL_SOURCE_DIR not set" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Source utils-openssl.sh to use is_libcrypto_num_patched function | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| source "${SCRIPT_DIR}/utils-openssl.sh" | ||
|
|
||
| LIBCRYPTO_NUM="${OPENSSL_SOURCE_DIR}/util/libcrypto.num" | ||
|
|
||
| # Check if file exists | ||
| if [ ! -f "$LIBCRYPTO_NUM" ]; then | ||
| echo "ERROR: libcrypto.num not found at: $LIBCRYPTO_NUM" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if already patched using shared function | ||
| if is_libcrypto_num_patched; then | ||
| echo "libcrypto.num already patched (provider symbols present)" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Get the last symbol number | ||
| LAST_NUM=$(awk '{print $2}' "$LIBCRYPTO_NUM" | grep -E '^[0-9]+$' | sort -n | tail -1) | ||
|
|
||
| if [ -z "$LAST_NUM" ]; then | ||
| echo "ERROR: Could not determine last symbol number from libcrypto.num" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get the version tag from the last line (column 3) | ||
| LAST_VERSION=$(tail -1 "$LIBCRYPTO_NUM" | awk '{print $3}') | ||
|
|
||
| if [ -z "$LAST_VERSION" ]; then | ||
| echo "ERROR: Could not determine version tag from libcrypto.num" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Calculate new symbol numbers | ||
| NUM1=$((LAST_NUM + 1)) | ||
| NUM2=$((LAST_NUM + 2)) | ||
| NUM3=$((LAST_NUM + 3)) | ||
| NUM4=$((LAST_NUM + 4)) | ||
| NUM5=$((LAST_NUM + 5)) | ||
| NUM6=$((LAST_NUM + 6)) | ||
|
|
||
| # Append the 6 provider symbols | ||
| # Format matches existing entries: name (40 chars) TAB number TAB version TAB specification | ||
| # Use printf to ensure proper tab characters | ||
| { | ||
| printf "ossl_provider_new %s\t%s\tEXIST::FUNCTION:\n" "${NUM1}" "${LAST_VERSION}" | ||
| printf "ossl_provider_activate %s\t%s\tEXIST::FUNCTION:\n" "${NUM2}" "${LAST_VERSION}" | ||
| printf "ossl_provider_deactivate %s\t%s\tEXIST::FUNCTION:\n" "${NUM3}" "${LAST_VERSION}" | ||
| printf "ossl_provider_add_to_store %s\t%s\tEXIST::FUNCTION:\n" "${NUM4}" "${LAST_VERSION}" | ||
| printf "ossl_provider_free %s\t%s\tEXIST::FUNCTION:\n" "${NUM5}" "${LAST_VERSION}" | ||
| printf "ossl_default_provider_init %s\t%s\tEXIST::FUNCTION:\n" "${NUM6}" "${LAST_VERSION}" | ||
| } >> "$LIBCRYPTO_NUM" | ||
|
|
||
| echo "Successfully patched libcrypto.num: Added symbols ${NUM1}-${NUM6} with version ${LAST_VERSION}" | ||
| exit 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
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.