Merge pull request #113 from julek-wolfssl/wolfpkcs11

Add wolfpkcs11 recipe
pull/114/head
Daniel Pouzzner 2025-11-08 09:37:20 -06:00 committed by GitHub
commit 9ecf52d761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 122 additions and 4 deletions

View File

@ -14,6 +14,7 @@ This layer currently provides recipes for the following wolfSSL products:
- [wolfTPM portable TPM 2.0 library](https://www.wolfssl.com/products/wolftpm/)
- [wolfSSL-py A Python wrapper for the wolfSSL library](https://github.com/wolfSSL/wolfssl-py)
- [wolfCrypt-py A Python Wrapper for the wolfCrypt API](https://github.com/wolfSSL/wolfcrypt-py)
- [wolfPKCS11 A PKCS#11 implementation using wolfSSL](https://github.com/wolfSSL/wolfpkcs11)
These recipes have been tested using these versions of yocto:
@ -77,13 +78,13 @@ After installing your build's Yocto/OpenEmbedded components:
`path/to/poky/build/conf`.
- For Dunfell and newer versions of Yocto:
```
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm "
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm wolfpkcs11 "
```
- For versions of Yocto older than Dunfell:
```
IMAGE_INSTALL_append = " wolfssl wolfssh wolfmqtt wolftpm "
IMAGE_INSTALL_append = " wolfssl wolfssh wolfmqtt wolftpm wolfpkcs11 "
```
```
@ -92,6 +93,7 @@ After installing your build's Yocto/OpenEmbedded components:
$ bitbake wolfmqtt
$ bitbake wolftpm
$ bitbake wolfclu - This command would result in an error
$ bitbake wolfpkcs11
```
@ -101,12 +103,12 @@ After installing your build's Yocto/OpenEmbedded components:
- For Dunfell and newer versions of Yocto
```
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu "
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu wolfpkcs11 "
```
- For versions of Yocto older than Dunfell
```
IMAGE_INSTALL_append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu "
IMAGE_INSTALL_append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu wolfpkcs11 "
```
This will add the necassary --enable-* options necassary to use your
@ -411,6 +413,23 @@ wolfEngine
------------
To build wolfEngine view the instructions in this [README](recipes-wolfssl/wolfengine/README.md)
wolfPKCS11
-----------
wolfPKCS11 is a PKCS#11 implementation provided by wolfSSL for cryptographic token interface support. This layer includes support for building wolfPKCS11 as a Yocto/OpenEmbedded recipe.
To include wolfPKCS11 in your image, add it to your IMAGE_INSTALL variable in your `local.conf`:
- For Dunfell and newer versions of Yocto:
```
IMAGE_INSTALL:append = " wolfpkcs11 "
```
- For versions of Yocto older than Dunfell:
```
IMAGE_INSTALL_append = " wolfpkcs11 "
```
After building, the wolfPKCS11 library and tools will be available in the standard locations (e.g., `/usr/lib`, `/usr/bin`). For more details on configuration and usage, see the wolfPKCS11 README.
FIPS-READY
----------
For building FIPS-Ready for wolfSSL view the instruction in this [README](recipes-wolfssl/wolfssl/fips-ready/README.md)

View File

@ -35,6 +35,11 @@ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'${LAYERDIR}/recipes-wolfssl/wolfmqtt/*.bb ${LAYERDIR}/recipes-wolfssl/wolfmqtt/*.bbappend', \
'', d)}"
BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'wolfpkcs11', \
'${LAYERDIR}/recipes-wolfssl/wolfpkcs11/*.bb ${LAYERDIR}/recipes-wolfssl/wolfpkcs11/*.bbappend', \
'', d)}"
BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'wolftpm', \
'${LAYERDIR}/recipes-wolfssl/wolftpm/*.bb ${LAYERDIR}/recipes-wolfssl/wolftpm/*.bbappend', \

View File

@ -0,0 +1,14 @@
#Adjust these as needed
WOLFPKCS11_VERSION ?= ""
WOLF_LICENSE=""
WOLF_LICENSE_MD5=""
WOLFPKCS11_SRC ?= ""
WOLFPKCS11_SRC_SHA ?= ""
WOLFPKCS11_SRC_PASS ?= ""
#Do not adjust these variables
PR = "commercial"
PV = "${WOLFPKCS11_VERSION}"
BBFILE_PRIORITY='1'

