Skip to content

Commit 0279fa8

Browse files
committed
Re-enable non-replace-default builds for testing
1 parent 1cbe1fe commit 0279fa8

File tree

6 files changed

+51
-36
lines changed

6 files changed

+51
-36
lines changed

.github/workflows/debian-package.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ jobs:
2727
replace_default: [ true ]
2828

2929
libwolfprov-standalone:
30-
# Standalone mode is disabled until we re-enable support for it in the debian build.
31-
if: false
32-
3330
runs-on: ubuntu-22.04
3431
needs: build_wolfprovider
3532
# Run inside Debian Bookworm to match packaging environment
@@ -43,7 +40,7 @@ jobs:
4340
matrix:
4441
wolfssl_ref: [ 'v5.8.2-stable' ]
4542
openssl_ref: [ 'openssl-3.5.2' ]
46-
replace_default: [ true ]
43+
replace_default: [ false ]
4744
env:
4845
WOLFSSL_PACKAGES_PATH: /tmp/wolfssl-packages
4946
OPENSSL_PACKAGES_PATH: /tmp/openssl-packages
@@ -165,7 +162,7 @@ jobs:
165162
echo "Package uninstallation and cleanup verification successful"
166163
167164
168-
libwolfprov-with-openssl:
165+
libwolfprov-replace-default:
169166
runs-on: ubuntu-22.04
170167
needs: build_wolfprovider
171168
# Run inside Debian Bookworm to match packaging environment

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,5 @@ debian/libssl3*
117117
!debian/*.postrm
118118
!debian/*.docs
119119
!debian/*.links
120+
!debian/*.triggers
120121

debian/control

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Build-Depends:
1414
Package: libwolfprov
1515
Architecture: any
1616
Multi-Arch: same
17-
Depends: ${shlibs:Depends}, ${misc:Depends}, libssl3 (>= 3.0.3), libwolfssl (>= 5.8.2), openssl
17+
Depends: ${shlibs:Depends}, ${misc:Depends}, libssl3 (>= 3.0.3), libwolfssl (>= 5.8.2)
18+
Recommends: openssl
1819
Provides: ${variant:provides}
1920
XB-Variant: ${variant}
2021
Description: wolfProvider library for OpenSSL — ${variant:desc}
@@ -43,9 +44,8 @@ Architecture: any
4344
Section: utils
4445
Multi-Arch: foreign
4546
Depends: ${shlibs:Depends}, ${misc:Depends}
46-
Description: Secure Sockets Layer toolkit - command line interface
47+
Description: Secure Sockets Layer toolkit - command line interface (wolfProvider build)
4748
This package contains the OpenSSL command line utility.
48-
Built for use with wolfProvider.
4949

5050
Package: libssl3
5151
Architecture: any

debian/libwolfprov.postinst

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,44 @@
11
#!/bin/sh
22
set -e
33

4-
# We currently only support "replace default" mode.
5-
# In this mode, we don't need to modify the system openssl.cnf file
6-
# since our modified openssl references libwolfprov.so explicitly.
7-
# In the future, we should add scripting here to find the system openssl.cnf file
8-
# and add the include line to it. Note that the code below
9-
# references a hardcoded path which may not be correct for all systems.
4+
# Define the include line to add to the openssl.cnf file
5+
INCLUDE_LINE=".include /usr/lib/ssl/openssl.cnf.d/wolfprovider.conf"
106

11-
# INCLUDE_LINE=".include /usr/lib/ssl/openssl.cnf.d/wolfprovider.conf"
12-
# CONF_FILE="/usr/lib/ssl/openssl.cnf"
13-
# CONF_DEFAULT="/usr/share/openssl-defaults/openssl.cnf"
7+
# Search for the openssl.cnf file in /usr, /lib and /etc
8+
CONF_FILES=$(find /usr /lib /etc -name openssl.cnf 2>/dev/null)
149

15-
# # Copy from our template if it doesn't exist
16-
# if [ ! -f "$CONF_FILE" ]; then
17-
# echo "Config file does not exist: $CONF_FILE"
18-
# if [ -f "$CONF_DEFAULT" ]; then
19-
# install -Dm644 "$CONF_DEFAULT" "$CONF_FILE"
20-
# else
21-
# echo "Default config file does not exist: $CONF_DEFAULT"
22-
# exit 1
23-
# fi
24-
# fi
10+
# Check if we are in replace-default mode by reading the openssl version
11+
REPLACE_DEFAULT=0
12+
if command -v openssl >/dev/null 2>&1; then
13+
OPENSSL_VERSION=$(openssl version)
14+
if echo "$OPENSSL_VERSION" | grep -q "wolfProvider"; then
15+
REPLACE_DEFAULT=1
16+
fi
17+
fi
2518

26-
# # Add include for wolfprovider config file if not already present
27-
# if grep -qF "$INCLUDE_LINE" "$CONF_FILE"; then
28-
# echo "Include line already exists in $CONF_FILE"
29-
# else
30-
# echo "Adding include for wolfprovider to $CONF_FILE..."
31-
# sed -i "/^openssl_conf/ a $INCLUDE_LINE" "$CONF_FILE"
32-
# fi
19+
if [ $REPLACE_DEFAULT -eq 1 ]; then
20+
# Remove INCLUDE_LINE from each CONF_FILE
21+
# Replace default mode should automatically find wolfProvider.
22+
# Using the config file or OPENSSL_CONF will cause:
23+
# 1. the provider name to be 'libwolfprov' instead of 'default'
24+
# 2. the provider init call to happen twice
25+
# Neither of these is harmful, but it's not ideal.
26+
for CONF_FILE in $CONF_FILES; do
27+
# Remove any line containing both ".include" and "wolfprovider.conf"
28+
sed -i '/\.include/ { /wolfprovider\.conf/ d; }' "$CONF_FILE"
29+
printf "Removed wolfprovider include line(s) from %s\n" "$CONF_FILE"
30+
done
31+
else
32+
# For each CONF_FILE, apply the include line to the openssl.cnf file, if not already applied
33+
for CONF_FILE in $CONF_FILES; do
34+
if grep -qF "$INCLUDE_LINE" "$CONF_FILE"; then
35+
echo "Include line already exists in $CONF_FILE"
36+
else
37+
echo "Adding include for wolfprovider to $CONF_FILE..."
38+
echo "$INCLUDE_LINE" >> "$CONF_FILE"
39+
fi
40+
done
41+
fi
3342

3443
#DEBHELPER#
3544
exit 0

debian/libwolfprov.triggers

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Re-run our setup whenever OpenSSL config or module dirs change
2+
interest-noawait /etc/ssl/openssl.cnf
3+
interest-noawait /etc/ssl/openssl.cnf.d
4+
interest-noawait /lib/ssl/openssl.cnf
5+
interest-noawait /lib/ssl/openssl.cnf.d
6+
interest-noawait /usr/lib/ssl/openssl.cnf
7+
interest-noawait /usr/lib/ssl/openssl.cnf.d
8+

scripts/verify-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ verify_openssl_version() {
152152
if [ $replace_default -eq 0 ]; then
153153
# Verify that wolfProv (case-insensitive) is in the version output
154154
if echo "$version_output" | grep -qi "wolfProv"; then
155-
log_success "wolfProv is in the version output"
155+
handle_error "wolfProv is in the version output"
156156
else
157-
handle_error "wolfProv is not in the version output"
157+
log_success "wolfProv is not in the version output"
158158
fi
159159
else
160160
# Verify that wolfProvider (case-insensitive) is in the version output

0 commit comments

Comments
 (0)