summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2025-09-07 06:28:03 +0000
committerjsing <>2025-09-07 06:28:03 +0000
commit98287b7cd5d64488bbaf57088225f91bd8e8a7f9 (patch)
treed754d9b930316cfd9ea844b18cd7f5b0b2a74ed1 /src
parent9283c4361ce1f1a39a1f03c588c3d1a3da64025e (diff)
downloadopenbsd-98287b7cd5d64488bbaf57088225f91bd8e8a7f9.tar.gz
openbsd-98287b7cd5d64488bbaf57088225f91bd8e8a7f9.tar.bz2
openbsd-98287b7cd5d64488bbaf57088225f91bd8e8a7f9.zip
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@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/arch/hppa/Makefile.inc4
-rw-r--r--src/lib/libcrypto/bn/bn.h15
-rw-r--r--src/lib/libcrypto/bn/bn_div.c13
3 files changed, 4 insertions, 28 deletions
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 @@
1# $OpenBSD: Makefile.inc,v 1.26 2025/02/14 12:01:58 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.27 2025/09/07 06:28:03 jsing Exp $
2 2
3# hppa-specific libcrypto build rules 3# hppa-specific libcrypto build rules
4 4
@@ -7,7 +7,7 @@ CFLAGS+= -DAES_ASM
7SSLASM+= aes aes-parisc aes-parisc 7SSLASM+= aes aes-parisc aes-parisc
8# bn 8# bn
9SSLASM+= bn parisc-mont parisc-mont 9SSLASM+= bn parisc-mont parisc-mont
10CFLAGS+= -DOPENSSL_BN_ASM_MONT -DBN_DIV2W 10CFLAGS+= -DOPENSSL_BN_ASM_MONT
11# modes 11# modes
12CFLAGS+= -DGHASH_ASM 12CFLAGS+= -DGHASH_ASM
13SSLASM+= modes ghash-parisc ghash-parisc 13SSLASM+= 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 @@
1/* $OpenBSD: bn.h,v 1.80 2025/03/09 15:22:40 tb Exp $ */ 1/* $OpenBSD: bn.h,v 1.81 2025/09/07 06:28:03 jsing Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -138,19 +138,6 @@
138extern "C" { 138extern "C" {
139#endif 139#endif
140 140
141/* This next option uses the C libraries (2 word)/(1 word) function.
142 * If it is not defined, I use my C version (which is slower).
143 * The reason for this flag is that when the particular C compiler
144 * library routine is used, and the library is linked with a different
145 * compiler, the library is missing. This mostly happens when the
146 * library is built with gcc and then linked using normal cc. This would
147 * be a common occurrence because gcc normally produces code that is
148 * 2 times faster than system compilers for the big number stuff.
149 * For machines with only one compiler (or shared libraries), this should
150 * be on. Again this in only really a problem on machines
151 * using "long long's", are 32bit, and are not using my assembler code. */
152/* #define BN_DIV2W */
153
154#ifdef _LP64 141#ifdef _LP64
155#undef BN_LLONG 142#undef BN_LLONG
156#define BN_ULONG unsigned long 143#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 @@
1/* $OpenBSD: bn_div.c,v 1.43 2025/08/30 07:54:27 jsing Exp $ */ 1/* $OpenBSD: bn_div.c,v 1.44 2025/09/07 06:28:03 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -71,16 +71,6 @@
71BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0); 71BN_ULONG bn_div_3_words(const BN_ULONG *m, BN_ULONG d1, BN_ULONG d0);
72 72
73#ifndef HAVE_BN_DIV_WORDS 73#ifndef HAVE_BN_DIV_WORDS
74#if defined(BN_LLONG) && defined(BN_DIV2W)
75
76BN_ULONG
77bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
78{
79 return ((BN_ULONG)(((((BN_ULLONG)h) << BN_BITS2)|l)/(BN_ULLONG)d));
80}
81
82#else
83
84/* Divide h,l by d and return the result. */ 74/* Divide h,l by d and return the result. */
85/* I need to test this some more :-( */ 75/* I need to test this some more :-( */
86BN_ULONG 76BN_ULONG
@@ -148,7 +138,6 @@ bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
148 ret |= q; 138 ret |= q;
149 return (ret); 139 return (ret);
150} 140}
151#endif /* !defined(BN_LLONG) && defined(BN_DIV2W) */
152#endif 141#endif
153 142
154/* 143/*