Upstream-Status: Pending

diff -urN -x .git orig/thirdparty/libressl/avoid-BSWAP-assembly-for-ARM-v6.patch patched/thirdparty/libressl/avoid-BSWAP-assembly-for-ARM-v6.patch
--- orig/thirdparty/libressl/avoid-BSWAP-assembly-for-ARM-v6.patch	1970-01-01 09:00:00.000000000 +0900
+++ patched/thirdparty/libressl/avoid-BSWAP-assembly-for-ARM-v6.patch	2020-08-07 23:14:46.196764271 +0900
@@ -0,0 +1,30 @@
+This patch was imported from the libressl potable.
+https://github.com/libressl-portable/portable/commit/a9332ccecfce63bf54924e70c11f420edd3ae312
+
+From a9332ccecfce63bf54924e70c11f420edd3ae312 Mon Sep 17 00:00:00 2001
+From: Brent Cook <bcook@openbsd.org>
+Date: Sun, 17 Jul 2016 18:12:23 -0500
+Subject: [PATCH] avoid BSWAP assembly for ARM <= v6
+
+diff -urN orig/crypto/modes/modes_lcl.h patched/crypto/modes/modes_lcl.h
+--- orig/crypto/modes/modes_lcl.h	2018-11-18 21:27:10.000000000 +0900
++++ patched/crypto/modes/modes_lcl.h	2020-08-07 23:11:01.960764745 +0900
+@@ -45,14 +45,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
