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/aarch64/Makefile.inc | 12 -- src/lib/libcrypto/arch/aarch64/crypto_arch.h | 43 ------- src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c | 97 -------------- src/lib/libcrypto/arch/aarch64/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/alpha/Makefile.inc | 20 --- src/lib/libcrypto/arch/alpha/crypto_arch.h | 24 ---- src/lib/libcrypto/arch/alpha/opensslconf.h | 152 ---------------------- src/lib/libcrypto/arch/amd64/Makefile.inc | 68 ---------- src/lib/libcrypto/arch/amd64/crypto_arch.h | 54 -------- src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c | 134 -------------------- src/lib/libcrypto/arch/amd64/opensslconf.h | 149 ---------------------- src/lib/libcrypto/arch/arm/Makefile.inc | 28 ----- src/lib/libcrypto/arch/arm/arm_arch.h | 59 --------- src/lib/libcrypto/arch/arm/armcap.c | 88 ------------- src/lib/libcrypto/arch/arm/armv4cpuid.S | 69 ---------- src/lib/libcrypto/arch/arm/crypto_arch.h | 39 ------ src/lib/libcrypto/arch/arm/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/hppa/Makefile.inc | 24 ---- src/lib/libcrypto/arch/hppa/crypto_arch.h | 34 ----- src/lib/libcrypto/arch/hppa/opensslconf.h | 154 ----------------------- 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 ----------------------- src/lib/libcrypto/arch/m88k/crypto_arch.h | 21 ---- src/lib/libcrypto/arch/m88k/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/mips64/Makefile.inc | 23 ---- src/lib/libcrypto/arch/mips64/crypto_arch.h | 39 ------ src/lib/libcrypto/arch/mips64/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/powerpc/Makefile.inc | 22 ---- src/lib/libcrypto/arch/powerpc/crypto_arch.h | 31 ----- src/lib/libcrypto/arch/powerpc/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/powerpc64/Makefile.inc | 22 ---- src/lib/libcrypto/arch/powerpc64/crypto_arch.h | 21 ---- src/lib/libcrypto/arch/powerpc64/opensslconf.h | 149 ---------------------- src/lib/libcrypto/arch/riscv64/Makefile.inc | 3 - src/lib/libcrypto/arch/riscv64/crypto_arch.h | 21 ---- src/lib/libcrypto/arch/riscv64/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/sh/crypto_arch.h | 21 ---- src/lib/libcrypto/arch/sh/opensslconf.h | 154 ----------------------- src/lib/libcrypto/arch/sparc64/Makefile.inc | 23 ---- src/lib/libcrypto/arch/sparc64/crypto_arch.h | 37 ------ src/lib/libcrypto/arch/sparc64/opensslconf.h | 154 ----------------------- 43 files changed, 3275 deletions(-) delete mode 100644 src/lib/libcrypto/arch/aarch64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/aarch64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c delete mode 100644 src/lib/libcrypto/arch/aarch64/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/alpha/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/alpha/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/alpha/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/amd64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/amd64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c delete mode 100644 src/lib/libcrypto/arch/amd64/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/arm/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/arm/arm_arch.h delete mode 100644 src/lib/libcrypto/arch/arm/armcap.c delete mode 100644 src/lib/libcrypto/arch/arm/armv4cpuid.S delete mode 100644 src/lib/libcrypto/arch/arm/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/arm/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/hppa/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/hppa/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/hppa/opensslconf.h 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 delete mode 100644 src/lib/libcrypto/arch/m88k/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/m88k/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/mips64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/mips64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/mips64/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/powerpc/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/powerpc/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/powerpc/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/powerpc64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/powerpc64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/powerpc64/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/riscv64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/riscv64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/riscv64/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/sh/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/sh/opensslconf.h delete mode 100644 src/lib/libcrypto/arch/sparc64/Makefile.inc delete mode 100644 src/lib/libcrypto/arch/sparc64/crypto_arch.h delete mode 100644 src/lib/libcrypto/arch/sparc64/opensslconf.h (limited to 'src/lib/libcrypto/arch') diff --git a/src/lib/libcrypto/arch/aarch64/Makefile.inc b/src/lib/libcrypto/arch/aarch64/Makefile.inc deleted file mode 100644 index d93cb815ef..0000000000 --- a/src/lib/libcrypto/arch/aarch64/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.16 2025/03/12 14:13:41 jsing Exp $ - -# aarch64-specific libcrypto build rules - -SRCS += crypto_cpu_caps.c - -SRCS += sha256_aarch64.c -SRCS += sha256_aarch64_ce.S -SRCS += sha512_aarch64.c -SRCS += sha512_aarch64_ce.S - -AFLAGS+= -mmark-bti-property diff --git a/src/lib/libcrypto/arch/aarch64/crypto_arch.h b/src/lib/libcrypto/arch/aarch64/crypto_arch.h deleted file mode 100644 index 35ecba9394..0000000000 --- a/src/lib/libcrypto/arch/aarch64/crypto_arch.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.4 2025/03/12 14:13:41 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 - -#ifndef HEADER_CRYPTO_ARCH_H -#define HEADER_CRYPTO_ARCH_H - -#define HAVE_CRYPTO_CPU_CAPS_INIT - -#ifndef __ASSEMBLER__ -extern uint64_t crypto_cpu_caps_aarch64; -#endif - -#define CRYPTO_CPU_CAPS_AARCH64_AES (1ULL << 0) -#define CRYPTO_CPU_CAPS_AARCH64_PMULL (1ULL << 1) -#define CRYPTO_CPU_CAPS_AARCH64_SHA1 (1ULL << 2) -#define CRYPTO_CPU_CAPS_AARCH64_SHA2 (1ULL << 3) -#define CRYPTO_CPU_CAPS_AARCH64_SHA512 (1ULL << 4) -#define CRYPTO_CPU_CAPS_AARCH64_SHA3 (1ULL << 5) - -#ifndef OPENSSL_NO_ASM - -#define HAVE_SHA256_BLOCK_DATA_ORDER -#define HAVE_SHA512_BLOCK_DATA_ORDER - -#endif - -#endif diff --git a/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c b/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c deleted file mode 100644 index b31a50ef75..0000000000 --- a/src/lib/libcrypto/arch/aarch64/crypto_cpu_caps.c +++ /dev/null @@ -1,97 +0,0 @@ -/* $OpenBSD: crypto_cpu_caps.c,v 1.2 2024/11/12 13:52:31 jsing Exp $ */ -/* - * Copyright (c) 2023 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 - -#include -#include - -#include "crypto_arch.h" - -/* Machine dependent CPU capabilities. */ -uint64_t crypto_cpu_caps_aarch64; - -static inline uint64_t -extract_bits(uint64_t val, int start, int end) -{ - return (val >> end) & (1ULL << (1 + start - end)) - 1; -} - -static uint64_t -parse_isar0(uint64_t isar0) -{ - uint64_t caps = 0; - uint64_t feature; - - /* AES - bits [7:4] */ - feature = extract_bits(isar0, 7, 4); - if (feature >= 1) - caps |= CRYPTO_CPU_CAPS_AARCH64_AES; - if (feature >= 2) - caps |= CRYPTO_CPU_CAPS_AARCH64_PMULL; - - /* SHA1 - bits [11:8] */ - feature = extract_bits(isar0, 11, 8); - if (feature >= 1) - caps |= CRYPTO_CPU_CAPS_AARCH64_SHA1; - - /* SHA2 - bits [15:12] */ - feature = extract_bits(isar0, 15, 12); - if (feature >= 1) - caps |= CRYPTO_CPU_CAPS_AARCH64_SHA2; - if (feature >= 2) - caps |= CRYPTO_CPU_CAPS_AARCH64_SHA512; - - /* SHA3 - bits [35:32] */ - feature = extract_bits(isar0, 35, 32); - if (feature >= 1) - caps |= CRYPTO_CPU_CAPS_AARCH64_SHA3; - - return caps; -} - -static int -read_isar0(uint64_t *isar0) -{ - uint64_t isar; - int mib[2]; - size_t len; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_ID_AA64ISAR0; - len = sizeof(isar); - if (sysctl(mib, 2, &isar, &len, NULL, 0) == -1) - return 0; - - *isar0 = isar; - - return 1; -} - -void -crypto_cpu_caps_init(void) -{ - uint64_t isar = 0; - - if (!read_isar0(&isar)) - return; - - crypto_cpu_caps_aarch64 = parse_isar0(isar); -} diff --git a/src/lib/libcrypto/arch/aarch64/opensslconf.h b/src/lib/libcrypto/arch/aarch64/opensslconf.h deleted file mode 100644 index 731b06aecc..0000000000 --- a/src/lib/libcrypto/arch/aarch64/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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef 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 */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/alpha/Makefile.inc b/src/lib/libcrypto/arch/alpha/Makefile.inc deleted file mode 100644 index 1073ac3c1e..0000000000 --- a/src/lib/libcrypto/arch/alpha/Makefile.inc +++ /dev/null @@ -1,20 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.15 2025/02/14 12:01:58 jsing Exp $ - -# alpha-specific libcrypto build rules - -# bn -SSLASM+= bn alpha-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-alpha -# sha -SSLASM+= sha sha1-alpha - -.for dir f in ${SSLASM} -SRCS+= ${f}.S -GENERATED+=${f}.S -${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${f}.pl > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/alpha/crypto_arch.h b/src/lib/libcrypto/arch/alpha/crypto_arch.h deleted file mode 100644 index 1d553b7e07..0000000000 --- a/src/lib/libcrypto/arch/alpha/crypto_arch.h +++ /dev/null @@ -1,24 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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_SHA1_BLOCK_DATA_ORDER -#define HAVE_SHA1_BLOCK_GENERIC - -#endif diff --git a/src/lib/libcrypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/arch/alpha/opensslconf.h deleted file mode 100644 index 0ec9c25891..0000000000 --- a/src/lib/libcrypto/arch/alpha/opensslconf.h +++ /dev/null @@ -1,152 +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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef 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 */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT -#endif - -#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) -#define CONFIG_HEADER_BF_LOCL_H -#define 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 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#define 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 -#undef 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 */ diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc deleted file mode 100644 index b1a6563931..0000000000 --- a/src/lib/libcrypto/arch/amd64/Makefile.inc +++ /dev/null @@ -1,68 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.37 2025/02/14 12:01:58 jsing Exp $ - -# amd64-specific libcrypto build rules - -# all amd64 code generators use this -EXTRA_PL = ${LCRYPTO_SRC}/perlasm/x86_64-xlate.pl - -SRCS += crypto_cpu_caps.c - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-x86_64 -CFLAGS+= -DBSAES_ASM -SSLASM+= aes bsaes-x86_64 -CFLAGS+= -DVPAES_ASM -SSLASM+= aes vpaes-x86_64 -SSLASM+= aes aesni-x86_64 -# bn -CFLAGS+= -DOPENSSL_IA32_SSE2 -CFLAGS+= -DRSA_ASM -SSLASM+= bn modexp512-x86_64 -CFLAGS+= -DOPENSSL_BN_ASM_MONT -SSLASM+= bn x86_64-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT5 -SSLASM+= bn x86_64-mont5 - -# bn s2n-bignum -SRCS += bn_arch.c -SRCS += bignum_add.S -SRCS += bignum_cmadd.S -SRCS += bignum_cmul.S -SRCS += bignum_mul.S -SRCS += bignum_mul_4_8_alt.S -SRCS += bignum_mul_8_16_alt.S -SRCS += bignum_sqr.S -SRCS += bignum_sqr_4_8_alt.S -SRCS += bignum_sqr_8_16_alt.S -SRCS += bignum_sub.S -SRCS += word_clz.S - -# md5 -CFLAGS+= -DMD5_ASM -SRCS+= md5_amd64_generic.S -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-x86_64 -# rc4 -SSLASM+= rc4 rc4-x86_64 -# ripemd -# sha -SRCS+= sha1_amd64.c -SRCS+= sha1_amd64_generic.S -SRCS+= sha1_amd64_shani.S -SRCS+= sha256_amd64.c -SRCS+= sha256_amd64_generic.S -SRCS+= sha256_amd64_shani.S -SRCS+= sha512_amd64.c -SRCS+= sha512_amd64_generic.S - -.for dir f in ${SSLASM} -SRCS+= ${f}.S -GENERATED+=${f}.S -${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl ${EXTRA_PL} - (cd ${LCRYPTO_SRC}/${dir} ; \ - /usr/bin/perl ./asm/${f}.pl openbsd) > ${.TARGET} -.endfor - -CFLAGS+=-fret-clean diff --git a/src/lib/libcrypto/arch/amd64/crypto_arch.h b/src/lib/libcrypto/arch/amd64/crypto_arch.h deleted file mode 100644 index 951374250d..0000000000 --- a/src/lib/libcrypto/arch/amd64/crypto_arch.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.5 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. - */ - -#include - -#ifndef HEADER_CRYPTO_ARCH_H -#define HEADER_CRYPTO_ARCH_H - -#define HAVE_CRYPTO_CPU_CAPS_INIT -#define HAVE_CRYPTO_CPU_CAPS_IA32 - -#ifndef __ASSEMBLER__ -extern uint64_t crypto_cpu_caps_amd64; -#endif - -#define CRYPTO_CPU_CAPS_AMD64_SHA (1ULL << 0) - -#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/amd64/crypto_cpu_caps.c b/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c deleted file mode 100644 index 63b7b64cda..0000000000 --- a/src/lib/libcrypto/arch/amd64/crypto_cpu_caps.c +++ /dev/null @@ -1,134 +0,0 @@ -/* $OpenBSD: crypto_cpu_caps.c,v 1.4 2024/11/16 13:05:35 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 "crypto_arch.h" -#include "x86_arch.h" - -/* Legacy architecture specific capabilities, used by perlasm. */ -uint64_t OPENSSL_ia32cap_P; - -/* Machine dependent CPU capabilities. */ -uint64_t crypto_cpu_caps_amd64; - -/* 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, max_cpuid; - uint64_t caps = 0; - - cpuid(0, &eax, &ebx, &ecx, &edx); - - max_cpuid = eax; - - /* "GenuineIntel" in little endian. */ - if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) - caps |= CPUCAP_MASK_INTEL; - - if (max_cpuid < 1) - return; - - cpuid(1, &eax, NULL, &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; - } - - if (max_cpuid >= 7) { - cpuid(7, NULL, &ebx, NULL, NULL); - - /* Intel SHA extensions feature bit - ebx[29]. */ - if (((ebx >> 29) & 1) != 0) - crypto_cpu_caps_amd64 |= CRYPTO_CPU_CAPS_AMD64_SHA; - } - - /* 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/amd64/opensslconf.h b/src/lib/libcrypto/arch/amd64/opensslconf.h deleted file mode 100644 index cc193762f1..0000000000 --- a/src/lib/libcrypto/arch/amd64/opensslconf.h +++ /dev/null @@ -1,149 +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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef BN_LLONG - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/arm/Makefile.inc b/src/lib/libcrypto/arch/arm/Makefile.inc deleted file mode 100644 index e078c51d98..0000000000 --- a/src/lib/libcrypto/arch/arm/Makefile.inc +++ /dev/null @@ -1,28 +0,0 @@ -# $oPenBSD: Makefile.inc,v 1.2 2014/05/02 18:21:39 miod Exp $ - -# arm-specific libcrypto build rules - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-armv4 -# bn -CFLAGS+= -DOPENSSL_BN_ASM_MONT -SSLASM+= bn armv4-mont -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-armv4 -# sha -SSLASM+= sha sha1-armv4-large -SSLASM+= sha sha256-armv4 -SSLASM+= sha sha512-armv4 - -.for dir f in ${SSLASM} -SRCS+= ${f}.S -GENERATED+=${f}.S -${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${f}.pl void ${.TARGET} > ${.TARGET} -.endfor - -CFLAGS+= -DOPENSSL_CPUID_OBJ -SRCS+= armv4cpuid.S armcap.c diff --git a/src/lib/libcrypto/arch/arm/arm_arch.h b/src/lib/libcrypto/arch/arm/arm_arch.h deleted file mode 100644 index 5ac3b935f1..0000000000 --- a/src/lib/libcrypto/arch/arm/arm_arch.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $OpenBSD: arm_arch.h,v 1.1 2022/03/23 15:13:31 tb Exp $ */ -#ifndef __ARM_ARCH_H__ -#define __ARM_ARCH_H__ - -#if !defined(__ARM_ARCH__) -# if defined(__CC_ARM) -# define __ARM_ARCH__ __TARGET_ARCH_ARM -# if defined(__BIG_ENDIAN) -# define __ARMEB__ -# else -# define __ARMEL__ -# endif -# elif defined(__GNUC__) - /* - * Why doesn't gcc define __ARM_ARCH__? Instead it defines - * bunch of below macros. See all_architectures[] table in - * gcc/config/arm/arm.c. On a side note it defines - * __ARMEL__/__ARMEB__ for little-/big-endian. - */ -# if defined(__ARM_ARCH) -# define __ARM_ARCH__ __ARM_ARCH -# elif defined(__ARM_ARCH_8A__) -# define __ARM_ARCH__ 8 -# elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ - defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \ - defined(__ARM_ARCH_7EM__) -# define __ARM_ARCH__ 7 -# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ - defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__) || \ - defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__) || \ - defined(__ARM_ARCH_6T2__) -# define __ARM_ARCH__ 6 -# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \ - defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__) || \ - defined(__ARM_ARCH_5TEJ__) -# define __ARM_ARCH__ 5 -# elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) -# define __ARM_ARCH__ 4 -# else -# error "unsupported ARM architecture" -# endif -# endif -#endif - -#if !defined(__ASSEMBLER__) -extern unsigned int OPENSSL_armcap_P; - -#define ARMV7_NEON (1<<0) -#define ARMV8_AES (1<<1) -#define ARMV8_SHA1 (1<<2) -#define ARMV8_SHA256 (1<<3) -#define ARMV8_PMULL (1<<4) -#endif - -#if defined(__OpenBSD__) -#define __STRICT_ALIGNMENT -#endif - -#endif diff --git a/src/lib/libcrypto/arch/arm/armcap.c b/src/lib/libcrypto/arch/arm/armcap.c deleted file mode 100644 index 0238195397..0000000000 --- a/src/lib/libcrypto/arch/arm/armcap.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: armcap.c,v 1.3 2024/08/29 03:30:05 deraadt Exp $ */ -#include -#include -#include -#include -#include -#include - -#include "arm_arch.h" - -unsigned int OPENSSL_armcap_P; - -#if __ARM_ARCH__ >= 7 -static sigset_t all_masked; - -static sigjmp_buf ill_jmp; - -static void -ill_handler(int sig) -{ - siglongjmp(ill_jmp, sig); -} - -/* - * Following subroutines could have been inlined, but it's not all - * ARM compilers support inline assembler... - */ -void _armv7_neon_probe(void); -void _armv8_aes_probe(void); -void _armv8_sha1_probe(void); -void _armv8_sha256_probe(void); -void _armv8_pmull_probe(void); -#endif - -void -OPENSSL_cpuid_setup(void) -{ -#if __ARM_ARCH__ >= 7 - struct sigaction ill_oact, ill_act; - sigset_t oset; -#endif - static int trigger = 0; - - if (trigger) - return; - trigger = 1; - - OPENSSL_armcap_P = 0; - -#if __ARM_ARCH__ >= 7 - sigfillset(&all_masked); - sigdelset(&all_masked, SIGILL); - sigdelset(&all_masked, SIGTRAP); - sigdelset(&all_masked, SIGFPE); - sigdelset(&all_masked, SIGBUS); - sigdelset(&all_masked, SIGSEGV); - - memset(&ill_act, 0, sizeof(ill_act)); - ill_act.sa_handler = ill_handler; - ill_act.sa_mask = all_masked; - - sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset); - sigaction(SIGILL, &ill_act, &ill_oact); - - if (sigsetjmp(ill_jmp, 1) == 0) { - _armv7_neon_probe(); - OPENSSL_armcap_P |= ARMV7_NEON; - if (sigsetjmp(ill_jmp, 1) == 0) { - _armv8_pmull_probe(); - OPENSSL_armcap_P |= ARMV8_PMULL | ARMV8_AES; - } else if (sigsetjmp(ill_jmp, 1) == 0) { - _armv8_aes_probe(); - OPENSSL_armcap_P |= ARMV8_AES; - } - if (sigsetjmp(ill_jmp, 1) == 0) { - _armv8_sha1_probe(); - OPENSSL_armcap_P |= ARMV8_SHA1; - } - if (sigsetjmp(ill_jmp, 1) == 0) { - _armv8_sha256_probe(); - OPENSSL_armcap_P |= ARMV8_SHA256; - } - } - - sigaction (SIGILL, &ill_oact, NULL); - sigprocmask(SIG_SETMASK, &oset, NULL); -#endif -} diff --git a/src/lib/libcrypto/arch/arm/armv4cpuid.S b/src/lib/libcrypto/arch/arm/armv4cpuid.S deleted file mode 100644 index db0b54e496..0000000000 --- a/src/lib/libcrypto/arch/arm/armv4cpuid.S +++ /dev/null @@ -1,69 +0,0 @@ -#include "arm_arch.h" - -.text -#if defined(__thumb2__) && !defined(__APPLE__) -.syntax unified -.thumb -#else -.code 32 -#undef __thumb2__ -#endif - -#if __ARM_ARCH__>=7 -.arch armv7-a -.fpu neon - -.align 5 -.globl _armv7_neon_probe -.type _armv7_neon_probe,%function -_armv7_neon_probe: - vorr q0,q0,q0 - bx lr -.size _armv7_neon_probe,.-_armv7_neon_probe - -.globl _armv8_aes_probe -.type _armv8_aes_probe,%function -_armv8_aes_probe: -#if defined(__thumb2__) && !defined(__APPLE__) -.byte 0xb0,0xff,0x00,0x03 @ aese.8 q0,q0 -#else -.byte 0x00,0x03,0xb0,0xf3 @ aese.8 q0,q0 -#endif - bx lr -.size _armv8_aes_probe,.-_armv8_aes_probe - -.globl _armv8_sha1_probe -.type _armv8_sha1_probe,%function -_armv8_sha1_probe: -#if defined(__thumb2__) && !defined(__APPLE__) -.byte 0x00,0xef,0x40,0x0c @ sha1c.32 q0,q0,q0 -#else -.byte 0x40,0x0c,0x00,0xf2 @ sha1c.32 q0,q0,q0 -#endif - bx lr -.size _armv8_sha1_probe,.-_armv8_sha1_probe - -.globl _armv8_sha256_probe -.type _armv8_sha256_probe,%function -_armv8_sha256_probe: -#if defined(__thumb2__) && !defined(__APPLE__) -.byte 0x00,0xff,0x40,0x0c @ sha256h.32 q0,q0,q0 -#else -.byte 0x40,0x0c,0x00,0xf3 @ sha256h.32 q0,q0,q0 -#endif - bx lr -.size _armv8_sha256_probe,.-_armv8_sha256_probe -.globl _armv8_pmull_probe -.type _armv8_pmull_probe,%function -_armv8_pmull_probe: -#if defined(__thumb2__) && !defined(__APPLE__) -.byte 0xa0,0xef,0x00,0x0e @ vmull.p64 q0,d0,d0 -#else -.byte 0x00,0x0e,0xa0,0xf2 @ vmull.p64 q0,d0,d0 -#endif - bx lr -.size _armv8_pmull_probe,.-_armv8_pmull_probe -#endif - -.comm OPENSSL_armcap_P,4,4 -.hidden OPENSSL_armcap_P diff --git a/src/lib/libcrypto/arch/arm/crypto_arch.h b/src/lib/libcrypto/arch/arm/crypto_arch.h deleted file mode 100644 index 07d7829fe3..0000000000 --- a/src/lib/libcrypto/arch/arm/crypto_arch.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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 - -#ifndef OPENSSL_NO_ASM - -#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_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/arm/opensslconf.h b/src/lib/libcrypto/arch/arm/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/arm/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 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 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/hppa/Makefile.inc b/src/lib/libcrypto/arch/hppa/Makefile.inc deleted file mode 100644 index 11bfa4a5d3..0000000000 --- a/src/lib/libcrypto/arch/hppa/Makefile.inc +++ /dev/null @@ -1,24 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.26 2025/02/14 12:01:58 jsing Exp $ - -# hppa-specific libcrypto build rules - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-parisc aes-parisc -# bn -SSLASM+= bn parisc-mont parisc-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT -DBN_DIV2W -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-parisc ghash-parisc -# sha -SSLASM+= sha sha1-parisc sha1-parisc -SSLASM+= sha sha512-parisc sha256-parisc - -.for dir src dst in ${SSLASM} -SRCS+= ${dst}.S -GENERATED+=${dst}.S -${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${src}.pl 32 ${.TARGET} > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/hppa/crypto_arch.h b/src/lib/libcrypto/arch/hppa/crypto_arch.h deleted file mode 100644 index 08fcaca045..0000000000 --- a/src/lib/libcrypto/arch/hppa/crypto_arch.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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 - -#ifndef OPENSSL_NO_ASM - -#define HAVE_AES_ENCRYPT_INTERNAL -#define HAVE_AES_DECRYPT_INTERNAL - -#define HAVE_SHA1_BLOCK_DATA_ORDER -#define HAVE_SHA1_BLOCK_GENERIC - -#define HAVE_SHA256_BLOCK_DATA_ORDER -#define HAVE_SHA256_BLOCK_GENERIC - -#endif - -#endif diff --git a/src/lib/libcrypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/arch/hppa/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/hppa/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 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 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 -#undef 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 -#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 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 */ 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 */ diff --git a/src/lib/libcrypto/arch/m88k/crypto_arch.h b/src/lib/libcrypto/arch/m88k/crypto_arch.h deleted file mode 100644 index a3dd98d0ce..0000000000 --- a/src/lib/libcrypto/arch/m88k/crypto_arch.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.1 2024/08/11 13:02:39 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 - -#endif diff --git a/src/lib/libcrypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/arch/m88k/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/m88k/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 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 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/mips64/Makefile.inc b/src/lib/libcrypto/arch/mips64/Makefile.inc deleted file mode 100644 index 64e806289d..0000000000 --- a/src/lib/libcrypto/arch/mips64/Makefile.inc +++ /dev/null @@ -1,23 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.19 2025/02/14 12:01:58 jsing Exp $ - -# mips64-specific libcrypto build rules - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-mips aes-mips -# bn -SSLASM+= bn mips bn-mips -SSLASM+= bn mips-mont mips-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT -# sha -SSLASM+= sha sha1-mips sha1-mips -SSLASM+= sha sha512-mips sha256-mips -SSLASM+= sha sha512-mips sha512-mips - -.for dir src dst in ${SSLASM} -SRCS+= ${dst}.S -GENERATED+=${dst}.S -${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl - /usr/bin/env CC=${CC} /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${src}.pl 64 ${.TARGET} > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/mips64/crypto_arch.h b/src/lib/libcrypto/arch/mips64/crypto_arch.h deleted file mode 100644 index 07d7829fe3..0000000000 --- a/src/lib/libcrypto/arch/mips64/crypto_arch.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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 - -#ifndef OPENSSL_NO_ASM - -#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_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/mips64/opensslconf.h b/src/lib/libcrypto/arch/mips64/opensslconf.h deleted file mode 100644 index 36cdd2840b..0000000000 --- a/src/lib/libcrypto/arch/mips64/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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef 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 */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef 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 -#define 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 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#define 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 -#undef 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 */ diff --git a/src/lib/libcrypto/arch/powerpc/Makefile.inc b/src/lib/libcrypto/arch/powerpc/Makefile.inc deleted file mode 100644 index c5218e53f4..0000000000 --- a/src/lib/libcrypto/arch/powerpc/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.14 2025/02/14 12:01:58 jsing Exp $ - -# powerpc-specific libcrypto build rules - -# slower than C code -#CFLAGS+= -DAES_ASM -#SSLASM+= aes aes-ppc aes-ppc -# bn -SSLASM+= bn ppc bn-ppc -SSLASM+= bn ppc-mont ppc-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT -# sha -SSLASM+= sha sha1-ppc sha1-ppc -SSLASM+= sha sha512-ppc sha256-ppc - -.for dir src dst in ${SSLASM} -SRCS+= ${dst}.S -GENERATED+=${dst}.S -${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${src}.pl linux32 ${.TARGET} > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/powerpc/crypto_arch.h b/src/lib/libcrypto/arch/powerpc/crypto_arch.h deleted file mode 100644 index d2730af0fb..0000000000 --- a/src/lib/libcrypto/arch/powerpc/crypto_arch.h +++ /dev/null @@ -1,31 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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 - -#ifndef OPENSSL_NO_ASM - -#define HAVE_SHA1_BLOCK_DATA_ORDER -#define HAVE_SHA1_BLOCK_GENERIC - -#define HAVE_SHA256_BLOCK_DATA_ORDER -#define HAVE_SHA256_BLOCK_GENERIC - -#endif - -#endif diff --git a/src/lib/libcrypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/arch/powerpc/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/powerpc/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 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 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/powerpc64/Makefile.inc b/src/lib/libcrypto/arch/powerpc64/Makefile.inc deleted file mode 100644 index c309ab8b40..0000000000 --- a/src/lib/libcrypto/arch/powerpc64/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.16 2025/02/14 12:01:58 jsing Exp $ - -# powerpc-specific libcrypto build rules - -# slower than C code -#CFLAGS+= -DAES_ASM -#SSLASM+= aes aes-ppc aes-ppc -# bn -#SSLASM+= bn ppc bn-ppc -#SSLASM+= bn ppc-mont ppc-mont -#CFLAGS+= -DOPENSSL_BN_ASM_MONT -# sha -#SSLASM+= sha sha1-ppc sha1-ppc -#SSLASM+= sha sha512-ppc sha256-ppc - -.for dir src dst in ${SSLASM} -SRCS+= ${dst}.S -GENERATED+=${dst}.S -${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl - /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${src}.pl linux32 ${.TARGET} > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/powerpc64/crypto_arch.h b/src/lib/libcrypto/arch/powerpc64/crypto_arch.h deleted file mode 100644 index a3dd98d0ce..0000000000 --- a/src/lib/libcrypto/arch/powerpc64/crypto_arch.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.1 2024/08/11 13:02:39 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 - -#endif diff --git a/src/lib/libcrypto/arch/powerpc64/opensslconf.h b/src/lib/libcrypto/arch/powerpc64/opensslconf.h deleted file mode 100644 index cc193762f1..0000000000 --- a/src/lib/libcrypto/arch/powerpc64/opensslconf.h +++ /dev/null @@ -1,149 +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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef BN_LLONG - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/riscv64/Makefile.inc b/src/lib/libcrypto/arch/riscv64/Makefile.inc deleted file mode 100644 index 94cc03ed70..0000000000 --- a/src/lib/libcrypto/arch/riscv64/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.10 2024/03/29 07:24:09 jsing Exp $ - -# riscv64 libcrypto build rules diff --git a/src/lib/libcrypto/arch/riscv64/crypto_arch.h b/src/lib/libcrypto/arch/riscv64/crypto_arch.h deleted file mode 100644 index a3dd98d0ce..0000000000 --- a/src/lib/libcrypto/arch/riscv64/crypto_arch.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.1 2024/08/11 13:02:39 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 - -#endif diff --git a/src/lib/libcrypto/arch/riscv64/opensslconf.h b/src/lib/libcrypto/arch/riscv64/opensslconf.h deleted file mode 100644 index 731b06aecc..0000000000 --- a/src/lib/libcrypto/arch/riscv64/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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef 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 */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/sh/crypto_arch.h b/src/lib/libcrypto/arch/sh/crypto_arch.h deleted file mode 100644 index a3dd98d0ce..0000000000 --- a/src/lib/libcrypto/arch/sh/crypto_arch.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.1 2024/08/11 13:02:39 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 - -#endif diff --git a/src/lib/libcrypto/arch/sh/opensslconf.h b/src/lib/libcrypto/arch/sh/opensslconf.h deleted file mode 100644 index a5d26b6fdc..0000000000 --- a/src/lib/libcrypto/arch/sh/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 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 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 -#undef 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 -#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 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 */ diff --git a/src/lib/libcrypto/arch/sparc64/Makefile.inc b/src/lib/libcrypto/arch/sparc64/Makefile.inc deleted file mode 100644 index cbf63e033e..0000000000 --- a/src/lib/libcrypto/arch/sparc64/Makefile.inc +++ /dev/null @@ -1,23 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.21 2025/02/14 12:01:58 jsing Exp $ - -# sparc64-specific libcrypto build rules - -# aes -CFLAGS+= -DAES_ASM -SSLASM+= aes aes-sparcv9 aes-sparcv9 -# bn -# modes -CFLAGS+= -DGHASH_ASM -SSLASM+= modes ghash-sparcv9 ghash-sparcv9 -# sha -SSLASM+= sha sha1-sparcv9 sha1-sparcv9 -SSLASM+= sha sha512-sparcv9 sha256-sparcv9 -SSLASM+= sha sha512-sparcv9 sha512-sparcv9 - -.for dir src dst in ${SSLASM} -SRCS+= ${dst}.S -GENERATED+=${dst}.S -${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl - /usr/bin/env CC=${CC} /usr/bin/perl \ - ${LCRYPTO_SRC}/${dir}/asm/${src}.pl ${.TARGET} -m64 > ${.TARGET} -.endfor diff --git a/src/lib/libcrypto/arch/sparc64/crypto_arch.h b/src/lib/libcrypto/arch/sparc64/crypto_arch.h deleted file mode 100644 index 251957a5bc..0000000000 --- a/src/lib/libcrypto/arch/sparc64/crypto_arch.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: crypto_arch.h,v 1.2 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 - -#ifndef OPENSSL_NO_ASM - -#define HAVE_AES_ENCRYPT_INTERNAL -#define HAVE_AES_DECRYPT_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/sparc64/opensslconf.h b/src/lib/libcrypto/arch/sparc64/opensslconf.h deleted file mode 100644 index 36cdd2840b..0000000000 --- a/src/lib/libcrypto/arch/sparc64/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. - */ -#define RC4_CHUNK unsigned long -#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 -#undef 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 */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef 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 -#define 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 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#define 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 -#undef 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