diff mbox series

tpm2-tools: Fix build

Message ID d3ed7d76f36436b8d5edd4b8b328205e809b63e9.1793706170.git.marcel.ziswiler@codethink.co.uk
State New
Headers show
Series tpm2-tools: Fix build | expand

Commit Message

Marcel Ziswiler Nov. 3, 2026, 3:18 p.m. UTC
Fix the following build errors:

../sources/tpm2-tools-5.8/lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
../sources/tpm2-tools-5.8/lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
      | ^~~~~~~~~~~~~~~~~~~~~~
../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
      | ^~~~~~~~~~~~~~~~~~~~~~
../sources/tpm2-tools-5.8/lib/object.c:28:1: note: each undeclared identifier is reported only once for each function it appears in
../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
      | ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
---
 ...1-lib-object.h-include-openssl-err.h.patch | 39 +++++++++++++++++++
 .../recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb |  4 +-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch

Comments

Yoann Congal Nov. 3, 2026, 3:26 p.m. UTC | #1
Hello,

I think this lacks a [meta-security] in the subject line.

Regards,

On Tue Nov 3, 2026 at 4:18 PM CET, Marcel Ziswiler via yocto-patches wrote:
> Fix the following build errors:
>
> ../sources/tpm2-tools-5.8/lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: note: each undeclared identifier is reported only once for each function it appears in
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
> ---
>  ...1-lib-object.h-include-openssl-err.h.patch | 39 +++++++++++++++++++
>  .../recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb |  4 +-
>  2 files changed, 42 insertions(+), 1 deletion(-)
>  create mode 100644 meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
>
> diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
> new file mode 100644
> index 000000000000..6325c98073f4
> --- /dev/null
> +++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
> @@ -0,0 +1,39 @@
> +From c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067 Mon Sep 17 00:00:00 2001
> +From: Bernd Kuhls <bernd@kuhls.net>
> +Date: Sat, 12 Sep 2026 13:22:13 +0200
> +Subject: [PATCH] lib/object.h: include openssl/err.h
> +
> +Fixes build error with OpenSSL 4.1.0-alpha1:
> +
> +lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
> +lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> +Upstream-Status: Backport [https://github.com/tpm2-software/tpm2-tools/commit/c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067]
> +Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
> +---
> + lib/object.h | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/lib/object.h b/lib/object.h
> +index b48b55b3b06c..2c4102fcc9dd 100644
> +--- a/lib/object.h
> ++++ b/lib/object.h
> +@@ -6,6 +6,7 @@
> + #include "tpm2_util.h"
> + 
> + #include <openssl/pem.h>
> ++#include <openssl/err.h>
> + #include <openssl/bio.h>
> + #include <openssl/asn1.h>
> + #include <openssl/asn1t.h>
> +-- 
> +2.56.0
> +
> diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> index 4edd283a739a..a87c2d0d7fa4 100644
> --- a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> +++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> @@ -7,7 +7,9 @@ SECTION = "tpm"
>  
>  DEPENDS = "tpm2-tss openssl curl autoconf-archive-native"
>  
> -SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz"
> +SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \
> +           file://0001-lib-object.h-include-openssl-err.h.patch \
> +           "
>  
>  SRC_URI[sha256sum] = "1cb73185cae814b4e15c7c2d0b22642d640faf48775f4156a1fd92edf84bef73"
>
Marcel Ziswiler Nov. 3, 2026, 5:27 p.m. UTC | #2
On Tue, 2026-11-03 at 16:26 +0100, Yoann Congal wrote:
> Hello,
> 
> I think this lacks a [meta-security] in the subject line.

Yeah, indeed, thanks!

I resent it with that in place now : )

[snip]
Scott Murray Nov. 4, 2026, 4:57 p.m. UTC | #3
I have merged this to master.

Thanks,

Scott


On Tue, 3 Nov 2026, Marcel Ziswiler wrote:

