[PATCH] build: Fix 'make check' with HMAC check

Clemens Lang cllang at redhat.com
Thu Feb 10 17:46:57 CET 2022


* src/Makefile.am: Generate HMAC from a copy of libgcrypt.so with
  rodata1 set to zero. This fixes test execution after configuring with
  --enable-hmac-binary-check with LIBGCRYPT_FORCE_FIPS_MODE=1 in the
  environment.

--

Signed-off-by: Clemens Lang <cllang at redhat.com>
---
 src/Makefile.am | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 018d5761..b0a196a3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -149,7 +149,11 @@ libgcrypt.la.done: libgcrypt.so.hmac
 	@touch libgcrypt.la.done
 
 libgcrypt.so.hmac: hmac256 libgcrypt.la
-	./hmac256 --stdkey --binary  < .libs/libgcrypt.so > $@
+	dd if=/dev/zero of=libgcrypt.so.hmac.empty bs=32 count=1
+	$(OBJCOPY) --update-section .rodata1=libgcrypt.so.hmac.empty \
+	  .libs/libgcrypt.so .libs/libgcrypt.so.empty-hmac
+	./hmac256 --stdkey --binary .libs/libgcrypt.so.empty-hmac > $@
+	$(RM) libgcrypt.so.hmac.empty .libs/libgcrypt.so.empty-hmac
 else !USE_HMAC_BINARY_CHECK
 libgcrypt.la.done: libgcrypt.la
 	@touch libgcrypt.la.done
-- 
2.34.1




More information about the Gcrypt-devel mailing list