From 417eb2ee99ee039b1f6aaaee5f1407ca5e4f94cf Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 11 Jun 2025 04:08:16 +0000 Subject: Remove BF_PTR In bf_local.h r1.2, openssl/opensslconf.h was pulled out of the HEADER_BF_LOCL_H header guard, so BF_PTR was never defined from opensslfeatures.h. Thus, alpha, mips64, sparc64 haven't used the path that is supposedly optimized for them. On the M3k the speed gain of bf-cbc with BF_PTR is roughly 5%, so not really great. This is blowfish, so I don't think we want to carry complications for alpha and mips64 only. ok jsing kenjiro --- src/lib/libcrypto/arch/aarch64/opensslconf.h | 5 --- src/lib/libcrypto/arch/alpha/opensslconf.h | 5 --- src/lib/libcrypto/arch/amd64/opensslconf.h | 5 --- src/lib/libcrypto/arch/arm/opensslconf.h | 5 --- src/lib/libcrypto/arch/hppa/opensslconf.h | 5 --- src/lib/libcrypto/arch/i386/opensslconf.h | 5 --- src/lib/libcrypto/arch/m88k/opensslconf.h | 5 --- src/lib/libcrypto/arch/mips64/opensslconf.h | 5 --- src/lib/libcrypto/arch/powerpc/opensslconf.h | 5 --- src/lib/libcrypto/arch/powerpc64/opensslconf.h | 5 --- src/lib/libcrypto/arch/riscv64/opensslconf.h | 5 --- src/lib/libcrypto/arch/sh/opensslconf.h | 5 --- src/lib/libcrypto/arch/sparc64/opensslconf.h | 5 --- src/lib/libcrypto/bf/bf_local.h | 47 ++------------------------ 14 files changed, 3 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/arch/aarch64/opensslconf.h b/src/lib/libcrypto/arch/aarch64/opensslconf.h index 3aaa6bd0b8..49cdf69a38 100644 --- a/src/lib/libcrypto/arch/aarch64/opensslconf.h +++ b/src/lib/libcrypto/arch/aarch64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/arch/alpha/opensslconf.h index 47756e45ef..4df543da45 100644 --- a/src/lib/libcrypto/arch/alpha/opensslconf.h +++ b/src/lib/libcrypto/arch/alpha/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/amd64/opensslconf.h b/src/lib/libcrypto/arch/amd64/opensslconf.h index 3aaa6bd0b8..49cdf69a38 100644 --- a/src/lib/libcrypto/arch/amd64/opensslconf.h +++ b/src/lib/libcrypto/arch/amd64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/arm/opensslconf.h b/src/lib/libcrypto/arch/arm/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/arm/opensslconf.h +++ b/src/lib/libcrypto/arch/arm/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/arch/hppa/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/hppa/opensslconf.h +++ b/src/lib/libcrypto/arch/hppa/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/i386/opensslconf.h b/src/lib/libcrypto/arch/i386/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/i386/opensslconf.h +++ b/src/lib/libcrypto/arch/i386/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/arch/m88k/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/m88k/opensslconf.h +++ b/src/lib/libcrypto/arch/m88k/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/mips64/opensslconf.h b/src/lib/libcrypto/arch/mips64/opensslconf.h index 47756e45ef..4df543da45 100644 --- a/src/lib/libcrypto/arch/mips64/opensslconf.h +++ b/src/lib/libcrypto/arch/mips64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/arch/powerpc/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/powerpc/opensslconf.h +++ b/src/lib/libcrypto/arch/powerpc/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/powerpc64/opensslconf.h b/src/lib/libcrypto/arch/powerpc64/opensslconf.h index 3aaa6bd0b8..49cdf69a38 100644 --- a/src/lib/libcrypto/arch/powerpc64/opensslconf.h +++ b/src/lib/libcrypto/arch/powerpc64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/riscv64/opensslconf.h b/src/lib/libcrypto/arch/riscv64/opensslconf.h index 3aaa6bd0b8..49cdf69a38 100644 --- a/src/lib/libcrypto/arch/riscv64/opensslconf.h +++ b/src/lib/libcrypto/arch/riscv64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/sh/opensslconf.h b/src/lib/libcrypto/arch/sh/opensslconf.h index ee2111390a..639b15e8f4 100644 --- a/src/lib/libcrypto/arch/sh/opensslconf.h +++ b/src/lib/libcrypto/arch/sh/opensslconf.h @@ -27,11 +27,6 @@ #define BN_LLONG #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 diff --git a/src/lib/libcrypto/arch/sparc64/opensslconf.h b/src/lib/libcrypto/arch/sparc64/opensslconf.h index 47756e45ef..4df543da45 100644 --- a/src/lib/libcrypto/arch/sparc64/opensslconf.h +++ b/src/lib/libcrypto/arch/sparc64/opensslconf.h @@ -27,11 +27,6 @@ #undef BN_LLONG #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 diff --git a/src/lib/libcrypto/bf/bf_local.h b/src/lib/libcrypto/bf/bf_local.h index 8fc5a5dbd8..2fe65eb85c 100644 --- a/src/lib/libcrypto/bf/bf_local.h +++ b/src/lib/libcrypto/bf/bf_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_local.h,v 1.3 2024/03/27 11:54:29 jsing Exp $ */ +/* $OpenBSD: bf_local.h,v 1.4 2025/06/11 04:08:16 tb Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -56,11 +56,11 @@ * [including the GNU Public Licence.] */ -#include /* BF_PTR */ - #ifndef HEADER_BF_LOCL_H #define HEADER_BF_LOCL_H +#include + /* NOTE - c is not incremented as per n2l */ #define n2ln(c,l1,l2,n) { \ c+=n; \ @@ -104,46 +104,6 @@ *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) -/* This is actually a big endian algorithm, the most significant byte - * is used to lookup array 0 */ - -#if defined(BF_PTR) - -#ifndef BF_LONG_LOG2 -#define BF_LONG_LOG2 2 /* default to BF_LONG being 32 bits */ -#endif -#define BF_M (0xFF<>BF_i)&BF_M gets folded into a single instruction, namely - * rlwinm. So let'em double-check if their compiler does it. - */ - -#define BF_ENC(LL,R,S,P) ( \ - LL^=P, \ - LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ - *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ - *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ - *(BF_LONG *)((unsigned char *)&(S[768])+((R<>24)&0xff)] + \ @@ -151,6 +111,5 @@ S[0x0200+((int)(R>> 8)&0xff)])+ \ S[0x0300+((int)(R )&0xff)])&0xffffffffL \ ) -#endif #endif -- cgit v1.2.3-55-g6feb