>>> Miod Vallat 4-Nov-16 08:53 >>>
>
> I386_ONLY was used to prefer a different assembler sequence in the
> sha512 code, which would be faster on 80386 processors, but slower on
> 80486 and above.
>
> This code path has never been enabled, and there are actually no plans
> to make libcrypto friendlier to genuine 80386 chips, so why bother
> keeping this - it's only contributing to obfuscation.

... not to mention that OpenBSD hasn't supported the 386 for a long time now

ok tom@

> Index: cryptlib.c
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/cryptlib.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 cryptlib.c
> --- cryptlib.c        13 Sep 2015 16:56:11 -0000      1.37
> +++ cryptlib.c        4 Nov 2016 08:49:22 -0000
> @@ -635,7 +635,7 @@ OPENSSL_cpu_caps(void)
>       return *(uint64_t *)OPENSSL_ia32cap_P;
>  }
>  
> -#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && 
> !defined(I386_ONLY)
> +#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM)
>  #define OPENSSL_CPUID_SETUP
>  typedef unsigned long long IA32CAP;
>  void
> Index: md32_common.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/md32_common.h,v
> retrieving revision 1.21
> diff -u -p -r1.21 md32_common.h
> --- md32_common.h     4 Sep 2016 14:31:29 -0000       1.21
> +++ md32_common.h     4 Nov 2016 08:49:22 -0000
> @@ -152,8 +152,8 @@ static inline uint32_t ROTATE(uint32_t a
>  #if defined(DATA_ORDER_IS_BIG_ENDIAN)
>  
>  #if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && 
> !defined(OPENSSL_NO_INLINE_ASM)
> -# if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \
> -      (defined(__x86_64) || defined(__x86_64__))
> +# if (defined(__i386) || defined(__i386__) || \
> +      defined(__x86_64) || defined(__x86_64__))
>      /*
>       * This gives ~30-40% performance improvement in SHA-256 compiled
>       * with gcc [on P4]. Well, first macro to be frank. We can pull
> Index: arch/alpha/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/alpha/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/alpha/opensslconf.h  19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/alpha/opensslconf.h  4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/amd64/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/amd64/opensslconf.h,v
> retrieving revision 1.9
> diff -u -p -r1.9 opensslconf.h
> --- arch/amd64/opensslconf.h  19 Jun 2015 06:05:11 -0000      1.9
> +++ arch/amd64/opensslconf.h  4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/arm/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/arm/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/arm/opensslconf.h    19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/arm/opensslconf.h    4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/hppa/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/hppa/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/hppa/opensslconf.h   19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/hppa/opensslconf.h   4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/i386/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/i386/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/i386/opensslconf.h   19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/i386/opensslconf.h   4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/m88k/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/m88k/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/m88k/opensslconf.h   19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/m88k/opensslconf.h   4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/mips64/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/mips64/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/mips64/opensslconf.h 19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/mips64/opensslconf.h 4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/powerpc/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/powerpc/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/powerpc/opensslconf.h        19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/powerpc/opensslconf.h        4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/sh/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/sh/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/sh/opensslconf.h     19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/sh/opensslconf.h     4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/sparc/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/sparc/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/sparc/opensslconf.h  19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/sparc/opensslconf.h  4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: arch/sparc64/opensslconf.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/arch/sparc64/opensslconf.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 opensslconf.h
> --- arch/sparc64/opensslconf.h        19 Jun 2015 06:05:11 -0000      1.7
> +++ arch/sparc64/opensslconf.h        4 Nov 2016 08:49:22 -0000
> @@ -1,9 +1,6 @@
>  #include <openssl/opensslfeatures.h>
>  /* crypto/opensslconf.h.in */
>  
> -/* Generate 80386 code? */
> -#undef I386_ONLY
> -
>  #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
>  #define OPENSSLDIR "/etc/ssl"
>  #endif
> Index: engine/eng_padlock.c
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/engine/eng_padlock.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 eng_padlock.c
> --- engine/eng_padlock.c      7 Feb 2015 13:19:15 -0000       1.14
> +++ engine/eng_padlock.c      4 Nov 2016 08:49:23 -0000
> @@ -100,7 +100,7 @@
>     In addition, because of the heavy use of inline assembler,
>     compiler choice is limited to GCC and Microsoft C. */
>  #undef COMPILE_HW_PADLOCK
> -#if !defined(I386_ONLY) && !defined(OPENSSL_NO_INLINE_ASM)
> +#if !defined(OPENSSL_NO_INLINE_ASM)
>  # if (defined(__GNUC__) && (defined(__i386__) || defined(__i386)))
>  #  define COMPILE_HW_PADLOCK
>  # endif
> Index: evp/e_aes.c
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/evp/e_aes.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 e_aes.c
> --- evp/e_aes.c       10 Sep 2015 15:56:25 -0000      1.29
> +++ evp/e_aes.c       4 Nov 2016 08:49:23 -0000
> @@ -143,14 +143,14 @@ void AES_xts_decrypt(const char *inp, ch
>      const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
>  #endif
>  
> -#if  defined(AES_ASM) && !defined(I386_ONLY) &&      (  \
> +#if  defined(AES_ASM) &&                             (  \
>       ((defined(__i386)       || defined(__i386__)    || \
>         defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2))|| \
>       defined(__x86_64)       || defined(__x86_64__)  || \
>       defined(_M_AMD64)       || defined(_M_X64)      || \
>       defined(__INTEL__)                              )
>  
> -extern unsigned int OPENSSL_ia32cap_P[2];
> +extern unsigned int OPENSSL_ia32cap_P[];
>  
>  #ifdef VPAES_ASM
>  #define VPAES_CAPABLE        (OPENSSL_ia32cap_P[1]&(1<<(41-32)))
> Index: modes/gcm128.c
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/modes/gcm128.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 gcm128.c
> --- modes/gcm128.c    10 Sep 2015 15:56:25 -0000      1.13
> +++ modes/gcm128.c    4 Nov 2016 08:49:23 -0000
> @@ -638,8 +638,7 @@ static void gcm_gmult_1bit(u64 Xi[2],con
>  #endif
>  
>  #if  TABLE_BITS==4 && defined(GHASH_ASM)
> -# if !defined(I386_ONLY) && \
> -     (defined(__i386)        || defined(__i386__)    || \
> +# if (defined(__i386)        || defined(__i386__)    || \
>        defined(__x86_64)      || defined(__x86_64__)  || \
>        defined(_M_IX86)       || defined(_M_AMD64)    || defined(_M_X64))
>  #  define GHASH_ASM_X86_OR_64
> Index: modes/modes_lcl.h
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/modes/modes_lcl.h,v
> retrieving revision 1.8
> diff -u -p -r1.8 modes_lcl.h
> --- modes/modes_lcl.h 10 Jul 2014 22:45:57 -0000      1.8
> +++ modes/modes_lcl.h 4 Nov 2016 08:49:23 -0000
> @@ -34,7 +34,7 @@ typedef unsigned char u8;
>  #  define BSWAP4(x) ({       u32 ret=(x);                    \
>                       asm ("bswapl %0"                \
>                       : "+r"(ret));   ret;            })
> -# elif (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
> +# elif (defined(__i386) || defined(__i386__))
>  #  define BSWAP8(x) ({       u32 lo=(u64)(x)>>32,hi=(x);     \
>                       asm ("bswapl %0; bswapl %1"     \
>                       : "+r"(hi),"+r"(lo));           \
> Index: sha/sha512.c
> ===================================================================
> RCS file: /cvs/src/lib/libcrypto/sha/sha512.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 sha512.c
> --- sha/sha512.c      10 Sep 2015 15:56:26 -0000      1.14
> +++ sha/sha512.c      4 Nov 2016 08:49:23 -0000
> @@ -320,23 +320,12 @@ static const SHA_LONG64 K512[80] = {
>                               : "=r"(ret)                     \
>                               : "0"(ret)); ret;               })
>  # elif (defined(__i386) || defined(__i386__))
> -#  if defined(I386_ONLY)
> -#   define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
> -                      unsigned int hi=p[0],lo=p[1];          \
> -                             asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\
> -                                 "roll $16,%%eax; roll $16,%%edx; "\
> -                                 "xchgb %%ah,%%al;xchgb %%dh,%%dl;" \
> -                             : "=a"(lo),"=d"(hi)             \
> -                             : "0"(lo),"1"(hi) : "cc");      \
> -                             ((SHA_LONG64)hi)<<32|lo;        })
> -#  else
>  #   define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
>                        unsigned int hi=p[0],lo=p[1];          \
>                               asm ("bswapl %0; bswapl %1;"    \
>                               : "=r"(lo),"=r"(hi)             \
>                               : "0"(lo),"1"(hi));             \
>                               ((SHA_LONG64)hi)<<32|lo;        })
> -#  endif
>  # elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64)
>  #  define ROTR(a,n)  ({ SHA_LONG64 ret;              \
>                               asm ("rotrdi %0,%1,%2"  \

Reply via email to