Skip to content

Commit 7e5ee37

Browse files
committed
Fix is_openssl_patched
1 parent e7d9301 commit 7e5ee37

File tree

5 files changed

+32
-71
lines changed

5 files changed

+32
-71
lines changed

.github/workflows/build-wolfprovider.yml

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -70,52 +70,13 @@ jobs:
7070
git remote add upstream https://github.com/wolfSSL/wolfProvider.git || true
7171
git fetch upstream --tags --no-recurse-submodules
7272
73-
- name: Restore wolfSSL packages
74-
uses: actions/cache@v4
75-
id: wolfssl_cache
76-
with:
77-
path: |
78-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.deb
79-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.dsc
80-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.tar.gz
81-
key: wolfssl-debian-packages-${{ inputs.wolfssl_ref }}
82-
83-
- name: Install wolfSSL packages from cache
84-
if: steps.wolfssl_cache.outputs.cache-hit == 'true'
85-
run: |
86-
printf "Installing wolfSSL packages from cache:\n"
87-
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
88-
apt install --reinstall -y ${{ env.WOLFSSL_PACKAGES_PATH }}/*wolfssl*.deb
89-
73+
# Build wolfSSL packages and install
74+
# Note we do not use the cache currently. This is a future optimization.
9075
# TODO: roll this step into utils-wolfssl.sh
9176
- name: Build wolfSSL packages and install
92-
# if: steps.wolfssl_cache.outputs.cache-hit != 'true'
9377
run: |
9478
$GITHUB_WORKSPACE/debian/install-wolfssl.sh --tag ${{ inputs.wolfssl_ref }} ${{ env.WOLFSSL_PACKAGES_PATH }}
9579
96-
# Check for cached OpenSSL packages
97-
# WARNING: for Debian, openssl_ref is ignored since we build from Debian baseline
98-
- name: Checking OpenSSL packages in cache
99-
uses: actions/cache@v4
100-
id: openssl_cache
101-
continue-on-error: true
102-
with:
103-
path: |
104-
${{ env.OPENSSL_PACKAGES_PATH }}
105-
key: openssl-debian-packages-${{ inputs.openssl_ref }}${{ inputs.replace_default && '-replace-default' || '' }}
106-
lookup-only: false
107-
108-
# Install OpenSSL packages from cache if available
109-
- name: Install OpenSSL packages from cache
110-
if: ${{ steps.openssl_cache.outputs.cache-hit == 'true' }}
111-
run: |
112-
printf "Installing OpenSSL packages from cache:\n"
113-
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
114-
apt install --reinstall -y \
115-
${{ env.OPENSSL_PACKAGES_PATH }}/openssl_*.deb \
116-
${{ env.OPENSSL_PACKAGES_PATH }}/libssl3_*.deb \
117-
${{ env.OPENSSL_PACKAGES_PATH }}/libssl-dev_*.deb
118-
11980
- name: Build wolfProvider
12081
run: |
12182
WOLFSSL_TAG=${{ inputs.wolfssl_ref }} OPENSSL_TAG=${{ inputs.openssl_ref }} \
@@ -138,7 +99,7 @@ jobs:
13899
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
139100
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
140101
141-
- name: Save to cache
102+
- name: Save all packages to cache for use by other workflows
142103
uses: actions/cache/save@v4
143104
continue-on-error: true
144105
with:
@@ -166,15 +127,3 @@ jobs:
166127
${{ env.WOLFPROV_PACKAGES_PATH }}/*.dsc
167128
${{ env.WOLFPROV_PACKAGES_PATH }}/*.tar.gz
168129
retention-days: 1
169-
170-
# TODO: upload wolfSSL artifacts, after building
171-
# - name: Upload wolfSSL artifacts
172-
# uses: actions/upload-artifact@v4
173-
# with:
174-
# name: wolfssl-debian-packages-${{ inputs.wolfssl_ref }}
175-
# path: |
176-
# ${{ env.WOLFPROV_PACKAGES_PATH }}/*wolfssl*.deb
177-
# ${{ env.WOLFPROV_PACKAGES_PATH }}/*wolfssl*.dsc
178-
# ${{ env.WOLFPROV_PACKAGES_PATH }}/*wolfssl*.tar.gz
179-
# retention-days: 1
180-

.github/workflows/xmlsec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: xmlsec Tests
33
# START OF COMMON SECTION
44
on:
55
push:
6-
branches: [ '**' ] # 'master', 'main', 'release/**' ]
6+
branches: [ 'master', 'main', 'release/**' ]
77
pull_request:
88
branches: [ '*' ]
99

debian/install-wolfssl.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ AC_CONFIG_FILES([debian/rules],[chmod +x debian/rules])' configure.ac
132132
# Configure with the specified options
133133
echo "Configuring wolfSSL with specified options..."
134134
configure_opts="--enable-opensslcoexist \
135+
--enable-opensslextra \
135136
--enable-cmac \
136137
--with-eccminsz=192 \
137138
--enable-ed25519 \
@@ -145,9 +146,16 @@ AC_CONFIG_FILES([debian/rules],[chmod +x debian/rules])' configure.ac
145146
--enable-keygen \
146147
--enable-shake128 \
147148
--enable-shake256 \
148-
--enable-wolfprovider \
149149
--enable-rsapss \
150-
--enable-scrypt"
150+
--enable-scrypt \
151+
--enable-base16 \
152+
--enable-aesctr \
153+
--enable-des3 \
154+
--enable-enckeys \
155+
--enable-hkdf \
156+
--enable-supportedcurves \
157+
--enable-base64encode \
158+
--enable-wolfprovider"
151159

152160
if [ "$debug_mode" = "true" ]; then
153161
configure_opts="$configure_opts --enable-debug"
@@ -173,7 +181,10 @@ AC_CONFIG_FILES([debian/rules],[chmod +x debian/rules])' configure.ac
173181
-DWC_RSA_DIRECT \
174182
-DWC_RSA_NO_PADDING \
175183
-DACVP_VECTOR_TESTING \
176-
-DWOLFSSL_ECDSA_SET_K" \
184+
-DWOLFSSL_ECDSA_SET_K \
185+
-DWOLFSSL_ASN_ALL \
186+
-DWOLFSSL_ALT_NAMES \
187+
-DWOLFSSL_HAVE_ISSUER_NAMES" \
177188
LIBS="-lm"
178189

179190
# Build Debian packages

scripts/utils-openssl.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,20 @@ clone_openssl() {
121121
}
122122

123123
is_openssl_patched() {
124-
if [ ! -f "${OPENSSL_SOURCE_DIR}/crypto/provider_predefined.c" ]; then
124+
# Return 0 if patched, 1 if not
125+
local dir="${OPENSSL_SOURCE_DIR:?OPENSSL_SOURCE_DIR not set}"
126+
local file="${dir%/}/crypto/provider_predefined.c"
127+
128+
# File must exist to be patched
129+
[[ -f "$file" ]] || return 1
130+
131+
# Any time we see libwolfprov, we're patched
132+
if grep -q 'libwolfprov' -- "$file"; then
125133
return 0
126134
fi
127135

128-
# Check if $OPENSSL_SOURCE_DIR is a git repository
129-
if [ -d ${OPENSSL_SOURCE_DIR}/.git ]; then
130-
pushd ${OPENSSL_SOURCE_DIR} &> /dev/null
131-
patch_applied=$(git diff --quiet "crypto/provider_predefined.c" 2>/dev/null && echo 1 || echo 0)
132-
popd &> /dev/null
133-
else
134-
# Not a git repo, may have been downloaded separately (from Debian sources)
135-
patch_applied=$(grep -q "libwolfprov" "${OPENSSL_SOURCE_DIR}/crypto/provider_predefined.c" && echo 1 || echo 0)
136-
fi
137-
return $patch_applied
136+
# Not patched
137+
return 1
138138
}
139139

140140
check_openssl_replace_default_mismatch() {

src/wp_wolfprov.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,9 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12421242
if (ok) {
12431243
if (wolfSSL_Debugging_ON() != 0) {
12441244
WOLFPROV_MSG(WP_LOG_PROVIDER,
1245-
"WARNING: wolfProvider built with debug but underlying wolfSSL is not!"
1246-
"Building wolfSSl with debug is highly recommended, proceeding...");
1245+
"WARNING: wolfProvider built with debug but underlying wolfSSL is not!");
1246+
WOLFPROV_MSG(WP_LOG_PROVIDER,
1247+
"\tBuilding wolfSSl with debug is highly recommended, proceeding...");
12471248
}
12481249
else {
12491250
wolfSSL_SetLoggingPrefix("wolfSSL");

0 commit comments

Comments
 (0)