systemd/0615-tpm2-fix-build-failure...

47 lines
1.4 KiB
Diff

From f7b06cb36e436583979e7f4a1966297239ea1caa Mon Sep 17 00:00:00 2001
From: Dan Streetman <ddstreet@ieee.org>
Date: Fri, 20 Jan 2023 12:42:52 -0500
Subject: [PATCH] tpm2: fix build failure without openssl
(cherry picked from commit 0d7009d35df2fef494b1df67f5caa55e85dd8970)
Related: RHEL-16182
---
src/shared/tpm2-util.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
index 85ef4157ac..df1f7b8340 100644
--- a/src/shared/tpm2-util.c
+++ b/src/shared/tpm2-util.c
@@ -2621,6 +2621,7 @@ int tpm2_get_good_pcr_banks_strv(
uint32_t pcr_mask,
char ***ret) {
+#if HAVE_OPENSSL
_cleanup_free_ TPMI_ALG_HASH *algs = NULL;
_cleanup_strv_free_ char **l = NULL;
int n_algs;
@@ -2657,6 +2658,9 @@ int tpm2_get_good_pcr_banks_strv(
*ret = TAKE_PTR(l);
return 0;
+#else /* HAVE_OPENSSL */
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL support is disabled.");
+#endif
}
/* Hash data into the digest.
@@ -4410,9 +4414,8 @@ int tpm2_extend_bytes(
sym_Tss2_RC_Decode(rc));
return 0;
-#else
- return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "OpenSSL not supported on this build.");
+#else /* HAVE_OPENSSL */
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL support is disabled.");
#endif
}
#endif