Skip to content

Add a patch to make wolfPKCS11 the default in NSS #258

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
merged 1 commit into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ test the PKCS11 layer to see which curves are supported.
NSS assumes that it is using a two-slot PKCS11 backend for non-FIPS by default.
This patch falls back to one slot if a second slot is not found.

### nss-default.patch

This makes wolfPCKS11 the default provider for NSS, even if it is not explicitly
specified.

## Compiling

### NSS
Expand Down
28 changes: 28 additions & 0 deletions nss/nss-default.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/lib/util/utilparst.h b/lib/util/utilparst.h
index 5dda09028..39e4f55c9 100644
--- a/lib/util/utilparst.h
+++ b/lib/util/utilparst.h
@@ -37,7 +37,7 @@

/* default module configuration strings */
#define NSSUTIL_DEFAULT_INTERNAL_INIT1 \
- "library= name=\"NSS Internal PKCS #11 Module\" parameters="
+ "library=libwolfpkcs11.so.3.1.0 name=wolfPKCS11 parameters="
#define NSSUTIL_DEFAULT_INTERNAL_INIT2 \
" NSS=\"Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={"
#define NSSUTIL_DEFAULT_INTERNAL_INIT3 \
diff --git a/tests/common/init.sh b/tests/common/init.sh
index cdf0a3c72..174a95bd0 100644
--- a/tests/common/init.sh
+++ b/tests/common/init.sh
@@ -342,8 +342,8 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
outdir="$2"
OUTFILE="${outdir}/pkcs11.txt"
cat > "$OUTFILE" << ++EOF++
-library=
-name=NSS Internal PKCS #11 Module
+library=libwolfpkcs11.so.3.1.0
+name=wolfPKCS11
parameters=configdir='./client' certPrefix='' keyPrefix='' secmod='secmod.db' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
NSS=Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
++EOF++