Skip to content

Commit 7c09e2b

Browse files
authored
Merge pull request #111 from wolfSSL/devin/1736248432-debian-packaging
Add Debian packaging support for wolfPKCS11
2 parents 1c73dc9 + 77a59e0 commit 7c09e2b

9 files changed

Lines changed: 298 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Debian Package Build and Install Test
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
debian-package-test:
11+
runs-on: ubuntu-22.04
12+
13+
steps:
14+
# Pull wolfPKCS11
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: true
18+
19+
# Install debian packaging tools
20+
- name: Install debian packaging dependencies
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y build-essential autoconf gawk debhelper lintian
24+
25+
# Setup wolfssl with required flags for wolfPKCS11
26+
- uses: actions/checkout@v4
27+
with:
28+
repository: wolfssl/wolfssl
29+
path: wolfssl
30+
- name: wolfssl autogen
31+
working-directory: ./wolfssl
32+
run: ./autogen.sh
33+
- name: wolfssl configure
34+
working-directory: ./wolfssl
35+
run: |
36+
./configure --enable-cryptocb --enable-aescfb --enable-aesctr --enable-rsapss --enable-keygen --enable-pwdbased --enable-scrypt --enable-md5 --enable-cmac \
37+
C_EXTRA_FLAGS="-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT -DHAVE_AES_ECB"
38+
- name: wolfssl make and install
39+
working-directory: ./wolfssl
40+
run: |
41+
make
42+
sudo make deb
43+
44+
- name: wolfssl install
45+
working-directory: ./wolfssl
46+
run: |
47+
sudo dpkg -i libwolfssl_*.deb libwolfssl-dev_*.deb
48+
49+
# Setup wolfPKCS11
50+
- name: wolfpkcs11 autogen
51+
run: ./autogen.sh
52+
- name: wolfpkcs11 configure
53+
run: ./configure --enable-nss --enable-aesecb --enable-aesctr --enable-aesccm --enable-aescmac
54+
55+
# Test local debian package build
56+
- name: Test make deb
57+
run: |
58+
make deb
59+
ls -la *.deb
60+
61+
# Test debian package installation
62+
- name: Test debian package installation
63+
run: |
64+
sudo dpkg -i libwolfpkcs11_*.deb libwolfpkcs11-dev_*.deb
65+
66+
# Verify installation
67+
- name: Verify package installation
68+
run: |
69+
dpkg -l | grep wolfpkcs11
70+
ls -la /usr/lib/libwolfpkcs11*
71+
ls -la /usr/include/wolfpkcs11/ || echo "Headers not found in expected location"
72+
pkg-config --exists wolfpkcs11 && echo "pkg-config found wolfpkcs11" || echo "pkg-config did not find wolfpkcs11"
73+
74+
# Upload generated packages as artifacts
75+
- name: Upload debian packages
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: wolfpkcs11-debian-packages
79+
path: "*.deb"
80+
retention-days: 5
81+
82+
# Capture logs on failure
83+
- name: Upload failure logs
84+
if: failure() || cancelled()
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: debian-package-test-logs
88+
path: |
89+
test-suite.log
90+
debian/files
91+
debian/*.log
92+
retention-days: 5

Docker/include.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EXTRA_DIST+= Docker/packaging/debian/Dockerfile

Docker/packaging/debian/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM debian:latest
2+
3+
RUN apt-get -y update
4+
RUN apt-get -y upgrade
5+
RUN apt-get install -y build-essential autoconf gawk debhelper lintian libwolfssl-dev

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ include wolfpkcs11/include.am
3636
include examples/include.am
3737
include tests/include.am
3838
include IDE/include.am
39+
include debian/include.am
40+
include Docker/include.am
3941

4042
EXTRA_DIST+= README.md
4143
EXTRA_DIST+= LICENSE

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
wolfpkcs11 (1.3.0) stable; urgency=medium
2+
3+
* For a full changelog see
4+
https://github.com/wolfSSL/wolfPKCS11/blob/master/README.md
5+
6+
-- wolfSSL <support@wolfssl.com> Mon, 07 Jul 2025 10:30:00 +0000

debian/control

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Source: wolfpkcs11
2+
Maintainer: wolfSSL <support@wolfssl.com>
3+
Section: libs
4+
Priority: optional
5+
Standards-Version: 4.6.2
6+
Build-Depends: debhelper-compat (= 13), libwolfssl-dev
7+
Vcs-Git: https://github.com/wolfSSL/wolfPKCS11.git
8+
Vcs-browser: https://github.com/wolfSSL/wolfPKCS11
9+
Homepage: https://www.wolfssl.com/
10+
11+
Package: libwolfpkcs11
12+
Architecture: any
13+
Section: libs
14+
Priority: optional
15+
Pre-Depends:
16+
Depends:
17+
${shlibs:Depends},
18+
${misc:Depends},
19+
libwolfssl
20+
Description: wolfPKCS11 cryptographic library
21+
PKCS#11 library that implements cryptographic algorithms using wolfSSL.
22+
This library provides a PKCS#11 interface for applications requiring
23+
cryptographic operations through hardware security modules (HSMs),
24+
Trusted Platform Modules (TPMs), or software-based tokens.
25+
26+
Package: libwolfpkcs11-dev
27+
Architecture: any
28+
Section: libdevel
29+
Priority: optional
30+
Pre-Depends:
31+
Depends:
32+
libwolfpkcs11 (= ${binary:Version}),
33+
libwolfssl-dev,
34+
${misc:Depends}
35+
Description: wolfPKCS11 cryptographic library development files
36+
PKCS#11 library that implements cryptographic algorithms using wolfSSL.
37+
This library provides a PKCS#11 interface for applications requiring
38+
cryptographic operations through hardware security modules (HSMs),
39+
Trusted Platform Modules (TPMs), or software-based tokens.
40+
.
41+
This package contains the development files.

debian/control.in

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Source: wolfpkcs11
2+
Maintainer: wolfSSL <support@wolfssl.com>
3+
Section: libs
4+
Priority: optional
5+
Standards-Version: 4.6.2
6+
Build-Depends: debhelper-compat (= 13), libwolfssl-dev
7+
Vcs-Git: https://github.com/wolfSSL/wolfPKCS11.git
8+
Vcs-browser: https://github.com/wolfSSL/wolfPKCS11
9+
Homepage: https://www.wolfssl.com/
10+
11+
Package: libwolfpkcs11
12+
Architecture: any
13+
Section: libs
14+
Priority: optional
15+
Pre-Depends:
16+
Depends:
17+
${shlibs:Depends},
18+
${misc:Depends},
19+
libwolfssl
20+
Description: wolfPKCS11 cryptographic library
21+
PKCS#11 library that implements cryptographic algorithms using wolfSSL.
22+
This library provides a PKCS#11 interface for applications requiring
23+
cryptographic operations through hardware security modules (HSMs),
24+
Trusted Platform Modules (TPMs), or software-based tokens.
25+
26+
Package: libwolfpkcs11-dev
27+
Architecture: any
28+
Section: libdevel
29+
Priority: optional
30+
Pre-Depends:
31+
Depends:
32+
libwolfpkcs11 (= ${binary:Version}),
33+
libwolfssl-dev,
34+
${misc:Depends}
35+
Description: wolfPKCS11 cryptographic library development files
36+
PKCS#11 library that implements cryptographic algorithms using wolfSSL.
37+
This library provides a PKCS#11 interface for applications requiring
38+
cryptographic operations through hardware security modules (HSMs),
39+
Trusted Platform Modules (TPMs), or software-based tokens.
40+
.
41+
This package contains the development files.

debian/copyright

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: wolfpkcs11
3+
Upstream-Contact: wolfSSL <support@wolfssl.com>
4+
Source: https://github.com/wolfSSL/wolfPKCS11/releases
5+
6+
Files:
7+
*
8+
Copyright:
9+
2014-2025 wolfSSL Inc.
10+
License: GPL-3+
11+
12+
License: GPL-3+
13+
This package is free software; you can redistribute it and/or modify
14+
it under the terms of the GNU General Public License as published by
15+
the Free Software Foundation; either version 3 of the License, or
16+
(at your option) any later version.
17+
.
18+
This package is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
.
23+
You should have received a copy of the GNU General Public License
24+
along with this program. If not, see <http://www.gnu.org/licenses/>
25+
.
26+
On Debian systems, the complete text of the GNU General
27+
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

debian/include.am

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# vim:ft=automake
2+
# included from Top Level Makefile.am
3+
# All paths should be given relative to the root
4+
5+
EXTRA_DIST+= debian/changelog
6+
EXTRA_DIST+= debian/control
7+
EXTRA_DIST+= debian/control.in
8+
EXTRA_DIST+= debian/copyright
9+
EXTRA_DIST+= debian/include.am
10+
11+
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
12+
13+
deb:
14+
# Setup meta folders
15+
mkdir -p debian/libwolfpkcs11/DEBIAN debian/libwolfpkcs11-dev/DEBIAN
16+
# "Install" wolfPKCS11
17+
make install exec_prefix=$(CURDIR)/debian/libwolfpkcs11/usr \
18+
prefix=$(CURDIR)/debian/libwolfpkcs11-dev/usr
19+
# deb shared lib stuff
20+
fakeroot dh_makeshlibs
21+
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
22+
dh_installdeb
23+
# Generate the lib and src descriptions
24+
fakeroot dh_gencontrol
25+
# Make adjustments to the package structure and to satisfy lintian checks
26+
# Correct doc dir name
27+
@rm -rf debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev
28+
@if [ -d debian/libwolfpkcs11-dev/usr/share/doc/wolfpkcs11 ]; then \
29+
mv debian/libwolfpkcs11-dev/usr/share/doc/wolfpkcs11 \
30+
debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev; \
31+
else \
32+
mkdir -p debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev; \
33+
fi
34+
# Clear lib folder
35+
@rm -rf debian/libwolfpkcs11-dev/usr/lib
36+
@mkdir -p debian/libwolfpkcs11-dev/usr/lib
37+
# Move the top level .so into the dev pkg
38+
@mv debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so debian/libwolfpkcs11-dev/usr/lib
39+
# Create correct pkg doc dir
40+
@rm -rf debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11
41+
@mkdir -p debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11
42+
# Place changelog
43+
@gzip -n -9 -c debian/changelog | \
44+
tee debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/changelog.gz > \
45+
debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/changelog.gz
46+
# Place copyright
47+
@cp debian/copyright debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11
48+
@cp debian/copyright debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev
49+
# Remove .la file https://wiki.debian.org/ReleaseGoals/LAFileRemoval
50+
@rm debian/libwolfpkcs11/usr/lib/libwolfpkcs11.la
51+
# Strip unwanted symbols
52+
# https://www.debian.org/doc/debian-policy/ch-files.html#binaries
53+
@strip --strip-unneeded debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so.*.*.*
54+
# Place pkgconfig so that it is available for cross-compilation
55+
# https://lintian.debian.org/tags/pkg-config-unavailable-for-cross-compilation
56+
@rm -rf debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH)
57+
@mkdir -p debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH)
58+
@if [ -d debian/libwolfpkcs11/usr/lib/pkgconfig ]; then \
59+
mv debian/libwolfpkcs11/usr/lib/pkgconfig \
60+
debian/libwolfpkcs11/usr/lib/$(DEB_HOST_MULTIARCH); \
61+
fi
62+
# Set the expected access rules
63+
@chmod 644 debian/libwolfpkcs11/usr/lib/libwolfpkcs11.so.*.*.*
64+
@chmod 644 debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/changelog.gz \
65+
debian/libwolfpkcs11/usr/share/doc/libwolfpkcs11/copyright \
66+
debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/changelog.gz \
67+
debian/libwolfpkcs11-dev/usr/share/doc/libwolfpkcs11-dev/copyright
68+
# Do this as the last step to mark all directories with the correct access bits
69+
@find debian/libwolfpkcs11*/usr -type d | xargs chmod 755
70+
# Generate debs
71+
dpkg-deb --root-owner-group -b debian/libwolfpkcs11 .
72+
dpkg-deb --root-owner-group -b debian/libwolfpkcs11-dev .
73+
# Check that everything is correct with lintian
74+
# - we don't provide a manual page for wolfpkcs11-config
75+
# - we don't care about matching the soname for our debs
76+
lintian *.deb --fail-on error,warning --tag-display-limit 0 \
77+
--suppress-tags no-manual-page,package-name-doesnt-match-sonames
78+
# Clean up the working dirs
79+
make deb-clean
80+
81+
deb-clean:
82+
rm -rf debian/libwolfpkcs11 debian/libwolfpkcs11-dev debian/files \
83+
debian/*.substvars debian/.debhelper

0 commit comments

Comments
 (0)