From f1f73f8966d57516fdb9cb91adbfdba0f5837495 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 26 Feb 2019 19:44:57 -0600 Subject: [PATCH] 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 Commit-Queue: Adam Langley Reviewed-by: Adam Langley --- crypto/fipsmodule/aes/asm/bsaes-armv7.pl | 9 ++++++--- crypto/fipsmodule/aes/internal.h | 2 +- crypto/fipsmodule/cipher/e_aes.c | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crypto/fipsmodule/aes/asm/bsaes-armv7.pl b/crypto/fipsmodule/aes/asm/bsaes-armv7.pl index 9df81c166..11607d117 100644 --- a/crypto/fipsmodule/aes/asm/bsaes-armv7.pl +++ b/crypto/fipsmodule/aes/asm/bsaes-armv7.pl @@ -1113,7 +1113,10 @@ my ($inp,$out,$len,$key, $ivp,$fp,$rounds)=map("r$_",(0..3,8..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 @@ bsaes_cbc_encrypt: #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 a91ea708e..0df30d9f3 100644 --- a/crypto/fipsmodule/aes/internal.h +++ b/crypto/fipsmodule/aes/internal.h @@ -49,7 +49,7 @@ OPENSSL_INLINE char bsaes_capable(void) { return vpaes_capable(); } 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 69bf4353a..460deedd1 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 -#endif - OPENSSL_MSVC_PRAGMA(warning(push)) OPENSSL_MSVC_PRAGMA(warning(disable: 4702)) // Unreachable code.