aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl/openssl_fix_for_x32.patch
blob: 93ce0343cc7e3894802fb22552206d4fe83e3ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Upstream-Status: Pending

Received from H J Liu @ Intel
Make the assembly syntax compatible with x32 gcc. Othewise x32 gcc throws errors.
Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/07/13

ported the patch to the 1.0.0e version
Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/01
Index: openssl-1.0.1e/Configure
===================================================================
--- openssl-1.0.1e.orig/Configure
+++ openssl-1.0.1e/Configure
@@ -402,6 +402,7 @@ my %table=(
 "linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+"linux-x32", "gcc:-mx32 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
 "linux64-s390x",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 #### So called "highgprs" target for z/Architecture CPUs
 # "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
Index: openssl-1.0.1e/crypto/bn/asm/x86_64-gcc.c
===================================================================
--- openssl-1.0.1e.orig/crypto/bn/asm/x86_64-gcc.c
+++ openssl-1.0.1e/crypto/bn/asm/x86_64-gcc.c
@@ -55,7 +55,7 @@
  *    machine.
  */
 
-#ifdef _WIN64
+#if defined _WIN64 || !defined __LP64__
 #define BN_ULONG unsigned long long
 #else
 #define BN_ULONG unsigned long
@@ -192,9 +192,9 @@ BN_ULONG bn_add_words (BN_ULONG *rp, con
 	asm (
 	"	subq	%2,%2		\n"
 	".p2align 4			\n"
-	"1:	movq	(%4,%2,8),%0	\n"
-	"	adcq	(%5,%2,8),%0	\n"
-	"	movq	%0,(%3,%2,8)	\n"
+	"1:	movq	(%q4,%2,8),%0	\n"
+	"	adcq	(%q5,%2,8),%0	\n"
+	"	movq	%0,(%q3,%2,8)	\n"
 	"	leaq	1(%2),%2	\n"
 	"	loop	1b		\n"
 	"	sbbq	%0,%0		\n"
@@ -215,9 +215,9 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, con
 	asm (
 	"	subq	%2,%2		\n"
 	".p2align 4			\n"
-	"1:	movq	(%4,%2,8),%0	\n"
-	"	sbbq	(%5,%2,8),%0	\n"
-	"	movq	%0,(%3,%2,8)	\n"
+	"1:	movq	(%q4,%2,8),%0	\n"
+	"	sbbq	(%q5,%2,8),%0	\n"
+	"	movq	%0,(%q3,%2,8)	\n"
 	"	leaq	1(%2),%2	\n"
 	"	loop	1b		\n"
 	"	sbbq	%0,%0		\n"
Index: openssl-1.0.1e/crypto/bn/bn.h
===================================================================
--- openssl-1.0.1e.orig/crypto/bn/bn.h
+++ openssl-1.0.1e/crypto/bn/bn.h
@@ -172,6 +172,13 @@ extern "C" {
 # endif
 #endif
 
+/* Address type.  */
+#ifdef _WIN64
+#define BN_ADDR unsigned long long
+#else
+#define BN_ADDR unsigned long
+#endif
+
 /* assuming long is 64bit - this is the DEC Alpha
  * unsigned long long is only 64 bits :-(, don't define
  * BN_LLONG for the DEC Alpha */
Index: openssl-1.0.1e/crypto/bn/bn_exp.c
===================================================================
--- openssl-1.0.1e.orig/crypto/bn/bn_exp.c
+++ openssl-1.0.1e/crypto/bn/bn_exp.c
@@ -567,7 +567,7 @@ static int MOD_EXP_CTIME_COPY_FROM_PREBU
 
 /* Given a pointer value, compute the next address that is a cache line multiple. */
 #define MOD_EXP_CTIME_ALIGN(x_) \
-	((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((size_t)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
+	((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((BN_ADDR)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
 
 /* This variant of BN_mod_exp_mont() uses fixed windows and the special
  * precomputation memory layout to limit data-dependency to a minimum
-e "$REGX" | sed "s/$REGX//"); do if [ "${AUTO_CC/$EMAIL/}" == "$AUTO_CC" ] && [ -n "$EMAIL" ]; then if [ -z "$AUTO_CC" ]; then AUTO_CC=$EMAIL; else AUTO_CC="$AUTO_CC,$EMAIL"; fi fi done done unset IFS } # Parse and verify arguments while getopts "acC:hp:t:" OPT; do case $OPT in a) AUTO=1 GITSOBCC="--signed-off-by-cc" AUTO_CL=1 ;; c) AUTO=1 GITSOBCC="--signed-off-by-cc" ;; C) EXTRA_CC="$OPTARG" ;; h) usage exit 0 ;; p) PDIR=${OPTARG%/} if [ ! -d $PDIR ]; then echo "ERROR: pull-dir \"$PDIR\" does not exist." usage exit 1 fi ;; t) if [ -n "$TO" ]; then TO="$TO,$OPTARG" else TO="$OPTARG" fi ;; esac done if [ -z "$PDIR" ]; then echo "ERROR: you must specify a pull-dir." usage exit 1 fi # Verify the cover letter is complete and free of tokens if [ -e $PDIR/0000-cover-letter.patch ]; then CL="$PDIR/0000-cover-letter.patch" for TOKEN in SUBJECT BLURB; do grep -q "*** $TOKEN HERE ***" "$CL" if [ $? -eq 0 ]; then echo "ERROR: Please edit $CL and try again (Look for '*** $TOKEN HERE ***')." exit 1 fi done else echo "WARNING: No cover letter will be sent." fi # Harvest emails from the generated patches and populate AUTO_CC. if [ $AUTO_CL -eq 1 ]; then for PATCH in $PDIR/*.patch; do harvest_recipients $PATCH done fi AUTO_TO="$(git config sendemail.to)" if [ -n "$AUTO_TO" ]; then if [ -n "$TO" ]; then TO="$TO,$AUTO_TO" else TO="$AUTO_TO" fi fi if [ -z "$TO" ] && [ -z "$AUTO_CC" ]; then echo "ERROR: you have not specified any recipients." usage exit 1 fi # Convert the collected addresses into git-send-email argument strings export IFS=$',' GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done) GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done) GIT_EXTRA_CC=$(for R in $EXTRA_CC; do echo -n "--cc='$R' "; done) unset IFS # Handoff to git-send-email. It will perform the send confirmation. PATCHES=$(echo $PDIR/*.patch) if [ $AUTO_CL -eq 1 ]; then # Send the cover letter to every recipient, both specified as well as # harvested. Then remove it from the patches list. eval "git send-email $GIT_TO $GIT_CC $GIT_EXTRA_CC --confirm=always --no-chain-reply-to --suppress-cc=all $CL" if [ $? -eq 1 ]; then echo "ERROR: failed to send cover-letter with automatic recipients." exit 1 fi PATCHES=${PATCHES/"$CL"/} fi # Send the patch to the specified recipients and, if -c was specified, those git # finds in this specific patch. eval "git send-email $GIT_TO $GIT_EXTRA_CC --confirm=always --no-chain-reply-to $GITSOBCC $PATCHES" if [ $? -eq 1 ]; then echo "ERROR: failed to send patches." exit 1 fi