https://github.com/openssl/openssl/issues/29845
https://github.com/openssl/openssl/commit/b02b04fbad809c82efbf1e3274e6a22caf997b8d

From b02b04fbad809c82efbf1e3274e6a22caf997b8d Mon Sep 17 00:00:00 2001
From: Neil Horman <nhorman@openssl.org>
Date: Mon, 9 Feb 2026 12:55:50 -0500
Subject: [PATCH] don't use asm accelerated path on big endian power9

https://github.com/openssl/openssl/issues/29845

Found that our hardware accelerated path doesn't work on big endian
systems, so make sure that we only use it when little endian is defined

We also noted that PPC_AES_GCM_CAPABLE gets defined to zero when the
capabilities register notes that the hardware isn't capable of the
needed instructions, but that still includes the asm path as
PPC_AES_GCM_CAPABLE is still defined.

Fix both issues

Fixes #29845

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Tue Feb 17 14:11:46 2026
(Merged from https://github.com/openssl/openssl/pull/29968)
---
 include/crypto/aes_platform.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/crypto/aes_platform.h b/include/crypto/aes_platform.h
index 496b08f46d5ce..95d13d22e191b 100644
--- a/include/crypto/aes_platform.h
+++ b/include/crypto/aes_platform.h
@@ -77,7 +77,9 @@ void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
 #define HWAES_xts_decrypt aes_p8_xts_decrypt
 #endif /* OPENSSL_SYS_MACOSX */
 #if !defined(OPENSSL_SYS_AIX) && !defined(OPENSSL_SYS_MACOSX)
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define PPC_AES_GCM_CAPABLE (OPENSSL_ppccap_P & PPC_MADD300)
+#endif
 #define AES_GCM_ENC_BYTES 128
 #define AES_GCM_DEC_BYTES 128
 size_t ppc_aes_gcm_encrypt(const unsigned char *in, unsigned char *out,

