Add linux-x32 target.
authorAndy Polyakov <appro@openssl.org>
Wed, 29 Aug 2012 14:08:46 +0000 (14:08 +0000)
committerAndy Polyakov <appro@openssl.org>
Wed, 29 Aug 2012 14:08:46 +0000 (14:08 +0000)
Configure
TABLE
crypto/bn/asm/x86_64-gcc.c

index db90e84c51911d5c7f84f189ae55cf3ae828186c..61e85c2e6a042f248b30e32cfffb0fe739e4874b 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -358,6 +358,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::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK_LL 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
diff --git a/TABLE b/TABLE
index 83d6bed824dfabd81de1a4fee6c2682abefd9f67..7c5349092ee41c409307b73bcd19de5b5cd575d6 100644 (file)
--- a/TABLE
+++ b/TABLE
@@ -4323,6 +4323,39 @@ $ranlib       =
 $arflags      = 
 $multilib     = 
 
+*** linux-x32
+$cc           = gcc
+$cflags       = -mx32 -DL_ENDIAN -DTERMIO -O3 -Wall
+$unistd       = 
+$thread_cflag = -D_REENTRANT
+$sys_id       = 
+$lflags       = -ldl
+$bn_ops       = SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT DES_UNROLL
+$cpuid_obj    = x86_64cpuid.o
+$bn_obj       = x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o
+$des_obj      = 
+$aes_obj      = aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o
+$bf_obj       = 
+$md5_obj      = md5-x86_64.o
+$sha1_obj     = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
+$cast_obj     = 
+$rc4_obj      = rc4-x86_64.o rc4-md5-x86_64.o
+$rmd160_obj   = 
+$rc5_obj      = 
+$wp_obj       = wp-x86_64.o
+$cmll_obj     = cmll-x86_64.o cmll_misc.o
+$modes_obj    = ghash-x86_64.o
+$engines_obj  = e_padlock-x86_64.o
+$perlasm_scheme = elf
+$dso_scheme   = dlfcn
+$shared_target= linux-shared
+$shared_cflag = -fPIC
+$shared_ldflag = -mx32
+$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
+$ranlib       = 
+$arflags      = 
+$multilib     = x32
+
 *** linux-x86_64
 $cc           = gcc
 $cflags       = -m64 -DL_ENDIAN -DTERMIO -O3 -Wall
index 9296851ec5c8537c0a0baa3c6bcaf23794e822ab..d34d2dce09a745ca0c76fe0ce3b111c9c9b57da6 100644 (file)
@@ -55,7 +55,7 @@
  *    machine.
  */
 
-#ifdef _WIN64
+#if defined(_WIN64) || !defined(__LP64__)
 #define BN_ULONG unsigned long long
 #else
 #define BN_ULONG unsigned long
@@ -184,20 +184,22 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
 }
 
 BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int n)
-{ BN_ULONG ret=0,i=0;
+{ BN_ULONG ret;
+  size_t i=0;
 
        if (n <= 0) return 0;
 
        asm (
-       "       subq    %2,%2           \n"
+       "       subq    %0,%0           \n"     /* clear carry */
+       "       jmp     1f              \n"
        ".p2align 4                     \n"
        "1:     movq    (%4,%2,8),%0    \n"
        "       adcq    (%5,%2,8),%0    \n"
        "       movq    %0,(%3,%2,8)    \n"
-       "       leaq    1(%2),%2        \n"
+       "       lea     1(%2),%2        \n"
        "       loop    1b              \n"
        "       sbbq    %0,%0           \n"
-               : "=&a"(ret),"+c"(n),"=&r"(i)
+               : "=r"(ret),"+c"(n),"+r"(i)
                : "r"(rp),"r"(ap),"r"(bp)
                : "cc"
        );
@@ -207,20 +209,22 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
 
 #ifndef SIMICS
 BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int n)
-{ BN_ULONG ret=0,i=0;
+{ BN_ULONG ret;
+  size_t i=0;
 
        if (n <= 0) return 0;
 
        asm (
-       "       subq    %2,%2           \n"
+       "       subq    %0,%0           \n"     /* clear borrow */
+       "       jmp     1f              \n"
        ".p2align 4                     \n"
        "1:     movq    (%4,%2,8),%0    \n"
        "       sbbq    (%5,%2,8),%0    \n"
        "       movq    %0,(%3,%2,8)    \n"
-       "       leaq    1(%2),%2        \n"
+       "       lea     1(%2),%2        \n"
        "       loop    1b              \n"
        "       sbbq    %0,%0           \n"
-               : "=&a"(ret),"+c"(n),"=&r"(i)
+               : "=r"(ret),"+c"(n),"+r"(i)
                : "r"(rp),"r"(ap),"r"(bp)
                : "cc"
        );