libtpms: fix build with glibc 2.43

Backport patch stable-0.10 branch (not tagged yet).

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
This commit is contained in:
Peter Marko
2026-03-14 14:12:25 +01:00
committed by Scott Murray
parent 8028c573db
commit 62a62bc7c0
2 changed files with 37 additions and 1 deletions
@@ -0,0 +1,34 @@
From a20f8b6a22f1ae60d96ae7e554f5e13dd431471b Mon Sep 17 00:00:00 2001
From: Stefan Berger <stefanb@linux.ibm.com>
Date: Fri, 2 Jan 2026 11:37:31 -0500
Subject: [PATCH] Fix a compilation error in TPMLIB_GetPlaintext
Fix a compilation error that newer gcc versions may complain about:
tpm_library.c: In function 'TPMLIB_GetPlaintext':
tpm_library.c:441:11: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
441 | start = strstr(stream, starttag);
| ^
At top level:
cc1: note: unrecognized command-line option '-Wno-self-assign' may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
Upstream-Status: Backport [https://github.com/stefanberger/libtpms/commit/a20f8b6a22f1ae60d96ae7e554f5e13dd431471b]
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
src/tpm_library.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tpm_library.c b/src/tpm_library.c
index f48f4fd3..7b2ea687 100644
--- a/src/tpm_library.c
+++ b/src/tpm_library.c
@@ -435,7 +435,7 @@ static unsigned char *TPMLIB_GetPlaintext(const char *stream,
const char *endtag,
size_t *length)
{
- char *start, *end;
+ const char *start, *end;
unsigned char *plaintext = NULL;
start = strstr(stream, starttag);
@@ -3,7 +3,9 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e73f0786a936da3814896df06ad225a9"
SRCREV = "17f253a767f6b5b7813ae33f12bc79c479576cdc"
SRC_URI = "git://github.com/stefanberger/libtpms.git;branch=stable-0.10;protocol=https"
SRC_URI = "git://github.com/stefanberger/libtpms.git;branch=stable-0.10;protocol=https \
file://0001-Fix-a-compilation-error-in-TPMLIB_GetPlaintext.patch \
"
PE = "2"