From a9332ccecfce63bf54924e70c11f420edd3ae312 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 17 Jul 2016 18:12:23 -0500 Subject: [PATCH] avoid BSWAP assembly for ARM <= v6 --- patches/modes_lcl.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 patches/modes_lcl.h diff --git a/patches/modes_lcl.h b/patches/modes_lcl.h new file mode 100644 index 0000000..1ba9f2e --- /dev/null +++ b/patches/modes_lcl.h @@ -0,0 +1,21 @@ +--- openbsd/src/lib/libssl/src/crypto/modes/modes_lcl.h Sat Dec 6 17:15:50 2014 ++++ crypto/modes/modes_lcl.h Sun Jul 17 17:45:27 2016 +@@ -43,14 +43,16 @@ + asm ("bswapl %0" \ + : "+r"(ret)); ret; }) + # elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) +-# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ ++# if (__ARM_ARCH >= 6) ++# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ + asm ("rev %0,%0; rev %1,%1" \ + : "+r"(hi),"+r"(lo)); \ + (u64)hi<<32|lo; }) +-# define BSWAP4(x) ({ u32 ret; \ ++# define BSWAP4(x) ({ u32 ret; \ + asm ("rev %0,%1" \ + : "=r"(ret) : "r"((u32)(x))); \ + ret; }) ++# endif + # endif + #endif + #endif