diff options
author | simplelins <a735862152@163.com> | 2020-01-03 15:56:18 +0100 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-02-17 03:13:23 +0100 |
commit | bc8b648f744566031ce84d77333dbbcb9689e975 (patch) | |
tree | 74af2e35351508994d8a8cd584c7bd79698a0080 /include | |
parent | crypto/bn: fix debug build (diff) | |
download | openssl-bc8b648f744566031ce84d77333dbbcb9689e975.tar.xz openssl-bc8b648f744566031ce84d77333dbbcb9689e975.zip |
Fix a bug for aarch64 BigEndian
FIXES #10692 #10638
a bug for aarch64 bigendian with instructions 'st1' and 'ld1' on AES-GCM mode.
CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10751)
Diffstat (limited to 'include')
-rw-r--r-- | include/crypto/modes.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/crypto/modes.h b/include/crypto/modes.h index 08e4ffae74..edcdab95fa 100644 --- a/include/crypto/modes.h +++ b/include/crypto/modes.h @@ -56,12 +56,15 @@ typedef unsigned char u8; asm ("bswapl %0" \ : "+r"(ret_)); ret_; }) # elif defined(__aarch64__) -# define BSWAP8(x) ({ u64 ret_; \ +# if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ + __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ +# define BSWAP8(x) ({ u64 ret_; \ asm ("rev %0,%1" \ : "=r"(ret_) : "r"(x)); ret_; }) -# define BSWAP4(x) ({ u32 ret_; \ +# define BSWAP4(x) ({ u32 ret_; \ asm ("rev %w0,%w1" \ : "=r"(ret_) : "r"(x)); ret_; }) +# endif # elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT) # define BSWAP8(x) ({ u32 lo_=(u64)(x)>>32,hi_=(x); \ asm ("rev %0,%0; rev %1,%1" \ |