summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mont.c
diff options
context:
space:
mode:
authortb <>2021-12-04 16:05:46 +0000
committertb <>2021-12-04 16:05:46 +0000
commit76931b287b8254b40aa7ca868c21aaada115121e (patch)
tree0ac6879a08fe9d24d0fb77b0847596847a505456 /src/lib/libcrypto/bn/bn_mont.c
parentb51b96fb8e2e7b9cefac77dd8f6566e31a19a9a8 (diff)
downloadopenbsd-76931b287b8254b40aa7ca868c21aaada115121e.tar.gz
openbsd-76931b287b8254b40aa7ca868c21aaada115121e.tar.bz2
openbsd-76931b287b8254b40aa7ca868c21aaada115121e.zip
Implement the BN_to_montgomery() macro as a function
ok inoguchi jsing
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mont.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index eeac046826..45e312a3a6 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mont.c,v 1.26 2017/01/21 11:00:46 beck Exp $ */ 1/* $OpenBSD: bn_mont.c,v 1.27 2021/12/04 16:05:46 tb 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 *
@@ -175,6 +175,12 @@ err:
175 return (ret); 175 return (ret);
176} 176}
177 177
178int
179BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx)
180{
181 return BN_mod_mul_montgomery(r, a, &mont->RR, mont, ctx);
182}
183
178#ifdef MONT_WORD 184#ifdef MONT_WORD
179static int 185static int
180BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 186BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)