summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-03-02 09:27:32 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-03-02 09:27:32 +0000
commita2a4fd283e1f93064e05a39b367a23ddfb059c2b (patch)
tree96ce91e407b905ad9d3a2b08fb4e12b524d14a37 /lib/libcrypto
parent96ad4157c52e9d25b8a58afbd251a6b582d8217f (diff)
Make BN_mod_exp2_mont() and BN_mod_exp_mont_word() internal
The former could be useful but nothing uses it. The latter is a dangerous implementation detail of Montgomery exponentiation that should never have been leaked out of the library. Fix this. ok jsing
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/Symbols.list2
-rw-r--r--lib/libcrypto/Symbols.namespace2
-rw-r--r--lib/libcrypto/bn/bn.h7
-rw-r--r--lib/libcrypto/bn/bn_exp.c4
-rw-r--r--lib/libcrypto/bn/bn_local.h8
-rw-r--r--lib/libcrypto/hidden/openssl/bn.h4
6 files changed, 10 insertions, 17 deletions
diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list
index c439138eb7b..5099a6f1f81 100644
--- a/lib/libcrypto/Symbols.list
+++ b/lib/libcrypto/Symbols.list
@@ -407,10 +407,8 @@ BN_mask_bits
BN_mod_add
BN_mod_add_quick
BN_mod_exp
-BN_mod_exp2_mont
BN_mod_exp_mont
BN_mod_exp_mont_consttime
-BN_mod_exp_mont_word
BN_mod_inverse
BN_mod_lshift
BN_mod_lshift1
diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace
index 772fb1876ba..aff315a3052 100644
--- a/lib/libcrypto/Symbols.namespace
+++ b/lib/libcrypto/Symbols.namespace
@@ -2221,8 +2221,6 @@ _libre_BN_lshift
_libre_BN_lshift1
_libre_BN_exp
_libre_BN_mod_exp_mont_consttime
-_libre_BN_mod_exp_mont_word
-_libre_BN_mod_exp2_mont
_libre_BN_mask_bits
_libre_BN_print_fp
_libre_BN_print
diff --git a/lib/libcrypto/bn/bn.h b/lib/libcrypto/bn/bn.h
index 39a5180c2ca..79210752940 100644
--- a/lib/libcrypto/bn/bn.h
+++ b/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn.h,v 1.76 2024/03/02 09:24:59 tb Exp $ */
+/* $OpenBSD: bn.h,v 1.77 2024/03/02 09:27:31 tb Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -391,11 +391,6 @@ int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
#endif
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
-int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
-int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
- const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
- BN_CTX *ctx, BN_MONT_CTX *m_ctx);
int BN_mask_bits(BIGNUM *a, int n);
int BN_print_fp(FILE *fp, const BIGNUM *a);
diff --git a/lib/libcrypto/bn/bn_exp.c b/lib/libcrypto/bn/bn_exp.c
index e4e06db1495..04852424f7e 100644
--- a/lib/libcrypto/bn/bn_exp.c
+++ b/lib/libcrypto/bn/bn_exp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_exp.c,v 1.51 2024/03/02 09:24:59 tb Exp $ */
+/* $OpenBSD: bn_exp.c,v 1.52 2024/03/02 09:27:31 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -961,7 +961,6 @@ err:
BN_CTX_end(ctx);
return (ret);
}
-LCRYPTO_ALIAS(BN_mod_exp_mont_word);
int
BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
@@ -1353,4 +1352,3 @@ err:
BN_CTX_end(ctx);
return (ret);
}
-LCRYPTO_ALIAS(BN_mod_exp2_mont);
diff --git a/lib/libcrypto/bn/bn_local.h b/lib/libcrypto/bn/bn_local.h
index e5c4cddc927..5acb546d078 100644
--- a/lib/libcrypto/bn/bn_local.h
+++ b/lib/libcrypto/bn/bn_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_local.h,v 1.39 2024/03/02 09:24:59 tb Exp $ */
+/* $OpenBSD: bn_local.h,v 1.40 2024/03/02 09:27:31 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -308,6 +308,12 @@ int BN_div_ct(BIGNUM *q, BIGNUM *r, const BIGNUM *n, const BIGNUM *d,
int BN_mod_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
int BN_mod_nonct(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
+ const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
+ BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx);
diff --git a/lib/libcrypto/hidden/openssl/bn.h b/lib/libcrypto/hidden/openssl/bn.h
index 1aa5b10d9d6..f6f00cf7664 100644
--- a/lib/libcrypto/hidden/openssl/bn.h
+++ b/lib/libcrypto/hidden/openssl/bn.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn.h,v 1.5 2024/03/02 09:24:59 tb Exp $ */
+/* $OpenBSD: bn.h,v 1.6 2024/03/02 09:27:31 tb Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
@@ -97,8 +97,6 @@ LCRYPTO_USED(BN_lshift);
LCRYPTO_USED(BN_lshift1);
LCRYPTO_USED(BN_exp);
LCRYPTO_USED(BN_mod_exp_mont_consttime);
-LCRYPTO_USED(BN_mod_exp_mont_word);
-LCRYPTO_USED(BN_mod_exp2_mont);
LCRYPTO_USED(BN_mask_bits);
LCRYPTO_USED(BN_print_fp);
LCRYPTO_USED(BN_print);