Skip to content

Commit b1c3277

Browse files
committed
update method for kernel signing to be handled by the makefile process
1 parent 56cfb58 commit b1c3277

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
# Sign libwolfssl.ko with the kernel's own signing key to prevent
2-
# "module verification failed: signature and/or required key missing" taint on load.
1+
# Use the linuxkm Makefile's native signing target to produce libwolfssl.ko.signed,
2+
# then install it in place of the unsigned libwolfssl.ko.
33

4-
do_install:append() {
5-
KO="${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/extra/libwolfssl.ko"
6-
SIGN_FILE="${STAGING_KERNEL_BUILDDIR}/scripts/sign-file"
7-
KEY="${STAGING_KERNEL_BUILDDIR}/certs/signing_key.pem"
8-
CERT="${STAGING_KERNEL_BUILDDIR}/certs/signing_key.x509"
4+
do_compile() {
5+
if [ "${WOLFSSL_FIPS_HASH_MODE_LINUXKM}" = "auto" ]; then
6+
bbnote "Auto FIPS hash mode: running 'make module-with-matching-fips-hash'"
7+
bbnote "This will build the .ko, compute the FIPS hash, patch it in-place, and sign it."
8+
unset LDFLAGS
9+
unset CPPFLAGS
10+
oe_runmake module-with-matching-fips-hash HOSTCC=$(which ${BUILD_CC})
11+
else
12+
oe_runmake
13+
fi
14+
}
915

10-
if [ -x "${SIGN_FILE}" ] && [ -f "${KEY}" ] && [ -f "${CERT}" ]; then
11-
bbnote "Signing libwolfssl.ko with kernel signing key"
12-
"${SIGN_FILE}" sha256 "${KEY}" "${CERT}" "${KO}"
16+
do_install() {
17+
install -d ${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/extra
18+
KO_SIGNED="${S}/linuxkm/libwolfssl.ko.signed"
19+
KO_UNSIGNED="${S}/linuxkm/libwolfssl.ko"
20+
if [ -f "${KO_SIGNED}" ]; then
21+
bbnote "Installing libwolfssl.ko.signed (signed by linuxkm Makefile)"
22+
install -m 0644 "${KO_SIGNED}" \
23+
${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/extra/libwolfssl.ko
1324
else
14-
bbwarn "Kernel signing key not found - libwolfssl.ko will taint the kernel on load"
25+
bbwarn "libwolfssl.ko.signed not found - installing unsigned libwolfssl.ko"
26+
install -m 0644 "${KO_UNSIGNED}" \
27+
${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/extra/
1528
fi
1629
}

0 commit comments

Comments
 (0)