Skip to contentSkip to conversation

Add support for pkcs11 to host-gnutls

PATCH In review Vincent Stehlé 2 participants 4 messages Jun 5 – Jul 10

lore
Share & tools
lore
#0 lore raw

cover Add support for pkcs11 to host-gnutls

Future U-Boot 2026.07 will build mkeficapsule with pkcs11 support. [1]

This causes link errors with Buildroot, such as the following one:

mkeficapsule.c:(.text.startup+0xcd3): undefined reference to `gnutls_pkcs11_init'

(Other symbols the linker complains about are: gnutls_pkcs11_add_provider, gnutls_pkcs11_obj_list_import_url4, gnutls_x509_crt_import_pkcs11 and gnutls_pkcs11_deinit.)

The following example commands can be used to reproduce the issue:

make qemu_aarch64_ebbr_defconfig
echo 'BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2026.07-rc3"' >>.config echo 'BR2_TARGET_UBOOT_NEEDS_GNUTLS=y' >>.config
echo '# BR2_DOWNLOAD_FORCE_CHECK_HASHES is not set' >>.config make olddefconfig
make uboot

This series does the following changes to solve this issue:
1. Enable host compilation for p11-kit
2. Build host-gnutls with pkcs11 support, leveraging the new host-p11-kit.

For the sake of simplicity, pkcs11 support is added unconditionally to host-gnutls. If this is preferred, a config option could be added instead.

---
Vincent Stehlé (2):
package/p11-kit: enable host build
package/gnutls: add host support for pkcs11

 package/gnutls/gnutls.mk   | 5 +++--
 package/p11-kit/p11-kit.mk | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

---
base-commit: 32351f979822a0b3a45b82c2d82bdb2328b02f5a
change-id: 20260603-p11-53a6f87c7d2e

Best regards,

Signature · 6 lines
Vincent.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/2 package/p11-kit: enable host build

Enable to build p11-kit on the host.
This is to support enabling pkcs11 in host-gnutls.

Cc Thomas Petazzoni <[email protected]>
---
 package/p11-kit/p11-kit.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/p11-kit/p11-kit.mk +9 -0
index 68b1894183..4f4b76d543 100644
@@ -44,4 +44,13 @@ P11_KIT_CONF_OPTS += \
 	--without-libtasn1
 endif
 
+HOST_P11_KIT_DEPENDENCIES = host-pkgconf
+
+HOST_P11_KIT_CONF_OPTS = \
+	--without-libffi \
+	--without-trust-paths \
+	--disable-trust-module \
+	--without-libtasn1
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 2/2 package/gnutls: add host support for pkcs11

In reply to Vincent Stehlé

Future U-Boot 2026.07 will build mkeficapsule with pkcs11 support. [1]

This causes link errors with Buildroot, such as the following one:

mkeficapsule.c:(.text.startup+0xcd3): undefined reference to `gnutls_pkcs11_init'

(Other symbols the linker complains about are: gnutls_pkcs11_add_provider, gnutls_pkcs11_obj_list_import_url4, gnutls_x509_crt_import_pkcs11 and gnutls_pkcs11_deinit.)

The following example commands can be used to reproduce the issue:

make qemu_aarch64_ebbr_defconfig
echo 'BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2026.07-rc3"' >>.config echo 'BR2_TARGET_UBOOT_NEEDS_GNUTLS=y' >>.config
echo '# BR2_DOWNLOAD_FORCE_CHECK_HASHES is not set' >>.config make olddefconfig
make uboot

This commit adds the pkcs11 support for host-gnutls.

In Buildroot, since host-gnutls is currently only needed by uboot (and other uboot derivatives such as uboot-tools) the pkcs11 support is added unconditionally to host-gnutls.

---
 package/gnutls/gnutls.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/gnutls/gnutls.mk +3 -2
index 6411a7d621..ae1caaa221 100644
@@ -43,7 +43,8 @@ GNUTLS_CONF_ENV = gl_cv_socket_ipv6=yes \
 	gl_cv_func_gettimeofday_clobber=no
 GNUTLS_INSTALL_STAGING = YES
 
-HOST_GNUTLS_DEPENDENCIES = host-pkgconf host-libtasn1 host-libunistring host-nettle
+HOST_GNUTLS_DEPENDENCIES = host-pkgconf host-libtasn1 host-libunistring \
+	host-nettle host-p11-kit
 HOST_GNUTLS_CONF_OPTS = \
 	--disable-doc \
 	--disable-libdane \
@@ -64,7 +65,7 @@ HOST_GNUTLS_CONF_OPTS = \
 	--disable-openssl-compatibility \
 	--without-brotli \
 	--without-idn \
-	--without-p11-kit \
+	--with-p11-kit \
 	--without-zlib \
 	--without-zstd
 
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Vincent Stehlé

Am 05.06.26 um 11:43 schrieb Vincent Stehlé:

Quoted 23 lines

Future U-Boot 2026.07 will build mkeficapsule with pkcs11 support. [1]

This causes link errors with Buildroot, such as the following one:

   mkeficapsule.c:(.text.startup+0xcd3): undefined reference to `gnutls_pkcs11_init'

(Other symbols the linker complains about are: gnutls_pkcs11_add_provider, gnutls_pkcs11_obj_list_import_url4, gnutls_x509_crt_import_pkcs11 and gnutls_pkcs11_deinit.)

The following example commands can be used to reproduce the issue:

make qemu_aarch64_ebbr_defconfig
echo 'BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2026.07-rc3"' >>.config echo 'BR2_TARGET_UBOOT_NEEDS_GNUTLS=y' >>.config
echo '# BR2_DOWNLOAD_FORCE_CHECK_HASHES is not set' >>.config make olddefconfig
make uboot

This series does the following changes to solve this issue:
1. Enable host compilation for p11-kit
2. Build host-gnutls with pkcs11 support, leveraging the new host-p11-kit.

Quoted 5 lines

For the sake of simplicity, pkcs11 support is added unconditionally to host-gnutls. If this is preferred, a config option could be added instead.

Series applied to master, thank you!

Quoted 5 lines

---
Vincent Stehlé (2):
package/p11-kit: enable host build package/gnutls: add host support for pkcs11

Quoted 8 lines
  package/gnutls/gnutls.mk   | 5 +++--
  package/p11-kit/p11-kit.mk | 9 +++++++++
  2 files changed, 12 insertions(+), 2 deletions(-)

---
base-commit: 32351f979822a0b3a45b82c2d82bdb2328b02f5a
change-id: 20260603-p11-53a6f87c7d2e

Best regards,

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot