diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-02-28 18:26:30 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2022-03-15 13:15:12 +0000 |
commit | 03eccd2663e36f8b95ba3ae8c30a63313a38ec0a (patch) | |
tree | abf5b0ebae8ae3a309339614f3bb8b25aec397dd /doc | |
parent | 9eafb53614bf65797db25f467946e735e1b43dc9 (diff) |
Add documentation of BN_mod_sqrt()
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man3/BN_add.pod | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/doc/man3/BN_add.pod b/doc/man3/BN_add.pod index 62d3ee7205..cf6c49c0e3 100644 --- a/doc/man3/BN_add.pod +++ b/doc/man3/BN_add.pod @@ -3,7 +3,7 @@ =head1 NAME BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, -BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_exp, BN_mod_exp, BN_gcd - +BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_mod_sqrt, BN_exp, BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs =head1 SYNOPSIS @@ -36,6 +36,8 @@ arithmetic operations on BIGNUMs int BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); + BIGNUM *BN_mod_sqrt(BIGNUM *in, BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, @@ -87,6 +89,12 @@ L<BN_mod_mul_reciprocal(3)>. BN_mod_sqr() takes the square of I<a> modulo B<m> and places the result in I<r>. +BN_mod_sqrt() returns the modular square root of I<a> such that +C<in^2 = a (mod p)>. The modulus I<p> must be a +prime, otherwise an error or an incorrect "result" will be returned. +The result is stored into I<in> which can be NULL. The result will be +newly allocated in that case. + BN_exp() raises I<a> to the I<p>-th power and places the result in I<r> (C<r=a^p>). This function is faster than repeated applications of BN_mul(). @@ -108,7 +116,10 @@ the arguments. =head1 RETURN VALUES -For all functions, 1 is returned for success, 0 on error. The return +The BN_mod_sqrt() returns the result (possibly incorrect if I<p> is +not a prime), or NULL. + +For all remaining functions, 1 is returned for success, 0 on error. The return value should always be checked (e.g., C<if (!BN_add(r,a,b)) goto err;>). The error codes can be obtained by L<ERR_get_error(3)>. |