diff options
Diffstat (limited to 'src/lib/libcrypto/man')
| -rw-r--r-- | src/lib/libcrypto/man/BN_kronecker.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/BN_mod_sqrt.3 | 111 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/BN_new.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
4 files changed, 119 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/BN_kronecker.3 b/src/lib/libcrypto/man/BN_kronecker.3 index af1c298bb5..90b7f43230 100644 --- a/src/lib/libcrypto/man/BN_kronecker.3 +++ b/src/lib/libcrypto/man/BN_kronecker.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: BN_kronecker.3,v 1.1 2022/11/14 19:51:35 schwarze Exp $ | 1 | .\" $OpenBSD: BN_kronecker.3,v 1.2 2022/11/15 17:55:00 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 14 2022 $ | 17 | .Dd $Mdocdate: November 15 2022 $ |
| 18 | .Dt BN_KRONECKER 3 | 18 | .Dt BN_KRONECKER 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -41,6 +41,7 @@ returns \-1, 0, or 1 in case of success or \-2 on error. | |||
| 41 | .Sh SEE ALSO | 41 | .Sh SEE ALSO |
| 42 | .Xr BN_CTX_new 3 , | 42 | .Xr BN_CTX_new 3 , |
| 43 | .Xr BN_gcd 3 , | 43 | .Xr BN_gcd 3 , |
| 44 | .Xr BN_mod_sqrt 3 , | ||
| 44 | .Xr BN_new 3 | 45 | .Xr BN_new 3 |
| 45 | .Rs | 46 | .Rs |
| 46 | .%A Henri Cohen | 47 | .%A Henri Cohen |
diff --git a/src/lib/libcrypto/man/BN_mod_sqrt.3 b/src/lib/libcrypto/man/BN_mod_sqrt.3 new file mode 100644 index 0000000000..a3f84e5519 --- /dev/null +++ b/src/lib/libcrypto/man/BN_mod_sqrt.3 | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | .\" $OpenBSD: BN_mod_sqrt.3,v 1.1 2022/11/15 17:55:00 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 15 2022 $ | ||
| 18 | .Dt BN_MOD_SQRT 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm BN_mod_sqrt | ||
| 22 | .Nd square root in a prime field | ||
| 23 | .Sh SYNOPSIS | ||
| 24 | .In openssl/bn.h | ||
| 25 | .Ft BIGNUM * | ||
| 26 | .Fo BN_mod_sqrt | ||
| 27 | .Fa "BIGNUM *r" | ||
| 28 | .Fa "const BIGNUM *a" | ||
| 29 | .Fa "const BIGNUM *p" | ||
| 30 | .Fa "BN_CTX *ctx" | ||
| 31 | .Fc | ||
| 32 | .Sh DESCRIPTION | ||
| 33 | .Fn BN_mod_sqrt | ||
| 34 | solves | ||
| 35 | .Bd -unfilled -offset indent | ||
| 36 | .EQ | ||
| 37 | r sup 2 == a ( roman mod p ) | ||
| 38 | .EN | ||
| 39 | .Ed | ||
| 40 | .Pp | ||
| 41 | for | ||
| 42 | .Fa r | ||
| 43 | in the prime field of characteristic | ||
| 44 | .Fa p | ||
| 45 | using the Tonelli-Shanks algorithm if needed | ||
| 46 | and places one of the two solutions into | ||
| 47 | .Fa r . | ||
| 48 | The other solution is | ||
| 49 | .Fa p | ||
| 50 | \- | ||
| 51 | .Fa r . | ||
| 52 | .Pp | ||
| 53 | The argument | ||
| 54 | .Fa p | ||
| 55 | is expected to be a prime number. | ||
| 56 | .Sh RETURN VALUES | ||
| 57 | In case of success, | ||
| 58 | .Fn BN_mod_sqrt | ||
| 59 | returns | ||
| 60 | .Fa r , | ||
| 61 | or a newly allocated | ||
| 62 | .Vt BIGNUM | ||
| 63 | object if the | ||
| 64 | .Fa r | ||
| 65 | argument is | ||
| 66 | .Dv NULL . | ||
| 67 | .Pp | ||
| 68 | In case of failure, | ||
| 69 | .Dv NULL | ||
| 70 | is returned. | ||
| 71 | This for example happens if | ||
| 72 | .Fa a | ||
| 73 | is not a quadratic residue or if memory allocation fails. | ||
| 74 | .Sh SEE ALSO | ||
| 75 | .Xr BN_CTX_new 3 , | ||
| 76 | .Xr BN_kronecker 3 , | ||
| 77 | .Xr BN_mod_sqr 3 , | ||
| 78 | .Xr BN_new 3 | ||
| 79 | .Rs | ||
| 80 | .%A Henri Cohen | ||
| 81 | .%B A Course in Computational Algebraic Number Theory | ||
| 82 | .%I Springer | ||
| 83 | .%C Berlin | ||
| 84 | .%D 1993 | ||
| 85 | .%O Algorithm 1.5.1 | ||
| 86 | .Re | ||
| 87 | .Sh HISTORY | ||
| 88 | .Fn BN_mod_sqrt | ||
| 89 | first appeared in OpenSSL 0.9.7 and has been available since | ||
| 90 | .Ox 3.2 . | ||
| 91 | .Sh CAVEATS | ||
| 92 | If | ||
| 93 | .Fa p | ||
| 94 | is not prime, | ||
| 95 | .Fn BN_mod_sqrt | ||
| 96 | may succeed or fail. | ||
| 97 | If it succeeds, the square of the returned value is congruent to | ||
| 98 | .Fa a | ||
| 99 | modulo | ||
| 100 | .Fa p . | ||
| 101 | If it fails, the reason reported by | ||
| 102 | .Xr ERR_get_error 3 | ||
| 103 | is often misleading. | ||
| 104 | In particular, even if | ||
| 105 | .Fa a | ||
| 106 | is a perfect square, | ||
| 107 | .Fn BN_mod_sqrt | ||
| 108 | often reports | ||
| 109 | .Dq not a square | ||
| 110 | instead of | ||
| 111 | .Dq p is not prime . | ||
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 index 90c0fb4e34..4d73b73030 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.19 2022/11/14 19:51:35 schwarze Exp $ | 1 | .\" $OpenBSD: BN_new.3,v 1.20 2022/11/15 17:55:00 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 14 2022 $ | 53 | .Dd $Mdocdate: November 15 2022 $ |
| 54 | .Dt BN_NEW 3 | 54 | .Dt BN_NEW 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -159,6 +159,7 @@ and sets an error code that can be obtained by | |||
| 159 | .Xr BN_mod_inverse 3 , | 159 | .Xr BN_mod_inverse 3 , |
| 160 | .Xr BN_mod_mul_montgomery 3 , | 160 | .Xr BN_mod_mul_montgomery 3 , |
| 161 | .Xr BN_mod_mul_reciprocal 3 , | 161 | .Xr BN_mod_mul_reciprocal 3 , |
| 162 | .Xr BN_mod_sqrt 3 , | ||
| 162 | .Xr BN_num_bytes 3 , | 163 | .Xr BN_num_bytes 3 , |
| 163 | .Xr BN_rand 3 , | 164 | .Xr BN_rand 3 , |
| 164 | .Xr BN_security_bits 3 , | 165 | .Xr BN_security_bits 3 , |
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 9f514044c2..f1142ab014 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.235 2022/11/14 19:51:35 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.236 2022/11/15 17:55:00 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -76,6 +76,7 @@ MAN= \ | |||
| 76 | BN_mod_inverse.3 \ | 76 | BN_mod_inverse.3 \ |
| 77 | BN_mod_mul_montgomery.3 \ | 77 | BN_mod_mul_montgomery.3 \ |
| 78 | BN_mod_mul_reciprocal.3 \ | 78 | BN_mod_mul_reciprocal.3 \ |
| 79 | BN_mod_sqrt.3 \ | ||
| 79 | BN_new.3 \ | 80 | BN_new.3 \ |
| 80 | BN_num_bytes.3 \ | 81 | BN_num_bytes.3 \ |
| 81 | BN_rand.3 \ | 82 | BN_rand.3 \ |
