From 98287b7cd5d64488bbaf57088225f91bd8e8a7f9 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sun, 7 Sep 2025 06:28:03 +0000 Subject: Remove BN_DIV2W. The BN_DIV2W define provides a code path for double word division via the C compiler, which is only enabled on hppa. Simplify the code and mop this up. ok tb@ --- src/lib/libcrypto/arch/hppa/Makefile.inc | 4 ++-- src/lib/libcrypto/bn/bn.h | 15 +-------------- src/lib/libcrypto/bn/bn_div.c | 13 +------------ 3 files changed, 4 insertions(+), 28 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/arch/hppa/Makefile.inc b/src/lib/libcrypto/arch/hppa/Makefile.inc index 11bfa4a5d3..bb8f1498dd 100644 --- a/src/lib/libcrypto/arch/hppa/Makefile.inc +++ b/src/lib/libcrypto/arch/hppa/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.26 2025/02/14 12:01:58 jsing Exp $ +# $OpenBSD: Makefile.inc,v 1.27 2025/09/07 06:28:03 jsing Exp $ # hppa-specific libcrypto build rules @@ -7,7 +7,7 @@ CFLAGS+= -DAES_ASM SSLASM+= aes aes-parisc aes-parisc # bn SSLASM+= bn parisc-mont parisc-mont -CFLAGS+= -DOPENSSL_BN_ASM_MONT -DBN_DIV2W +CFLAGS+= -DOPENSSL_BN_ASM_MONT # modes CFLAGS+= -DGHASH_ASM SSLASM+= modes ghash-parisc ghash-parisc diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 7c3c0b142f..f222e9e178 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn.h,v 1.80 2025/03/09 15:22:40 tb Exp $ */ +/* $OpenBSD: bn.h,v 1.81 2025/09/07 06:28:03 jsing Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -138,19 +138,6 @@ extern "C" { #endif -/* This next option uses the C libraries (2 word)/(1 word) function. - * If it is not defined, I use my C version (which is slower). - * The reason for this flag is that when the particular C compiler - * library routine is used, and the library is linked with a different - * compiler, the library is missing. This mostly happens when the - * library is built with gcc and then linked using normal cc. This would - * be a common occurrence because gcc normally produces code that is - * 2 times faster than system compilers for the big number stuff. - * For machines with only one compiler (or shared libraries), this should - * be on. Again this in only really a problem on machines - * using "long long's", are 32bit, and are not using my assembler code. */ -/* #define BN_DIV2W */ - #ifdef _LP64 #undef BN_LLONG #define BN_ULONG unsigned long diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index e8eef4ed92..0a914db752 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_div.c,v 1.43 2025/08/30 07:54:27 jsing Exp $ */ +/* $OpenBSD: bn_div.c,v 1.44 2025/09/07 06:28:03 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -71,16 +71,6 @@ BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0); #ifndef HAVE_BN_DIV_WORDS -#if defined(BN_LLONG) && defined(BN_DIV2W) - -BN_ULONG -bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) -{ - return ((BN_ULONG)(((((BN_ULLONG)h) << BN_BITS2)|l)/(BN_ULLONG)d)); -} - -#else - /* Divide h,l by d and return the result. */ /* I need to test this some more :-( */ BN_ULONG @@ -148,7 +138,6 @@ bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) ret |= q; return (ret); } -#endif /* !defined(BN_LLONG) && defined(BN_DIV2W) */ #endif /* -- cgit v1.2.3-55-g6feb