libnettle/libnettle-Workaround-for-qemu-bug-affecting-the-ppc-intruction.patch
2024-02-20 14:17:56 +08:00

46 lines
1.4 KiB
Diff

From d618864183ccfdcd0d1b5443111fbaf9a5934517 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sun, 14 Aug 2022 20:53:10 +0200
Subject: [PATCH 0960/1000] Workaround for qemu bug affecting the ppc
intruction vmsumudm
Introduce overriding environment variable NETTLE_FAT_DISABLE_POWER9
that disables use of power9 code. This makes poly1305 tests under qemu
pass. See https://gitlab.com/qemu-project/qemu/-/issues/1156.
---
.gitlab-ci.yml | 4 ++--
fat-ppc.c | 5 +++++
fat-setup.h | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fat-ppc.c b/fat-ppc.c
index 7569e44d..b0412e5a 100644
--- a/fat-ppc.c
+++ b/fat-ppc.c
@@ -153,6 +153,11 @@ get_ppc_features (struct ppc_features *features)
== (PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_VSX));
#endif
}
+ /* NETTLE_FAT_DISABLE_POWER9 can be set to disable code that fails
+ in qemu, due to
+ https://gitlab.com/qemu-project/qemu/-/issues/1156. */
+ if (secure_getenv (ENV_DISABLE_POWER9))
+ features->have_power9 = 0;
}
DECLARE_FAT_FUNC(_nettle_aes_encrypt, aes_crypt_internal_func)
diff --git a/fat-setup.h b/fat-setup.h
index ad3c10f0..a35b8b8c 100644
--- a/fat-setup.h
+++ b/fat-setup.h
@@ -92,6 +92,7 @@
#define ENV_VERBOSE "NETTLE_FAT_VERBOSE"
#define ENV_OVERRIDE "NETTLE_FAT_OVERRIDE"
+#define ENV_DISABLE_POWER9 "NETTLE_FAT_DISABLE_POWER9"
struct chacha_ctx;
struct salsa20_ctx;
--
2.38.0