From eb8dd9dca1228af0cd132f515509051ecfabf6f6 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Mon, 14 Apr 2025 17:32:06 +0000 Subject: This commit was manufactured by cvs2git to create tag 'tb_20250414'. --- src/lib/libcrypto/arch/i386/Makefile.inc | 42 ------- src/lib/libcrypto/arch/i386/crypto_arch.h | 46 -------- src/lib/libcrypto/arch/i386/crypto_cpu_caps.c | 120 -------------------- src/lib/libcrypto/arch/i386/opensslconf.h | 154 -------------------------- 4 files changed, 362 deletions(-) delete mode 100644 src/lib/libcrypto/arch/i386/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/i386/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/i386/crypto_cpu_caps.c delete mode 100644 src/lib/libcrypto/arch/i386/opensslconf.h (limited to 'src/lib/libcrypto/arch/i386') diff --git a/src/lib/libcrypto/arch/i386/Makefile.inc b/src/lib/libcrypto/arch/i386/Makefile.inc deleted file mode 100644 index 6989b35686..0000000000 --- a/src/lib/libcrypto/arch/i386/Makefile.inc +++ /dev/null @@ -1,42 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.27 2025/02/14 12:01:58 jsing Exp $ - -# i386-specific libcrypto build rules - -# all i386 code generators use these -EXTRA_PL = ${LCRYPTO_SRC}/perlasm/x86gas.pl ${LCRYPTO_SRC}/perlasm/x86asm.pl - -SRCS += crypto_cpu_caps.c - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-586 -CFLAGS+= -DVPAES_ASM -SSLASM+= aes vpaes-x86 -SSLASM+= aes aesni-x86 -# bn -CFLAGS+= -DOPENSSL_IA32_SSE2 -SSLASM+= bn bn-586 -SSLASM+= bn co-586 -CFLAGS+= -DOPENSSL_BN_ASM_MONT -SSLASM+= bn x86-mont -# md5 -CFLAGS+= -DMD5_ASM -SSLASM+= md5 md5-586 -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-x86 -# rc4 -SSLASM+= rc4 rc4-586 -# sha -SSLASM+= sha sha1-586 -SSLASM+= sha sha256-586 -SSLASM+= sha sha512-586 - -.for dir f in ${SSLASM} -SRCS+= ${f}.S -GENERATED+=${f}.S -${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl ${EXTRA_PL} - /usr/bin/perl -I${LCRYPTO_SRC}/perlasm -I${LCRYPTO_SRC}/${dir}/asm \ - ${LCRYPTO_SRC}/${dir}/asm/${f}.pl \ - openbsd-elf ${CFLAGS} 386 ${PICFLAG} > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h deleted file mode 100644 index 3df3963d0b..0000000000 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.4 2025/02/14 12:01:58 jsing Exp $ */ -/* - * Copyright (c) 2024 Joel Sing - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HEADER_CRYPTO_ARCH_H -#define HEADER_CRYPTO_ARCH_H - -#define HAVE_CRYPTO_CPU_CAPS_INIT -#define HAVE_CRYPTO_CPU_CAPS_IA32 - -#ifndef OPENSSL_NO_ASM - -#define HAVE_AES_CBC_ENCRYPT_INTERNAL -#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL -#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL -#define HAVE_AES_ENCRYPT_INTERNAL -#define HAVE_AES_DECRYPT_INTERNAL - -#define HAVE_RC4_INTERNAL -#define HAVE_RC4_SET_KEY_INTERNAL - -#define HAVE_SHA1_BLOCK_DATA_ORDER -#define HAVE_SHA1_BLOCK_GENERIC - -#define HAVE_SHA256_BLOCK_DATA_ORDER -#define HAVE_SHA256_BLOCK_GENERIC - -#define HAVE_SHA512_BLOCK_DATA_ORDER -#define HAVE_SHA512_BLOCK_GENERIC - -#endif - -#endif diff --git a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c deleted file mode 100644 index 6bb77411af..0000000000 --- a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $OpenBSD: crypto_cpu_caps.c,v 1.3 2024/11/12 13:14:57 jsing Exp $ */ -/* - * Copyright (c) 2024 Joel Sing - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include - -#include "x86_arch.h" - -/* Legacy architecture specific capabilities, used by perlasm. */ -uint64_t OPENSSL_ia32cap_P; - -/* Machine independent CPU capabilities. */ -extern uint64_t crypto_cpu_caps; - -static inline void -cpuid(uint32_t eax, uint32_t *out_eax, uint32_t *out_ebx, uint32_t *out_ecx, - uint32_t *out_edx) -{ - uint32_t ebx = 0, ecx = 0, edx = 0; - -#ifndef OPENSSL_NO_ASM - __asm__ ("cpuid": "+a"(eax), "+b"(ebx), "+c"(ecx), "+d"(edx)); -#else - eax = 0; -#endif - - if (out_eax != NULL) - *out_eax = eax; - if (out_ebx != NULL) - *out_ebx = ebx; - if (out_ecx != NULL) - *out_ecx = ecx; - if (out_edx != NULL) - *out_edx = edx; -} - -static inline void -xgetbv(uint32_t ecx, uint32_t *out_eax, uint32_t *out_edx) -{ - uint32_t eax = 0, edx = 0; - -#ifndef OPENSSL_NO_ASM - __asm__ ("xgetbv": "+a"(eax), "+c"(ecx), "+d"(edx)); -#endif - - if (out_eax != NULL) - *out_eax = eax; - if (out_edx != NULL) - *out_edx = edx; -} - -void -crypto_cpu_caps_init(void) -{ - uint32_t eax, ebx, ecx, edx; - uint64_t caps = 0; - - cpuid(0, &eax, &ebx, &ecx, &edx); - - /* "GenuineIntel" in little endian. */ - if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) - caps |= CPUCAP_MASK_INTEL; - - if (eax < 1) - return; - - cpuid(1, &eax, &ebx, &ecx, &edx); - - if ((edx & IA32CAP_MASK0_FXSR) != 0) - caps |= CPUCAP_MASK_FXSR; - if ((edx & IA32CAP_MASK0_HT) != 0) - caps |= CPUCAP_MASK_HT; - if ((edx & IA32CAP_MASK0_MMX) != 0) - caps |= CPUCAP_MASK_MMX; - if ((edx & IA32CAP_MASK0_SSE) != 0) - caps |= CPUCAP_MASK_SSE; - if ((edx & IA32CAP_MASK0_SSE2) != 0) - caps |= CPUCAP_MASK_SSE2; - - if ((ecx & IA32CAP_MASK1_AESNI) != 0) - caps |= CPUCAP_MASK_AESNI; - if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) - caps |= CPUCAP_MASK_PCLMUL; - if ((ecx & IA32CAP_MASK1_SSSE3) != 0) - caps |= CPUCAP_MASK_SSSE3; - - /* AVX requires OSXSAVE and XMM/YMM state to be enabled. */ - if ((ecx & IA32CAP_MASK1_OSXSAVE) != 0) { - xgetbv(0, &eax, NULL); - if (((eax >> 1) & 3) == 3 && (ecx & IA32CAP_MASK1_AVX) != 0) - caps |= CPUCAP_MASK_AVX; - } - - /* Set machine independent CPU capabilities. */ - if ((caps & CPUCAP_MASK_AESNI) != 0) - crypto_cpu_caps |= CRYPTO_CPU_CAPS_ACCELERATED_AES; - - OPENSSL_ia32cap_P = caps; -} - -uint64_t -crypto_cpu_caps_ia32(void) -{ - return OPENSSL_ia32cap_P; -} diff --git a/src/lib/libcrypto/arch/i386/opensslconf.h b/src/lib/libcrypto/arch/i386/opensslconf.h deleted file mode 100644 index 03cf31b940..0000000000 --- a/src/lib/libcrypto/arch/i386/opensslconf.h +++ /dev/null @@ -1,154 +0,0 @@ -#include -/* crypto/opensslconf.h.in */ - -#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) -#define OPENSSLDIR "/etc/ssl" -#endif - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -#ifndef OPENSSL_FILE -#ifdef OPENSSL_NO_FILENAMES -#define OPENSSL_FILE "" -#define OPENSSL_LINE 0 -#else -#define OPENSSL_FILE __FILE__ -#define OPENSSL_LINE __LINE__ -#endif -#endif - -#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 long -#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 debugging 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_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 -#define DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependencies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#define 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 much CPU dependent */ -#ifndef DES_UNROLL -#define DES_UNROLL -#endif - -/* These default values were supplied by - * Peter Gutman - * 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 */ -- cgit v1.2.3-55-g6feb