Skip to content

Commit fb25678

Browse files
committed
Merge branch 'master' of github.com:ColtonWilley/wolfProvider into wp_krb5_workflow
2 parents 6f4142c + 06161b2 commit fb25678

33 files changed

+939
-122
lines changed
28.6 MB
Binary file not shown.

.github/workflows/cmdline.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Command Line Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
cmdtest_test:
17+
name: Command line test
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
openssl_ref: [ 'master', 'openssl-3.5.0' ]
23+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
25+
debug: ['WOLFPROV_DEBUG=1', '']
26+
steps:
27+
- name: Checkout wolfProvider
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Checking wolfSSL/wolfProvider in cache
33+
# Debug builds are not currently supported by build-wolfprovider.yml
34+
# so those are manually built as a separate step.
35+
if: ${{ matrix.debug == '' }}
36+
uses: actions/cache@v4
37+
id: wolfprov-cache
38+
with:
39+
path: |
40+
wolfssl-install
41+
wolfprov-install
42+
openssl-install/lib64
43+
openssl-install/include
44+
openssl-install/bin
45+
46+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
47+
# Normally we would fail on cache miss, but we rebuild below
48+
# for the DEBUG build.
49+
fail-on-cache-miss: false
50+
51+
# If not yet built this version, build it now
52+
- name: Build wolfProvider
53+
# Only run the test for a cache miss. On hit, we've already run the test.
54+
if: steps.wolfprov-cache-restore.cache-hit != 'true'
55+
run: |
56+
${{ matrix.debug }} OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh
57+
58+
- name: Run tests
59+
run: |
60+
${{ matrix.force_fail }} ${{ matrix.debug }} ./scripts/cmd_test/do-cmd-tests.sh
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Debian Package Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ '*' ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-debian-package:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout wolfProvider
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
- run: |
20+
# Fetch tags
21+
git fetch --tags
22+
# List all tags
23+
git tag -l
24+
25+
- name: Set up environment
26+
run: |
27+
# Update package lists
28+
sudo apt-get update
29+
# Install build dependencies
30+
sudo apt-get install -y \
31+
build-essential \
32+
devscripts \
33+
debhelper \
34+
dh-autoreconf \
35+
libtool \
36+
pkg-config \
37+
git \
38+
wget \
39+
curl \
40+
ca-certificates \
41+
openssl \
42+
dpkg-dev \
43+
lintian \
44+
fakeroot \
45+
equivs
46+
# Install additional tools for testing
47+
sudo apt-get install -y \
48+
expect \
49+
xxd
50+
51+
# TODO: this step rebuilds the package for the current architecture
52+
# we may be able to remove it if we can ensure the package supports
53+
# the architecture of the runner (most likely amd64)
54+
- name: Install custom wolfssl
55+
run: |
56+
mkdir -p "$RUNNER_TEMP/wolfssl-pkg"
57+
cd "$RUNNER_TEMP/wolfssl-pkg"
58+
unzip $GITHUB_WORKSPACE/.github/packages/debian-packages-20250731T171211Z-1-001.zip
59+
cd debian-packages
60+
sudo dpkg-source -x wolfssl_5.8.2-1.dsc
61+
cd wolfssl-5.8.2
62+
sudo dpkg-buildpackage -b -us -uc
63+
sudo dpkg -i ../libwolfssl*.deb
64+
65+
- name: Build Debian package
66+
run: |
67+
# Run the build script
68+
# Bypass the warning prompt with 'yes Y'
69+
yes Y | ./scripts/build-wolfprovider.sh --debian
70+
71+
# List generated packages
72+
echo "Generated Packages:"
73+
ls -la ../*.deb ../*.dsc ../*.tar.gz || true
74+
75+
- name: Install package
76+
run: |
77+
# Find the package file
78+
PACKAGE_FILE=$(find ../ -name "libwolfprov_*.deb" | head -n1)
79+
if [ -z "$PACKAGE_FILE" ]; then
80+
echo "No package file found!"
81+
ls -la ../
82+
exit 1
83+
fi
84+
85+
echo "Installing package: $PACKAGE_FILE and dependencies"
86+
sudo apt install -y ./"$PACKAGE_FILE"
87+
88+
# Verify installation
89+
echo "Package Installation Verification:"
90+
dpkg -l | grep libwolfprov
91+
dpkg -L libwolfprov
92+
93+
- name: Test OpenSSL provider functionality
94+
run: |
95+
PROVIDER_CONF="/etc/ssl/openssl.cnf.d/wolfprovider.conf"
96+
PROVIDER_CONF_BACKUP="/tmp/wolfprovider.conf.backup"
97+
98+
# Temporarily move wolfprovider config so we can toggle between providers
99+
echo "3. Temporarily disabling wolfprovider for default provider tests:"
100+
mkdir -p /tmp/openssl-test
101+
if [ -f $PROVIDER_CONF ]; then
102+
sudo mv $PROVIDER_CONF $PROVIDER_CONF_BACKUP
103+
echo " - Moved $PROVIDER_CONF to $PROVIDER_CONF_BACKUP"
104+
else
105+
echo "$PROVIDER_CONF not found!"
106+
exit 1
107+
fi
108+
109+
# Run the do-cmd-test.sh script to execute interoperability tests
110+
echo "Running OpenSSL provider interoperability tests..."
111+
OPENSSL_BIN=$(eval which openssl) ./scripts/cmd_test/do-cmd-tests.sh
112+
113+
# Restore wolfprovider configuration
114+
echo "5. Restoring wolfprovider configuration:"
115+
if [ -f $PROVIDER_CONF_BACKUP ]; then
116+
sudo mv $PROVIDER_CONF_BACKUP $PROVIDER_CONF
117+
echo " - Restored $PROVIDER_CONF from $PROVIDER_CONF_BACKUP"
118+
fi
119+
120+
echo "PASS: All provider interoperability tests successful"
121+
122+
- name: Uninstall package and verify cleanup
123+
run: |
124+
# Uninstall the package
125+
sudo apt-get remove --purge -y libwolfprov
126+
127+
# Verify the package is removed
128+
if dpkg -l | grep -q libwolfprov; then
129+
echo "Package still installed after removal"
130+
dpkg -l | grep libwolfprov
131+
exit 1
132+
else
133+
echo "Package successfully removed"
134+
fi
135+
136+
# Check if the config file is removed
137+
if [ -f /etc/ssl/openssl.cnf.d/wolfprovider.conf ]; then
138+
echo "wolfprovider.conf still exists after package removal"
139+
ls -la /etc/ssl/openssl.cnf.d/
140+
exit 1
141+
else
142+
echo "wolfprovider.conf successfully removed"
143+
fi
144+
145+
# Check if the library files are removed
146+
if [ -f /usr/lib/*/ossl-modules/libwolfprov.so ]; then
147+
echo "libwolfprov.so still exists after package removal"
148+
find /usr/lib -name "libwolfprov.so*" 2>/dev/null || true
149+
exit 1
150+
else
151+
echo "libwolfprov.so successfully removed"
152+
fi
153+
154+
# Verify default OpenSSL provider is active
155+
echo "Verifying Default Provider is Active:"
156+
openssl list -providers
157+
158+
# Verify that the default provider is present and active
159+
echo "Checking default provider status:"
160+
if openssl list -providers | grep -q "default" && \
161+
openssl list -providers | grep -q "OpenSSL Default Provider" && \
162+
openssl list -providers | grep -q "status: active"; then
163+
echo "Default provider is present and active"
164+
else
165+
echo "Default provider verification failed"
166+
echo "Provider output:"
167+
openssl list -providers
168+
exit 1
169+
fi
170+
171+
echo "Package uninstallation and cleanup verification successful"
172+
173+
- name: Move package artifacts
174+
run: |
175+
# Move the generated packages to the temp directory
176+
mv ../*.deb $RUNNER_TEMP/ || true
177+
mv ../*.dsc $RUNNER_TEMP/ || true
178+
mv ../*.tar.gz $RUNNER_TEMP/ || true
179+
180+
# Save the build outputs which for use in release packages
181+
- name: Upload package artifacts
182+
if: always()
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: debian-packages
186+
path: |
187+
${{ runner.temp }}/*.deb
188+
${{ runner.temp }}/*.dsc
189+
${{ runner.temp }}/*.tar.gz
190+
retention-days: 7
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Libcryptsetup Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfprovider:
17+
uses: ./.github/workflows/build-wolfprovider.yml
18+
with:
19+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
20+
openssl_ref: ${{ matrix.openssl_ref }}
21+
strategy:
22+
matrix:
23+
wolfssl_ref: ['v5.8.0-stable', 'master']
24+
openssl_ref: ['openssl-3.5.0']
25+
26+
test_cryptsetup:
27+
runs-on: ubuntu-22.04
28+
needs: build_wolfprovider
29+
# This should be a safe limit for the tests to run.
30+
timeout-minutes: 20
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
cryptsetup_ref: ['v2.6.1']
35+
wolfssl_ref: ['v5.8.0-stable', 'master']
36+
openssl_ref: ['openssl-3.5.0']
37+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
38+
39+
steps:
40+
- name: Checkout wolfProvider
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 1
44+
45+
- name: Retrieving wolfSSL/wolfProvider from cache
46+
uses: actions/cache/restore@v4
47+
id: wolfprov-cache
48+
with:
49+
path: |
50+
wolfssl-install
51+
wolfprov-install
52+
openssl-install/lib64
53+
openssl-install/include
54+
openssl-install/bin
55+
56+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
57+
fail-on-cache-miss: true
58+
59+
- name: Install dependencies
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install -y \
63+
build-essential autoconf asciidoctor gettext autopoint libtool \
64+
pkg-config uuid-dev libdevmapper-dev libpopt-dev libjson-c-dev \
65+
libargon2-dev
66+
67+
- name: Checkout cryptsetup
68+
uses: actions/checkout@v4
69+
with:
70+
repository: mbroz/cryptsetup
71+
path: cryptsetup
72+
ref: ${{ matrix.cryptsetup_ref }}
73+
74+
- name: Checkout OSP
75+
uses: actions/checkout@v4
76+
with:
77+
repository: wolfssl/osp
78+
path: osp
79+
fetch-depth: 1
80+
- run: |
81+
cd cryptsetup
82+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/libcryptsetup/libcryptsetup-${{ matrix.cryptsetup_ref }}-wolfprov.patch
83+
84+
- name: Build cryptsetup
85+
working-directory: cryptsetup
86+
run: |
87+
./autogen.sh
88+
./configure --enable-static \
89+
--with-crypto-backend=openssl \
90+
--disable-ssh-token \
91+
--with-openssl-includes=$GITHUB_WORKSPACE/openssl-install/include \
92+
--with-openssl-libs=$GITHUB_WORKSPACE/openssl-install/lib64
93+
make -j$(nproc)
94+
95+
- name: Run cryptsetup tests
96+
working-directory: cryptsetup
97+
run: |
98+
source $GITHUB_WORKSPACE/scripts/env-setup
99+
export ${{ matrix.force_fail }}
100+
101+
make check 2>&1 | tee cryptsetup-test.log
102+
TEST_RESULT=$(grep -q "All 10 tests passed" cryptsetup-test.log && echo "0" || echo "1")
103+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} cryptsetup

0 commit comments

Comments
 (0)