> Fix the following build errors:
>
> ../sources/tpm2-tools-5.8/lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: note: each undeclared identifier is reported only once for each function it appears in
> ../sources/tpm2-tools-5.8/lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
>    28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
>       | ^~~~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
> ---
>  ...1-lib-object.h-include-openssl-err.h.patch | 39 +++++++++++++++++++
>  .../recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb |  4 +-
>  2 files changed, 42 insertions(+), 1 deletion(-)
>  create mode 100644 meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
>
> diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
> new file mode 100644
> index 000000000000..6325c98073f4
> --- /dev/null
> +++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
> @@ -0,0 +1,39 @@
> +From c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067 Mon Sep 17 00:00:00 2001
> +From: Bernd Kuhls <bernd@kuhls.net>
> +Date: Sat, 12 Sep 2026 13:22:13 +0200
> +Subject: [PATCH] lib/object.h: include openssl/err.h
> +
> +Fixes build error with OpenSSL 4.1.0-alpha1:
> +
> +lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
> +lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
> +   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
> +
> +Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> +Upstream-Status: Backport [https://github.com/tpm2-software/tpm2-tools/commit/c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067]
> +Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
> +---
> + lib/object.h | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/lib/object.h b/lib/object.h
> +index b48b55b3b06c..2c4102fcc9dd 100644
> +--- a/lib/object.h
> ++++ b/lib/object.h
> +@@ -6,6 +6,7 @@
> + #include "tpm2_util.h"
> +
> + #include <openssl/pem.h>
> ++#include <openssl/err.h>
> + #include <openssl/bio.h>
> + #include <openssl/asn1.h>
> + #include <openssl/asn1t.h>
> +--
> +2.56.0
> +
> diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> index 4edd283a739a..a87c2d0d7fa4 100644
> --- a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> +++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
> @@ -7,7 +7,9 @@ SECTION = "tpm"
>
>  DEPENDS = "tpm2-tss openssl curl autoconf-archive-native"
>
> -SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz"
> +SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \
> +           file://0001-lib-object.h-include-openssl-err.h.patch \
> +           "
>
>  SRC_URI[sha256sum] = "1cb73185cae814b4e15c7c2d0b22642d640faf48775f4156a1fd92edf84bef73"
>
>
diff mbox series

Patch

diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
new file mode 100644
index 000000000000..6325c98073f4
--- /dev/null
+++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools/0001-lib-object.h-include-openssl-err.h.patch
@@ -0,0 +1,39 @@ 
+From c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd@kuhls.net>
+Date: Sat, 12 Sep 2026 13:22:13 +0200
+Subject: [PATCH] lib/object.h: include openssl/err.h
+
+Fixes build error with OpenSSL 4.1.0-alpha1:
+
+lib/object.c: In function 'PEM_read_bio_TSSPRIVKEY_OBJ':
+lib/object.c:28:1: error: implicit declaration of function 'ERR_raise' [-Wimplicit-function-declaration]
+   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
+
+lib/object.c:28:1: error: 'ERR_LIB_PEM' undeclared (first use in this function)
+   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
+
+lib/object.c:28:1: error: 'ERR_R_ASN1_LIB' undeclared (first use in this function)
+   28 | IMPLEMENT_PEM_read_bio(TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ, TSSPRIVKEY_OBJ_PEM_STRING,
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+Upstream-Status: Backport [https://github.com/tpm2-software/tpm2-tools/commit/c2b2c4e5cdc5bbc61779eb4271d5c317efb8c067]
+Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
+---
+ lib/object.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/object.h b/lib/object.h
+index b48b55b3b06c..2c4102fcc9dd 100644
+--- a/lib/object.h
++++ b/lib/object.h
+@@ -6,6 +6,7 @@
+ #include "tpm2_util.h"
+ 
+ #include <openssl/pem.h>
++#include <openssl/err.h>
+ #include <openssl/bio.h>
+ #include <openssl/asn1.h>
+ #include <openssl/asn1t.h>
+-- 
+2.56.0
+
diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
index 4edd283a739a..a87c2d0d7fa4 100644
--- a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
+++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.8.bb
@@ -7,7 +7,9 @@  SECTION = "tpm"
 
 DEPENDS = "tpm2-tss openssl curl autoconf-archive-native"
 
-SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz"
+SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \
+           file://0001-lib-object.h-include-openssl-err.h.patch \
+           "
 
 SRC_URI[sha256sum] = "1cb73185cae814b4e15c7c2d0b22642d640faf48775f4156a1fd92edf84bef73"