diff options
author | 2016-11-04 13:56:04 +0000 | |
---|---|---|
committer | 2016-11-04 13:56:04 +0000 | |
commit | 4647d16fb4cbf0d3331c83027d620ec393564786 (patch) | |
tree | f6b2ed809f2ed521c3b73dd471ac9ef503b81a60 /lib/libc | |
parent | In OPENSSL_wipe_cpu() on i386, which noone uses anyway, check the proper (diff) | |
download | wireguard-openbsd-4647d16fb4cbf0d3331c83027d620ec393564786.tar.xz wireguard-openbsd-4647d16fb4cbf0d3331c83027d620ec393564786.zip |
Remove I386_ONLY define. It was only used to prefer a
faster-on-genuine-80386-but-slower-on-80486-onwards innstruction sequence in
the SHA512 code, and had not been enabled in years, if at all.
ok tom@ bcook@
Diffstat (limited to '')
-rw-r--r-- | lib/libcrypto/arch/alpha/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/amd64/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/arm/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/hppa/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/i386/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/m88k/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/mips64/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/powerpc/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/sh/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/arch/sparc/opensslconf.h | 154 | ||||
-rw-r--r-- | lib/libcrypto/arch/sparc64/opensslconf.h | 3 | ||||
-rw-r--r-- | lib/libcrypto/cryptlib.c | 4 | ||||
-rw-r--r-- | lib/libcrypto/engine/eng_padlock.c | 4 | ||||
-rw-r--r-- | lib/libcrypto/evp/e_aes.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/md32_common.h | 6 | ||||
-rw-r--r-- | lib/libcrypto/modes/gcm128.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/modes/modes_lcl.h | 4 | ||||
-rw-r--r-- | lib/libcrypto/sha/sha512.c | 13 |
18 files changed, 169 insertions, 57 deletions
diff --git a/lib/libcrypto/arch/alpha/opensslconf.h b/lib/libcrypto/arch/alpha/opensslconf.h index a74c6df644c..a1331118f40 100644 --- a/lib/libcrypto/arch/alpha/opensslconf.h +++ b/lib/libcrypto/arch/alpha/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/amd64/opensslconf.h b/lib/libcrypto/arch/amd64/opensslconf.h index cbd5d53ca4b..f8cbb5d652f 100644 --- a/lib/libcrypto/arch/amd64/opensslconf.h +++ b/lib/libcrypto/arch/amd64/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/arm/opensslconf.h b/lib/libcrypto/arch/arm/opensslconf.h index e3795ce73ae..78cd6d856fb 100644 --- a/lib/libcrypto/arch/arm/opensslconf.h +++ b/lib/libcrypto/arch/arm/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/hppa/opensslconf.h b/lib/libcrypto/arch/hppa/opensslconf.h index e3795ce73ae..78cd6d856fb 100644 --- a/lib/libcrypto/arch/hppa/opensslconf.h +++ b/lib/libcrypto/arch/hppa/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/i386/opensslconf.h b/lib/libcrypto/arch/i386/opensslconf.h index 37137ff1022..bf439696d89 100644 --- a/lib/libcrypto/arch/i386/opensslconf.h +++ b/lib/libcrypto/arch/i386/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/m88k/opensslconf.h b/lib/libcrypto/arch/m88k/opensslconf.h index e3795ce73ae..78cd6d856fb 100644 --- a/lib/libcrypto/arch/m88k/opensslconf.h +++ b/lib/libcrypto/arch/m88k/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/mips64/opensslconf.h b/lib/libcrypto/arch/mips64/opensslconf.h index ef7a679d94f..226951eded1 100644 --- a/lib/libcrypto/arch/mips64/opensslconf.h +++ b/lib/libcrypto/arch/mips64/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/powerpc/opensslconf.h b/lib/libcrypto/arch/powerpc/opensslconf.h index e3795ce73ae..78cd6d856fb 100644 --- a/lib/libcrypto/arch/powerpc/opensslconf.h +++ b/lib/libcrypto/arch/powerpc/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/sh/opensslconf.h b/lib/libcrypto/arch/sh/opensslconf.h index e3795ce73ae..78cd6d856fb 100644 --- a/lib/libcrypto/arch/sh/opensslconf.h +++ b/lib/libcrypto/arch/sh/opensslconf.h @@ -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 diff --git a/lib/libcrypto/arch/sparc/opensslconf.h b/lib/libcrypto/arch/sparc/opensslconf.h new file mode 100644 index 00000000000..78cd6d856fb --- /dev/null +++ b/lib/libcrypto/arch/sparc/opensslconf.h @@ -0,0 +1,154 @@ +#include <openssl/opensslfeatures.h> +/* crypto/opensslconf.h.in */ + +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define OPENSSLDIR "/etc/ssl" +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD <unistd.h> + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned int +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#define BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#define RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/lib/libcrypto/arch/sparc64/opensslconf.h b/lib/libcrypto/arch/sparc64/opensslconf.h index ef7a679d94f..226951eded1 100644 --- a/lib/libcrypto/arch/sparc64/opensslconf.h +++ b/lib/libcrypto/arch/sparc64/opensslconf.h @@ -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 diff --git a/lib/libcrypto/cryptlib.c b/lib/libcrypto/cryptlib.c index 0f2c5970bc9..fa091fbaeac 100644 --- a/lib/libcrypto/cryptlib.c +++ b/lib/libcrypto/cryptlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptlib.c,v 1.37 2015/09/13 16:56:11 miod Exp $ */ +/* $OpenBSD: cryptlib.c,v 1.38 2016/11/04 13:56:04 miod Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -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 diff --git a/lib/libcrypto/engine/eng_padlock.c b/lib/libcrypto/engine/eng_padlock.c index 1c86a343dfe..4f2d426a068 100644 --- a/lib/libcrypto/engine/eng_padlock.c +++ b/lib/libcrypto/engine/eng_padlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_padlock.c,v 1.14 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: eng_padlock.c,v 1.15 2016/11/04 13:56:05 miod Exp $ */ /* * Support for VIA PadLock Advanced Cryptography Engine (ACE) * Written by Michal Ludvig <michal@logix.cz> @@ -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 diff --git a/lib/libcrypto/evp/e_aes.c b/lib/libcrypto/evp/e_aes.c index a6d48085c3c..25199dca366 100644 --- a/lib/libcrypto/evp/e_aes.c +++ b/lib/libcrypto/evp/e_aes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_aes.c,v 1.29 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: e_aes.c,v 1.30 2016/11/04 13:56:05 miod Exp $ */ /* ==================================================================== * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. * @@ -143,14 +143,14 @@ void AES_xts_decrypt(const char *inp, char *out, size_t len, 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))) diff --git a/lib/libcrypto/md32_common.h b/lib/libcrypto/md32_common.h index bad34d22d6a..0dca61710fc 100644 --- a/lib/libcrypto/md32_common.h +++ b/lib/libcrypto/md32_common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md32_common.h,v 1.21 2016/09/04 14:31:29 jsing Exp $ */ +/* $OpenBSD: md32_common.h,v 1.22 2016/11/04 13:56:04 miod Exp $ */ /* ==================================================================== * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * @@ -152,8 +152,8 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n) #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 diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c index dd6d91e8807..6f8a8dd7f4f 100644 --- a/lib/libcrypto/modes/gcm128.c +++ b/lib/libcrypto/modes/gcm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcm128.c,v 1.13 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: gcm128.c,v 1.14 2016/11/04 13:56:05 miod Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -638,8 +638,7 @@ static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2]) #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 diff --git a/lib/libcrypto/modes/modes_lcl.h b/lib/libcrypto/modes/modes_lcl.h index 8e43e480fc1..a90f4a2b37a 100644 --- a/lib/libcrypto/modes/modes_lcl.h +++ b/lib/libcrypto/modes/modes_lcl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: modes_lcl.h,v 1.8 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: modes_lcl.h,v 1.9 2016/11/04 13:56:05 miod Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -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)); \ diff --git a/lib/libcrypto/sha/sha512.c b/lib/libcrypto/sha/sha512.c index 7a55c0acc9d..6b95cfa72e1 100644 --- a/lib/libcrypto/sha/sha512.c +++ b/lib/libcrypto/sha/sha512.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha512.c,v 1.14 2015/09/10 15:56:26 jsing Exp $ */ +/* $OpenBSD: sha512.c,v 1.15 2016/11/04 13:56:05 miod Exp $ */ /* ==================================================================== * Copyright (c) 2004 The OpenSSL Project. All rights reserved * according to the OpenSSL license [found in ../../LICENSE]. @@ -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" \ |