summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2022-11-14 18:28:29 +0000
committerschwarze <>2022-11-14 18:28:29 +0000
commit7c35dbdb9ad546b367605eed6db9f70bd77d2e96 (patch)
tree00581d05088db3844421134e11181c20325f85c3 /src
parent109899f1b36632f5f1c469c4f562df69585eb21e (diff)
downloadopenbsd-7c35dbdb9ad546b367605eed6db9f70bd77d2e96.tar.gz
openbsd-7c35dbdb9ad546b367605eed6db9f70bd77d2e96.tar.bz2
openbsd-7c35dbdb9ad546b367605eed6db9f70bd77d2e96.zip
document BN_reciprocal(3)
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/BN_mod_mul_reciprocal.365
1 files changed, 55 insertions, 10 deletions
diff --git a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3
index 77c2932739..f28ade2a41 100644
--- a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3
+++ b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3
@@ -1,7 +1,25 @@
1.\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.11 2021/11/30 18:34:35 tb Exp $ 1.\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.12 2022/11/14 18:28:29 schwarze Exp $
2.\" OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000 2.\" full merge up to: OpenSSL 6859cf74 Sep 25 13:33:28 2002 +0000
3.\" selective merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 4.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 5.\" This file is a derived work.
6.\" The changes are covered by the following Copyright and license:
7.\"
8.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
9.\"
10.\" Permission to use, copy, modify, and distribute this software for any
11.\" purpose with or without fee is hereby granted, provided that the above
12.\" copyright notice and this permission notice appear in all copies.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21.\"
22.\" The original file was written by Ulf Moeller <ulf@openssl.org>.
5.\" Copyright (c) 2000 The OpenSSL Project. All rights reserved. 23.\" Copyright (c) 2000 The OpenSSL Project. All rights reserved.
6.\" 24.\"
7.\" Redistribution and use in source and binary forms, with or without 25.\" Redistribution and use in source and binary forms, with or without
@@ -48,7 +66,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 68.\"
51.Dd $Mdocdate: November 30 2021 $ 69.Dd $Mdocdate: November 14 2022 $
52.Dt BN_MOD_MUL_RECIPROCAL 3 70.Dt BN_MOD_MUL_RECIPROCAL 3
53.Os 71.Os
54.Sh NAME 72.Sh NAME
@@ -57,7 +75,8 @@
57.Nm BN_RECP_CTX_init , 75.Nm BN_RECP_CTX_init ,
58.Nm BN_RECP_CTX_free , 76.Nm BN_RECP_CTX_free ,
59.Nm BN_RECP_CTX_set , 77.Nm BN_RECP_CTX_set ,
60.Nm BN_div_recp 78.Nm BN_div_recp ,
79.Nm BN_reciprocal
61.Nd modular multiplication using reciprocal 80.Nd modular multiplication using reciprocal
62.Sh SYNOPSIS 81.Sh SYNOPSIS
63.In openssl/bn.h 82.In openssl/bn.h
@@ -95,6 +114,13 @@
95.Fa "BN_RECP_CTX *recp" 114.Fa "BN_RECP_CTX *recp"
96.Fa "BN_CTX *ctx" 115.Fa "BN_CTX *ctx"
97.Fc 116.Fc
117.Ft int
118.Fo BN_reciprocal
119.Fa "BIGNUM *r"
120.Fa "const BIGNUM *m"
121.Fa "int len"
122.Fa "BN_CTX *ctx"
123.Fc
98.Sh DESCRIPTION 124.Sh DESCRIPTION
99.Fn BN_mod_mul_reciprocal 125.Fn BN_mod_mul_reciprocal
100can be used to perform an efficient 126can be used to perform an efficient
@@ -160,6 +186,15 @@ It places the quotient in
160and the remainder in 186and the remainder in
161.Fa rem . 187.Fa rem .
162.Pp 188.Pp
189.Fn BN_reciprocal
190divides the
191.Fa len Ap th
192power of two by
193.Fa m
194and places the quotient in
195.Fa r ,
196rounding it towards zero to the closest integer.
197.Pp
163The 198The
164.Vt BN_RECP_CTX 199.Vt BN_RECP_CTX
165structure is defined as follows: 200structure is defined as follows:
@@ -182,7 +217,17 @@ or
182.Dv NULL 217.Dv NULL
183on error. 218on error.
184.Pp 219.Pp
185For the other functions, 1 is returned for success or 0 on error. 220.Fn BN_mod_mul_reciprocal ,
221.Fn BN_RECP_CTX_set ,
222and
223.Fn BN_div_recp
224return 1 for success or 0 on error.
225.Pp
226.Fn BN_reciprocal
227returns
228.Fa len
229for success or \-1 on error.
230.Pp
186The error codes can be obtained by 231The error codes can be obtained by
187.Xr ERR_get_error 3 . 232.Xr ERR_get_error 3 .
188.Sh SEE ALSO 233.Sh SEE ALSO
@@ -191,14 +236,14 @@ The error codes can be obtained by
191.Xr BN_new 3 236.Xr BN_new 3
192.Sh HISTORY 237.Sh HISTORY
193.Fn BN_mod_mul_reciprocal 238.Fn BN_mod_mul_reciprocal
194first appeared in SSLeay 0.5.1 and has been available since 239and
240.Fn BN_reciprocal
241first appeared in SSLeay 0.5.1 and have been available since
195.Ox 2.4 . 242.Ox 2.4 .
196.Pp 243.Pp
197.Vt BN_RECP_CTX 244.Vt BN_RECP_CTX
198was added in SSLeay 0.9.0. 245was added in SSLeay 0.9.0.
199Before that, a function 246Before that, the
200.Fn BN_reciprocal
201was used instead, and the
202.Fn BN_mod_mul_reciprocal 247.Fn BN_mod_mul_reciprocal
203arguments were different. 248arguments were different.
204.Pp 249.Pp