Skip to content
Open
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 conf/distro/cml-base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ INITRAMFS_MAXSIZE = '${@oe.utils.vartrue('DEVELOPMENT_BUILD', "350000", "75000",
# have it defined.
CI_CONSOLE_REDIRECT ??= "n"

# PKCS#11 backend in scd + softhsm2 module in the image. Only the dedicated CI
# 'pkcs11' buildtype sets this to "y". Weak default so builds that do not go
# through the local.conf template still have it defined.
GYROIDOS_PKCS11 ??= "n"

PACKAGECONFIG:remove:pn-gdb = "python"
1 change: 1 addition & 0 deletions conf/templates/default/local.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ GYROIDOS_BNSE = "##GYROIDOS_BNSE##"
GYROIDOS_A_B_UPDATE = "##GYROIDOS_A_B_UPDATE##"
GYROIDOS_SANITIZERS = "##GYROIDOS_SANITIZERS##"
GYROIDOS_PLAIN_DATAPART = "##GYROIDOS_PLAIN_DATAPART##"
GYROIDOS_PKCS11 = "##GYROIDOS_PKCS11##"

USER_CLASSES ?= "buildstats"

Expand Down
5 changes: 5 additions & 0 deletions images/gyroidos-cml-initramfs.bb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ PACKAGE_INSTALL = "\
pv \
"

# PKCS#11 module scd dlopens at runtime; shipped only in the 'pkcs11' image.
# oe.utils.conditional (not vartrue) so an unreplaced "##GYROIDOS_PKCS11##"
# placeholder degrades to the else-branch instead of failing every parse.
PACKAGE_INSTALL:append = '${@oe.utils.conditional('GYROIDOS_PKCS11', 'y', ' softhsm', '', d)}'

# Install additional packages for debugging purposes if DEVELOPMENT_BUILD is set
DEBUG_PACKAGES = "\
base-passwd \
Expand Down
23 changes: 23 additions & 0 deletions images/gyroidos-cml.bb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ prepare_device_conf () {
bbwarn "Setting for signed_configs already specified, leaving unchanged..."
fi
fi

if [ "y" = "${GYROIDOS_PKCS11}" ]; then
echo 'scd_env: "SOFTHSM2_CONF=/data/cml/tokens/softhsm2.conf"' >> ${WORKDIR}/device.conf
fi
}
#IMAGE_PREPROCESS_COMMAND:append = " prepare_device_conf;"

Expand All @@ -39,6 +43,25 @@ do_rootfs:prepend () {
do_sign_guestos
}

# PKCS#11 (softhsm2) runtime state on the data partition, 'pkcs11' image only.
# Ships just the module-dir symlink, the softhsm2 config and an empty tokendir:
# scd initializes its own token (label = container UUID) and wrapping key per
# container at first pairing, so no token or key is provisioned at build time.
# The symlink is mandatory — /data is mounted noexec, a module copied there
# would fail dlopen; the .so itself lives in the initramfs root.
install_pkcs11_data () {
if [ "y" = "${GYROIDOS_PKCS11}" ]; then
install -d ${IMAGE_ROOTFS}/userdata/cml/pkcs11
ln -sf /usr/lib/softhsm/libsofthsm2.so ${IMAGE_ROOTFS}/userdata/cml/pkcs11/libsofthsm2.so
install -d ${IMAGE_ROOTFS}/userdata/cml/tokens/softhsm
echo "directories.tokendir = /data/cml/tokens/softhsm" > ${IMAGE_ROOTFS}/userdata/cml/tokens/softhsm2.conf
fi
}

do_rootfs:append () {
install_pkcs11_data
}

GUESTS_OUT = "${B}/cml_updates"
CLEAN_GUEST_OUT = ""
OS_NAME = "kernel"
Expand Down
1 change: 1 addition & 0 deletions recipes-gyroidos/cmld/cmld_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DEPENDS = "protobuf-c-native protobuf-c protobuf-c-text e2fsprogs openssl ibmtss
EXTRA_OEMAKE = "GYROIDOS_HARDWARE=${GYROIDOS_HARDWARE}"
EXTRA_OEMAKE += "SCHSM=${GYROIDOS_SCHSM}"
EXTRA_OEMAKE += "BNSE=${GYROIDOS_BNSE}"
EXTRA_OEMAKE += "PKCS11=${GYROIDOS_PKCS11}"
EXTRA_OEMAKE += "A_B_UPDATE=${GYROIDOS_A_B_UPDATE}"
EXTRA_OEMAKE += "SANITIZERS=${GYROIDOS_SANITIZERS}"
EXTRA_OEMAKE += "DEVELOPMENT_BUILD=${DEVELOPMENT_BUILD}"
Expand Down