Fix bsaes-armv7.pl getting disabled by accident.
https://boringssl-review.googlesource.com/c/34188 accidentally disabled
it (__ARM_MAX_ARCH__ wasn't defined), which, in turn, masked a bug in
https://boringssl-review.googlesource.com/c/34874.
Remove the __ARM_MAX_ARCH__ check as that's hardcoded to 8 anyway. Then
revert the problematic part of the bsaes-armv7.pl change. That brings
back the somewhat questionable post-dispatch to pre-dispatch call, but I
hope to patch the fallbacks out soon anyway.
Change-Id: I567e55fe35cb716d5ed56580113a302617f5ad71
Reviewed-on: https://boringssl-review.googlesource.com/c/35044
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/aes/asm/bsaes-armv7.pl b/crypto/fipsmodule/aes/asm/bsaes-armv7.pl
index 9df81c1..11607d1 100644
--- a/crypto/fipsmodule/aes/asm/bsaes-armv7.pl
+++ b/crypto/fipsmodule/aes/asm/bsaes-armv7.pl
@@ -1113,7 +1113,10 @@
my ($keysched)=("sp");
$code.=<<___;
-.extern aes_nohw_cbc_encrypt
+@ TODO(davidben): This should be aes_nohw_cbc_encrypt, but that function does
+@ not exist. Rather than add it, patch this fallback out. See
+@ https://crbug.com/boringssl/256.
+.extern AES_cbc_encrypt
.extern aes_nohw_decrypt
.global bsaes_cbc_encrypt
@@ -1123,10 +1126,10 @@
#ifndef __KERNEL__
cmp $len, #128
#ifndef __thumb__
- blo aes_nohw_cbc_encrypt
+ blo AES_cbc_encrypt
#else
bhs 1f
- b aes_nohw_cbc_encrypt
+ b AES_cbc_encrypt
1:
#endif
#endif
diff --git a/crypto/fipsmodule/aes/internal.h b/crypto/fipsmodule/aes/internal.h
index a91ea70..0df30d9 100644
--- a/crypto/fipsmodule/aes/internal.h
+++ b/crypto/fipsmodule/aes/internal.h
@@ -49,7 +49,7 @@
OPENSSL_INLINE int hwaes_capable(void) { return CRYPTO_is_ARMv8_AES_capable(); }
-#if defined(OPENSSL_ARM) && __ARM_MAX_ARCH__ >= 7
+#if defined(OPENSSL_ARM)
#define BSAES
OPENSSL_INLINE char bsaes_capable(void) { return CRYPTO_is_NEON_capable(); }
#endif
diff --git a/crypto/fipsmodule/cipher/e_aes.c b/crypto/fipsmodule/cipher/e_aes.c
index 69bf435..460deed 100644
--- a/crypto/fipsmodule/cipher/e_aes.c
+++ b/crypto/fipsmodule/cipher/e_aes.c
@@ -64,10 +64,6 @@
#include "../modes/internal.h"
#include "../delocate.h"
-#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
-#include <openssl/arm_arch.h>
-#endif
-
OPENSSL_MSVC_PRAGMA(warning(push))
OPENSSL_MSVC_PRAGMA(warning(disable: 4702)) // Unreachable code.