Re: libcrypto: get rid of I386_ONLY
OK bcook@, looks fine for portable too. > On Nov 4, 2016, at 11:02 AM, Tom Cosgrove >wrote: > 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 - 1.37 >> +++ cryptlib.c 4 Nov 2016 08:49:22 - >> @@ -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.h4 Sep 2016 14:31:29 - 1.21 >> +++ md32_common.h4 Nov 2016 08:49:22 - >> @@ -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 - 1.7 >> +++ arch/alpha/opensslconf.h 4 Nov 2016 08:49:22 - >> @@ -1,9 +1,6 @@ >> #include >> /* 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 - 1.9 >> +++ arch/amd64/opensslconf.h 4 Nov 2016 08:49:22 - >> @@ -1,9 +1,6 @@ >> #include >> /* 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 - 1.7 >> +++ arch/arm/opensslconf.h 4 Nov 2016 08:49:22 - >> @@ -1,9 +1,6 @@ >> #include >> /* 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 - 1.7 >> +++ arch/hppa/opensslconf.h 4 Nov 2016 08:49:22 - >> @@ -1,9 +1,6 @@ >> #include >> /* 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 - 1.7 >> +++ arch/i386/opensslconf.h 4 Nov 2016 08:49:22 - >> @@ -1,9 +1,6 @@ >> #include >> /* crypto/opensslconf.h.in */ >> >> -/* Generate 80386 code? */ >>
Re: libcrypto: get rid of I386_ONLY
>>> 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.c13 Sep 2015 16:56:11 - 1.37 > +++ cryptlib.c4 Nov 2016 08:49:22 - > @@ -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 - 1.21 > +++ md32_common.h 4 Nov 2016 08:49:22 - > @@ -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 - 1.7 > +++ arch/alpha/opensslconf.h 4 Nov 2016 08:49:22 - > @@ -1,9 +1,6 @@ > #include > /* 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 - 1.9 > +++ arch/amd64/opensslconf.h 4 Nov 2016 08:49:22 - > @@ -1,9 +1,6 @@ > #include > /* 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.h19 Jun 2015 06:05:11 - 1.7 > +++ arch/arm/opensslconf.h4 Nov 2016 08:49:22 - > @@ -1,9 +1,6 @@ > #include > /* 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 - 1.7 > +++ arch/hppa/opensslconf.h 4 Nov 2016 08:49:22 - > @@ -1,9 +1,6 @@ > #include > /* 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 - 1.7 > +++ arch/i386/opensslconf.h 4 Nov 2016 08:49:22 - > @@ -1,9 +1,6 @@ > #include > /* 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 >
libcrypto: get rid of I386_ONLY
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. 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 - 1.37 +++ cryptlib.c 4 Nov 2016 08:49:22 - @@ -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 - 1.21 +++ md32_common.h 4 Nov 2016 08:49:22 - @@ -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.h19 Jun 2015 06:05:11 - 1.7 +++ arch/alpha/opensslconf.h4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* 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.h19 Jun 2015 06:05:11 - 1.9 +++ arch/amd64/opensslconf.h4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* 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 - 1.7 +++ arch/arm/opensslconf.h 4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* 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 - 1.7 +++ arch/hppa/opensslconf.h 4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* 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 - 1.7 +++ arch/i386/opensslconf.h 4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* 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 - 1.7 +++ arch/m88k/opensslconf.h 4 Nov 2016 08:49:22 - @@ -1,9 +1,6 @@ #include /* crypto/opensslconf.h.in */ -/* Generate 80386 code? */ -#undef I386_ONLY - #if