summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch')
-rw-r--r--meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch141
1 files changed, 141 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch b/meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch
new file mode 100644
index 0000000000..972b367993
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/initial-aarch64-bits.patch
@@ -0,0 +1,141 @@
1From: Andy Polyakov <appro@openssl.org>
2Date: Sun, 13 Oct 2013 17:15:15 +0000 (+0200)
3Subject: Initial aarch64 bits.
4X-Git-Url: http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=039081b80977e2a5de84e1f88f8b4d025b559956
5
6Initial aarch64 bits.
7Upstream-Status: backport (will be included in 1.0.2)
8
9ported the patch to the 1.0.0m version
10Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> 2015/03/24
11---
12 crypto/bn/bn_lcl.h | 9 +++++++++
13 crypto/md32_common.h | 18 ++++++++++++++++++
14 crypto/modes/modes_lcl.h | 8 ++++++++
15 crypto/sha/sha512.c | 13 +++++++++++++
16 4 files changed, 48 insertions(+)
17
18Index: openssl-1.0.1f/crypto/bn/bn_lcl.h
19===================================================================
20--- openssl-1.0.1f.orig/crypto/bn/bn_lcl.h 2014-01-06 15:47:42.000000000 +0200
21+++ openssl-1.0.1f/crypto/bn/bn_lcl.h 2014-02-28 10:37:55.495979037 +0200
22@@ -295,6 +295,15 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
23 : "r"(a), "r"(b));
24 # endif
25 # endif
26+# elif defined(__aarch64__) && defined(SIXTY_FOUR_BIT_LONG)
27+# if defined(__GNUC__) && __GNUC__>=2
28+# define BN_UMULT_HIGH(a,b) ({ \
29+ register BN_ULONG ret; \
30+ asm ("umulh %0,%1,%2" \
31+ : "=r"(ret) \
32+ : "r"(a), "r"(b)); \
33+ ret; })
34+# endif
35 # endif /* cpu */
36 # endif /* OPENSSL_NO_ASM */
37
38Index: openssl-1.0.1f/crypto/md32_common.h
39===================================================================
40--- openssl-1.0.1f.orig/crypto/md32_common.h 2014-01-06 15:47:42.000000000 +0200
41+++ openssl-1.0.1f/crypto/md32_common.h 2014-02-28 10:39:21.751979107 +0200
42@@ -213,6 +213,42 @@
43 asm ("bswapl %0":"=r"(r):"0"(r)); \
44 *((unsigned int *)(c))=r; (c)+=4; r; })
45 # endif
46+# elif defined(__aarch64__)
47+# if defined(__BYTE_ORDER__)
48+# if defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
49+# define HOST_c2l(c,l) ({ unsigned int r; \
50+ asm ("rev %w0,%w1" \
51+ :"=r"(r) \
52+ :"r"(*((const unsigned int *)(c))));\
53+ (c)+=4; (l)=r; })
54+# define HOST_l2c(l,c) ({ unsigned int r; \
55+ asm ("rev %w0,%w1" \
56+ :"=r"(r) \
57+ :"r"((unsigned int)(l)));\
58+ *((unsigned int *)(c))=r; (c)+=4; r; })
59+# elif defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
60+# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
61+# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l))
62+# endif
63+# endif
64+# endif
65+# elif defined(__aarch64__)
66+# if defined(__BYTE_ORDER__)
67+# if defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
68+# define HOST_c2l(c,l) ({ unsigned int r; \
69+ asm ("rev %w0,%w1" \
70+ :"=r"(r) \
71+ :"r"(*((const unsigned int *)(c))));\
72+ (c)+=4; (l)=r; })
73+# define HOST_l2c(l,c) ({ unsigned int r; \
74+ asm ("rev %w0,%w1" \
75+ :"=r"(r) \
76+ :"r"((unsigned int)(l)));\
77+ *((unsigned int *)(c))=r; (c)+=4; r; })
78+# elif defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
79+# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
80+# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l))
81+# endif
82 # endif
83 # endif
84 # endif
85Index: openssl-1.0.1f/crypto/modes/modes_lcl.h
86===================================================================
87--- openssl-1.0.1f.orig/crypto/modes/modes_lcl.h 2014-02-28 10:47:48.731979011 +0200
88+++ openssl-1.0.1f/crypto/modes/modes_lcl.h 2014-02-28 10:48:49.707978919 +0200
89@@ -28,6 +28,7 @@ typedef unsigned char u8;
90 #if defined(__i386) || defined(__i386__) || \
91 defined(__x86_64) || defined(__x86_64__) || \
92 defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
93+ defined(__aarch64__) || \
94 defined(__s390__) || defined(__s390x__)
95 # undef STRICT_ALIGNMENT
96 #endif
97@@ -49,6 +50,13 @@ typedef unsigned char u8;
98 # define BSWAP4(x) ({ u32 ret=(x); \
99 asm ("bswapl %0" \
100 : "+r"(ret)); ret; })
101+# elif defined(__aarch64__)
102+# define BSWAP8(x) ({ u64 ret; \
103+ asm ("rev %0,%1" \
104+ : "=r"(ret) : "r"(x)); ret; })
105+# define BSWAP4(x) ({ u32 ret; \
106+ asm ("rev %w0,%w1" \
107+ : "=r"(ret) : "r"(x)); ret; })
108 # elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT)
109 # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
110 asm ("rev %0,%0; rev %1,%1" \
111Index: openssl-1.0.1f/crypto/sha/sha512.c
112===================================================================
113--- openssl-1.0.1f.orig/crypto/sha/sha512.c 2014-01-06 15:47:42.000000000 +0200
114+++ openssl-1.0.1f/crypto/sha/sha512.c 2014-02-28 10:52:14.579978981 +0200
115@@ -55,6 +55,7 @@ const char SHA512_version[] = "SHA-512" OPENSSL_VERSION_PTEXT;
116 # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
117 defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \
118 defined(__s390__) || defined(__s390x__) || \
119+ defined(__aarch64__) || \
120 defined(SHA512_ASM)
121 # define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
122 # endif
123@@ -353,6 +354,18 @@ static const SHA_LONG64 K512[80] = {
124 asm ("rotrdi %0,%1,%2" \
125 : "=r"(ret) \
126 : "r"(a),"K"(n)); ret; })
127+# elif defined(__aarch64__)
128+# define ROTR(a,n) ({ SHA_LONG64 ret; \
129+ asm ("ror %0,%1,%2" \
130+ : "=r"(ret) \
131+ : "r"(a),"I"(n)); ret; })
132+# if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
133+ __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
134+# define PULL64(x) ({ SHA_LONG64 ret; \
135+ asm ("rev %0,%1" \
136+ : "=r"(ret) \
137+ : "r"(*((const SHA_LONG64 *)(&(x))))); ret; })
138+# endif
139 # endif
140 # elif defined(_MSC_VER)
141 # if defined(_WIN64) /* applies to both IA-64 and AMD64 */