View File

@ -0,0 +1,12 @@
# Directory for Commerical wolfSSH 7Zip Archives
## Overview
This directory is designated for storing commercially licensed 7Zip archives of wolfPKCS11.
## Contact Information
For questions regarding obtaining a licensed version of wolfPKCS11,
please contact wolfSSL Inc. directly at:
Email: support@wolfssl.com

View File

@ -0,0 +1,30 @@
BBFILE_PRIORITY='2'
COMMERCIAL_CONFIG_DIR := "${@os.path.dirname(d.getVar('FILE', True))}"
LICENSE="Proprietary"
LIC_FILES_CHKSUM="file://${WOLF_LICENSE};md5=${WOLF_LICENSE_MD5}"
SRC_URI="file://${COMMERCIAL_CONFIG_DIR}/files/${WOLFPKCS11_SRC}.7z"
SRC_URI[sha256sum]="${WOLFPKCS11_SRC_SHA}"
DEPENDS += "p7zip-native"
S = "${WORKDIR}/${WOLFPKCS11_SRC}"
do_unpack[depends] += "p7zip-native:do_populate_sysroot"
do_unpack() {
cp -f "${COMMERCIAL_CONFIG_DIR}/files/${WOLFPKCS11_SRC}.7z" "${WORKDIR}"
7za x "${WORKDIR}/${WOLFPKCS11_SRC}.7z" -p"${WOLFPKCS11_SRC_PASS}" -o"${WORKDIR}" -aoa
}
python() {
distro_version = d.getVar('DISTRO_VERSION', True)
autogen_create = 'echo -e "#!/bin/sh\nexit 0" > ${S}/autogen.sh && chmod +x ${S}/autogen.sh'
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
# For Dunfell and earlier
d.appendVar('do_configure_prepend', autogen_create)
else:
# For Kirkstone and later
d.appendVar('do_configure:prepend', autogen_create)
}

View File

@ -0,0 +1,36 @@
SUMMARY = "wolfPKCS11 PKCS#11 Library"
DESCRIPTION = "wolfPKCS11 is a PKCS#11 library that implements cryptographic algorithms using wolfCrypt."
HOMEPAGE = "https://www.wolfssl.com/products/wolfpkcs11"
BUGTRACKER = "https://github.com/wolfSSL/wolfPKCS11/issues"
SECTION = "libs"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://gpl-3.0.txt;md5=d32239bcb673463ab874e80d47fae504"
DEPENDS += "wolfssl"
SRC_URI = "git://github.com/wolfSSL/wolfPKCS11.git;nobranch=1;protocol=https;rev=6b76537e4cc5bea0358b7059fda26d1872584be4"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
export CFLAGS += ' -I${COMPONENTS_DIR}/${PACKAGE_ARCH}/wolfssl/usr/include -L${COMPONENTS_DIR}/${PACKAGE_ARCH}/wolfssl/usr/lib'
python() {
distro_version = d.getVar('DISTRO_VERSION', True)
autogen_command = 'cd ${S}; ./autogen.sh'
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
# For Dunfell and earlier
d.appendVar('do_configure_prepend', autogen_command)
else:
# For Kirkstone and later
d.appendVar('do_configure:prepend', autogen_command)
}
# Add reproducible build flags
export CFLAGS += ' -g0 -O2 -ffile-prefix-map=${WORKDIR}=.'
export CXXFLAGS += ' -g0 -O2 -ffile-prefix-map=${WORKDIR}=.'
export LDFLAGS += ' -Wl,--build-id=none'
# Ensure consistent locale
export LC_ALL = "C"

View File

@ -0,0 +1,2 @@
EXTRA_OECONF += "--enable-aescfb --enable-rsapss --enable-keygen --enable-pwdbased --enable-scrypt"
TARGET_CFLAGS += "-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT -DHAVE_AES_ECB -DHAVE_AES_KEYWRAP"