diff options
author | schwarze <> | 2022-11-21 22:04:04 +0000 |
---|---|---|
committer | schwarze <> | 2022-11-21 22:04:04 +0000 |
commit | db46b441d3b0b1cfbd7d103ff89510b12074254a (patch) | |
tree | c94dc4632f56936c75a5dce361b066964604b1f1 /src | |
parent | 24b92fa9d36633c9630c63433973fe680957c836 (diff) | |
download | openbsd-db46b441d3b0b1cfbd7d103ff89510b12074254a.tar.gz openbsd-db46b441d3b0b1cfbd7d103ff89510b12074254a.tar.bz2 openbsd-db46b441d3b0b1cfbd7d103ff89510b12074254a.zip |
document BN_nist_mod_521(3) and their four siblings
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/BN_new.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/BN_nist_mod_521.3 | 113 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
3 files changed, 118 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 index 1913b75ec5..7e3432770f 100644 --- a/src/lib/libcrypto/man/BN_new.3 +++ b/src/lib/libcrypto/man/BN_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: BN_new.3,v 1.21 2022/11/18 01:21:40 schwarze Exp $ | 1 | .\" $OpenBSD: BN_new.3,v 1.22 2022/11/21 22:04:04 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 | 2 | .\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000 |
3 | .\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 | 3 | .\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200 |
4 | .\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 | 4 | .\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400 |
@@ -50,7 +50,7 @@ | |||
50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | .\" | 52 | .\" |
53 | .Dd $Mdocdate: November 18 2022 $ | 53 | .Dd $Mdocdate: November 21 2022 $ |
54 | .Dt BN_NEW 3 | 54 | .Dt BN_NEW 3 |
55 | .Os | 55 | .Os |
56 | .Sh NAME | 56 | .Sh NAME |
@@ -161,6 +161,7 @@ and sets an error code that can be obtained by | |||
161 | .Xr BN_mod_mul_montgomery 3 , | 161 | .Xr BN_mod_mul_montgomery 3 , |
162 | .Xr BN_mod_mul_reciprocal 3 , | 162 | .Xr BN_mod_mul_reciprocal 3 , |
163 | .Xr BN_mod_sqrt 3 , | 163 | .Xr BN_mod_sqrt 3 , |
164 | .Xr BN_nist_mod_521 3 , | ||
164 | .Xr BN_num_bytes 3 , | 165 | .Xr BN_num_bytes 3 , |
165 | .Xr BN_rand 3 , | 166 | .Xr BN_rand 3 , |
166 | .Xr BN_security_bits 3 , | 167 | .Xr BN_security_bits 3 , |
diff --git a/src/lib/libcrypto/man/BN_nist_mod_521.3 b/src/lib/libcrypto/man/BN_nist_mod_521.3 new file mode 100644 index 0000000000..72dd4a7124 --- /dev/null +++ b/src/lib/libcrypto/man/BN_nist_mod_521.3 | |||
@@ -0,0 +1,113 @@ | |||
1 | .\" $OpenBSD: BN_nist_mod_521.3,v 1.1 2022/11/21 22:04:04 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: November 21 2022 $ | ||
18 | .Dt BN_NIST_MOD_521 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm BN_nist_mod_192 , | ||
22 | .Nm BN_nist_mod_224 , | ||
23 | .Nm BN_nist_mod_256 , | ||
24 | .Nm BN_nist_mod_384 , | ||
25 | .Nm BN_nist_mod_521 | ||
26 | .Nd reduction modulo NIST-recommended primes | ||
27 | .Sh SYNOPSIS | ||
28 | .In openssl/bn.h | ||
29 | .Ft int | ||
30 | .Fo BN_nist_mod_192 | ||
31 | .Fa "BIGNUM *r" | ||
32 | .Fa "const BIGNUM *a" | ||
33 | .Fa "const BIGNUM *m" | ||
34 | .Fa "BN_CTX *ctx" | ||
35 | .Fc | ||
36 | .Ft int | ||
37 | .Fo BN_nist_mod_224 | ||
38 | .Fa "BIGNUM *r" | ||
39 | .Fa "const BIGNUM *a" | ||
40 | .Fa "const BIGNUM *m" | ||
41 | .Fa "BN_CTX *ctx" | ||
42 | .Fc | ||
43 | .Ft int | ||
44 | .Fo BN_nist_mod_256 | ||
45 | .Fa "BIGNUM *r" | ||
46 | .Fa "const BIGNUM *a" | ||
47 | .Fa "const BIGNUM *m" | ||
48 | .Fa "BN_CTX *ctx" | ||
49 | .Fc | ||
50 | .Ft int | ||
51 | .Fo BN_nist_mod_384 | ||
52 | .Fa "BIGNUM *r" | ||
53 | .Fa "const BIGNUM *a" | ||
54 | .Fa "const BIGNUM *m" | ||
55 | .Fa "BN_CTX *ctx" | ||
56 | .Fc | ||
57 | .Ft int | ||
58 | .Fo BN_nist_mod_521 | ||
59 | .Fa "BIGNUM *r" | ||
60 | .Fa "const BIGNUM *a" | ||
61 | .Fa "const BIGNUM *m" | ||
62 | .Fa "BN_CTX *ctx" | ||
63 | .Fc | ||
64 | .Sh DESCRIPTION | ||
65 | These functions are optimized versions of | ||
66 | .Xr BN_nnmod 3 | ||
67 | using precomputed tables. | ||
68 | They ignore their | ||
69 | .Fa m | ||
70 | argument and use the following moduli instead: | ||
71 | .Pp | ||
72 | .Bl -tag -width BN_nist_mod_521() -offset indent -compact | ||
73 | .It Fn BN_nist_mod_192 | ||
74 | .Xr BN_get0_nist_prime_192 3 | ||
75 | .It Fn BN_nist_mod_224 | ||
76 | .Xr BN_get0_nist_prime_224 3 | ||
77 | .It Fn BN_nist_mod_256 | ||
78 | .Xr BN_get0_nist_prime_256 3 | ||
79 | .It Fn BN_nist_mod_384 | ||
80 | .Xr BN_get0_nist_prime_384 3 | ||
81 | .It Fn BN_nist_mod_521 | ||
82 | .Xr BN_get0_nist_prime_521 3 | ||
83 | .El | ||
84 | .Pp | ||
85 | They reduce | ||
86 | .Fa a | ||
87 | modulo the respective prime number and place the non-negative remainder in | ||
88 | .Fa r . | ||
89 | .Pp | ||
90 | These functions are designed to save time when performing multiplications | ||
91 | in prime fields of these specific orders. | ||
92 | Consequently, if | ||
93 | .Fa a | ||
94 | is negative or larger than the square of the modulus being used, they call | ||
95 | .Xr BN_nnmod 3 | ||
96 | instead of attempting any optimization. | ||
97 | .Sh RETURN VALUES | ||
98 | These functions return 1 on success or 0 on error. | ||
99 | .Sh SEE ALSO | ||
100 | .Xr BN_get0_nist_prime_521 3 , | ||
101 | .Xr BN_nnmod 3 , | ||
102 | .Xr EC_GFp_nist_method 3 | ||
103 | .Sh STANDARDS | ||
104 | .Rs | ||
105 | .%T Digital Signature Standard (DSS) | ||
106 | .%I National Institute of Standards and Technology | ||
107 | .%R FIPS PUB 186-4 | ||
108 | .%U https://doi.org/10.6028/NIST.FIPS.186-4 | ||
109 | .%Q Information Technology Laboratory | ||
110 | .%C Gaithersburg, Maryland | ||
111 | .%D July 2013 | ||
112 | .%O Appendix D.1.2 Curves over Prime Fields | ||
113 | .Re | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 8c799cf564..88f1a05f7e 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.237 2022/11/18 01:21:40 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.238 2022/11/21 22:04:04 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -79,6 +79,7 @@ MAN= \ | |||
79 | BN_mod_mul_reciprocal.3 \ | 79 | BN_mod_mul_reciprocal.3 \ |
80 | BN_mod_sqrt.3 \ | 80 | BN_mod_sqrt.3 \ |
81 | BN_new.3 \ | 81 | BN_new.3 \ |
82 | BN_nist_mod_521.3 \ | ||
82 | BN_num_bytes.3 \ | 83 | BN_num_bytes.3 \ |
83 | BN_rand.3 \ | 84 | BN_rand.3 \ |
84 | BN_set_bit.3 \ | 85 | BN_set_bit.3 \ |