diff options
author | schwarze <> | 2021-12-21 11:14:07 +0000 |
---|---|---|
committer | schwarze <> | 2021-12-21 11:14:07 +0000 |
commit | 43709257576d39a639820e0d72bd5acbe0c01027 (patch) | |
tree | d4811d4107dd84ba816513e2c521c502807345d9 | |
parent | a35bc5aad54b6bd6e1759a471653da05d50dc858 (diff) | |
download | openbsd-43709257576d39a639820e0d72bd5acbe0c01027.tar.gz openbsd-43709257576d39a639820e0d72bd5acbe0c01027.tar.bz2 openbsd-43709257576d39a639820e0d72bd5acbe0c01027.zip |
document BN_MONT_CTX_set_locked(3)
-rw-r--r-- | src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | 77 |
1 files changed, 72 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 index 963ba8fcd4..7b22efd7f5 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | |||
@@ -1,7 +1,25 @@ | |||
1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.13 2021/12/06 19:45:27 schwarze Exp $ | 1 | .\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.14 2021/12/21 11:14:07 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 24a535ea Sep 22 13:14:20 2020 +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) 2021 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: December 6 2021 $ | 69 | .Dd $Mdocdate: December 21 2021 $ |
52 | .Dt BN_MOD_MUL_MONTGOMERY 3 | 70 | .Dt BN_MOD_MUL_MONTGOMERY 3 |
53 | .Os | 71 | .Os |
54 | .Sh NAME | 72 | .Sh NAME |
@@ -56,6 +74,7 @@ | |||
56 | .Nm BN_MONT_CTX_init , | 74 | .Nm BN_MONT_CTX_init , |
57 | .Nm BN_MONT_CTX_free , | 75 | .Nm BN_MONT_CTX_free , |
58 | .Nm BN_MONT_CTX_set , | 76 | .Nm BN_MONT_CTX_set , |
77 | .Nm BN_MONT_CTX_set_locked , | ||
59 | .Nm BN_MONT_CTX_copy , | 78 | .Nm BN_MONT_CTX_copy , |
60 | .Nm BN_mod_mul_montgomery , | 79 | .Nm BN_mod_mul_montgomery , |
61 | .Nm BN_from_montgomery , | 80 | .Nm BN_from_montgomery , |
@@ -82,6 +101,13 @@ | |||
82 | .Fa "BN_CTX *ctx" | 101 | .Fa "BN_CTX *ctx" |
83 | .Fc | 102 | .Fc |
84 | .Ft BN_MONT_CTX * | 103 | .Ft BN_MONT_CTX * |
104 | .Fo BN_MONT_CTX_set_locked | ||
105 | .Fa "BN_MONT_CTX **pmont" | ||
106 | .Fa "int lock" | ||
107 | .Fa "const BIGNUM *m" | ||
108 | .Fa "BN_CTX *ctx" | ||
109 | .Fc | ||
110 | .Ft BN_MONT_CTX * | ||
85 | .Fo BN_MONT_CTX_copy | 111 | .Fo BN_MONT_CTX_copy |
86 | .Fa "BN_MONT_CTX *to" | 112 | .Fa "BN_MONT_CTX *to" |
87 | .Fa "BN_MONT_CTX *from" | 113 | .Fa "BN_MONT_CTX *from" |
@@ -133,6 +159,37 @@ structure from the modulus | |||
133 | .Fa m | 159 | .Fa m |
134 | by precomputing its inverse and a value R. | 160 | by precomputing its inverse and a value R. |
135 | .Pp | 161 | .Pp |
162 | .Fn BN_MONT_CTX_set_locked | ||
163 | is a wrapper around | ||
164 | .Fn BN_MONT_CTX_new | ||
165 | and | ||
166 | .Fn BN_MONT_CTX_set | ||
167 | that is useful if more than one thread intends to use the same | ||
168 | .Vt BN_MONT_CTX | ||
169 | and none of these threads is exclusively responsible for creating | ||
170 | and initializing the context. | ||
171 | .Fn BN_MONT_CTX_set_locked | ||
172 | first acquires the specified | ||
173 | .Fa lock | ||
174 | using | ||
175 | .Xr CRYPTO_lock 3 . | ||
176 | If | ||
177 | .Pf * Fa pmont | ||
178 | already differs from | ||
179 | .Dv NULL , | ||
180 | no action occurs. | ||
181 | Otherwise, a new | ||
182 | .Vt BN_MONT_CTX | ||
183 | is allocated with | ||
184 | .Fn BN_MONT_CTX_new , | ||
185 | set up with | ||
186 | .Fn BN_MONT_CTX_set , | ||
187 | and a pointer to it is stored in | ||
188 | .Pf * Fa pmont . | ||
189 | Finally, the | ||
190 | .Fa lock | ||
191 | is released. | ||
192 | .Pp | ||
136 | .Fn BN_MONT_CTX_copy | 193 | .Fn BN_MONT_CTX_copy |
137 | copies the | 194 | copies the |
138 | .Vt BN_MONT_CTX | 195 | .Vt BN_MONT_CTX |
@@ -207,13 +264,19 @@ or | |||
207 | .Dv NULL | 264 | .Dv NULL |
208 | on error. | 265 | on error. |
209 | .Pp | 266 | .Pp |
267 | .Fn BN_MONT_CTX_set_locked | ||
268 | returns a pointer to the existing or newly created context or | ||
269 | .Dv NULL | ||
270 | on error. | ||
271 | .Pp | ||
210 | For the other functions, 1 is returned for success or 0 on error. | 272 | For the other functions, 1 is returned for success or 0 on error. |
211 | The error codes can be obtained by | 273 | The error codes can be obtained by |
212 | .Xr ERR_get_error 3 . | 274 | .Xr ERR_get_error 3 . |
213 | .Sh SEE ALSO | 275 | .Sh SEE ALSO |
214 | .Xr BN_add 3 , | 276 | .Xr BN_add 3 , |
215 | .Xr BN_CTX_new 3 , | 277 | .Xr BN_CTX_new 3 , |
216 | .Xr BN_new 3 | 278 | .Xr BN_new 3 , |
279 | .Xr CRYPTO_lock 3 | ||
217 | .Sh HISTORY | 280 | .Sh HISTORY |
218 | .Fn BN_MONT_CTX_new , | 281 | .Fn BN_MONT_CTX_new , |
219 | .Fn BN_MONT_CTX_free , | 282 | .Fn BN_MONT_CTX_free , |
@@ -230,6 +293,10 @@ and | |||
230 | .Fn BN_MONT_CTX_copy | 293 | .Fn BN_MONT_CTX_copy |
231 | first appeared in SSLeay 0.9.1 and have been available since | 294 | first appeared in SSLeay 0.9.1 and have been available since |
232 | .Ox 2.6 . | 295 | .Ox 2.6 . |
296 | .Pp | ||
297 | .Fn BN_MONT_CTX_set_locked | ||
298 | first appeared in OpenSSL 0.9.8 and has been available since | ||
299 | .Ox 4.0 . | ||
233 | .Sh CAVEATS | 300 | .Sh CAVEATS |
234 | .Fn BN_MONT_CTX_init | 301 | .Fn BN_MONT_CTX_init |
235 | must not be called on a context that was used previously, or | 302 | must not be called on a context that was used previously, or |