diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2023-02-19 13:33:24 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2023-02-19 13:33:24 +0000 |
commit | d12b2bd42eeb676f57305cd0fa7889fdd5b8d96b (patch) | |
tree | 43b50db43ba6e9a28181ca17a28fe033480bb431 /lib | |
parent | d3300db583eda772a920bff77825edaac27400a3 (diff) |
Move BN_MONT_CTX_copy().
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/bn/bn_mont.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/libcrypto/bn/bn_mont.c b/lib/libcrypto/bn/bn_mont.c index cd75a1ec138..0d110d5ca48 100644 --- a/lib/libcrypto/bn/bn_mont.c +++ b/lib/libcrypto/bn/bn_mont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mont.c,v 1.38 2023/02/19 13:27:49 jsing Exp $ */ +/* $OpenBSD: bn_mont.c,v 1.39 2023/02/19 13:33:23 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -172,6 +172,24 @@ BN_MONT_CTX_free(BN_MONT_CTX *mont) free(mont); } +BN_MONT_CTX * +BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) +{ + if (to == from) + return (to); + + if (!BN_copy(&(to->RR), &(from->RR))) + return NULL; + if (!BN_copy(&(to->N), &(from->N))) + return NULL; + if (!BN_copy(&(to->Ni), &(from->Ni))) + return NULL; + to->ri = from->ri; + to->n0[0] = from->n0[0]; + to->n0[1] = from->n0[1]; + return (to); +} + int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) { @@ -306,24 +324,6 @@ err: } BN_MONT_CTX * -BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) -{ - if (to == from) - return (to); - - if (!BN_copy(&(to->RR), &(from->RR))) - return NULL; - if (!BN_copy(&(to->N), &(from->N))) - return NULL; - if (!BN_copy(&(to->Ni), &(from->Ni))) - return NULL; - to->ri = from->ri; - to->n0[0] = from->n0[0]; - to->n0[1] = from->n0[1]; - return (to); -} - -BN_MONT_CTX * BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, const BIGNUM *mod, BN_CTX *ctx) { |