diff options
author | simplelins <a735862152@163.com> | 2020-01-03 22:56:18 +0800 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-10-21 15:28:11 +0200 |
commit | b11aa831cfe09befe3fb3229ca46a4a59352de34 (patch) | |
tree | c47fd234d162bf55ac4de43a8c64c4376a47e5a3 /crypto/modes | |
parent | 4b7595e3ecf3e31ecb93f6397300331ba36b2ca4 (diff) |
Fix AES-GCM bug on aarch64 BigEndian
Fixes #10638
Fixes #13188
Fixes a bug for aarch64 bigendian with instructions 'st1' and 'ld1' on AES-GCM mode.
CLA: trivial
(cherry picked from commit bc8b648f744566031ce84d77333dbbcb9689e975)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13193)
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/modes_local.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/modes/modes_local.h b/crypto/modes/modes_local.h index 28c32c0643..888141681e 100644 --- a/crypto/modes/modes_local.h +++ b/crypto/modes/modes_local.h @@ -63,12 +63,15 @@ typedef u32 u32_a1; 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" \ |