From 940c272713242bcc8ff6a54576c20345a43a098c Mon Sep 17 00:00:00 2001 From: jmc <> Date: Tue, 8 Nov 2016 22:19:45 +0000 Subject: some cleanup; --- src/lib/libcrypto/man/BN_BLINDING_new.3 | 16 ++++++++-------- src/lib/libcrypto/man/BN_CTX_new.3 | 14 +++++++------- src/lib/libcrypto/man/BN_CTX_start.3 | 8 ++++---- src/lib/libcrypto/man/BN_bn2bin.3 | 7 +++---- src/lib/libcrypto/man/BN_mod_inverse.3 | 6 +++--- src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | 12 ++++++------ src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 | 24 ++++++++++++------------ src/lib/libcrypto/man/BN_new.3 | 10 +++++----- src/lib/libcrypto/man/BN_num_bytes.3 | 16 ++++++++-------- src/lib/libcrypto/man/BN_set_negative.3 | 6 +++--- src/lib/libcrypto/man/BN_zero.3 | 6 +++--- 11 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/lib/libcrypto/man/BN_BLINDING_new.3 b/src/lib/libcrypto/man/BN_BLINDING_new.3 index d8860f543e..c1a9e903ed 100644 --- a/src/lib/libcrypto/man/BN_BLINDING_new.3 +++ b/src/lib/libcrypto/man/BN_BLINDING_new.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_BLINDING_new.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_BLINDING_new.3,v 1.4 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_BLINDING_NEW 3 .Os .Sh NAME @@ -119,7 +119,7 @@ parameters by squaring the .Fa A and .Fa \&Ai -or, after specific number of uses and if the necessary parameters are +or, after a specific number of uses and if the necessary parameters are set, by re-creating the blinding parameters. .Pp .Fn BN_BLINDING_convert_ex @@ -135,7 +135,7 @@ a copy of the inverse blinding factor .Fa \&Ai will be returned in .Fa r -(this is useful if a +(this is useful if an .Vt RSA object is shared among several threads). .Fn BN_BLINDING_invert_ex @@ -169,9 +169,9 @@ object within the structure. This is to help users provide proper locking if needed for multi-threaded use. -The "thread id" object of a newly allocated +The thread ID object of a newly allocated .Vt BN_BLINDING -structure is initialised to the thread id in which +structure is initialised to the thread ID in which .Fn BN_BLINDING_new was called. .Pp @@ -210,7 +210,7 @@ and the modulus and .Fa m_ctx can be used to pass special functions for exponentiation (normally -.Xr BN_mod_exp_mont 3 +.Xr BN_mod_exp 3 and .Vt BN_MONT_CTX ) . .Sh RETURN VALUES @@ -230,7 +230,7 @@ and return 1 on success and 0 if an error occurred. .Pp .Fn BN_BLINDING_thread_id -returns a pointer to the thread id object within a +returns a pointer to the thread ID object within a .Vt BN_BLINDING object. .Pp diff --git a/src/lib/libcrypto/man/BN_CTX_new.3 b/src/lib/libcrypto/man/BN_CTX_new.3 index 5165f3bea2..5883ae7e9c 100644 --- a/src/lib/libcrypto/man/BN_CTX_new.3 +++ b/src/lib/libcrypto/man/BN_CTX_new.3 @@ -1,12 +1,12 @@ -.\" $OpenBSD: BN_CTX_new.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_CTX_new.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_CTX_NEW 3 .Os .Sh NAME .Nm BN_CTX_new , -.Nm BN_CTX_init , -.Nm BN_CTX_free +.Nm BN_CTX_free , +.Nm BN_CTX_init .Nd allocate and free BN_CTX structures .Sh SYNOPSIS .In openssl/bn.h @@ -45,8 +45,8 @@ structure. .Pp .Fn BN_CTX_free frees the components of the -.Vt BN_CTX , -and if it was created by +.Vt BN_CTX +and, if it was created by .Fn BN_CTX_new , also the structure itself. If @@ -88,6 +88,6 @@ return no value. .Fn BN_CTX_new and .Fn BN_CTX_free -are available in all versions on SSLeay and OpenSSL. +are available in all versions of SSLeay and OpenSSL. .Fn BN_CTX_init was added in SSLeay 0.9.1b. diff --git a/src/lib/libcrypto/man/BN_CTX_start.3 b/src/lib/libcrypto/man/BN_CTX_start.3 index 0d0797ef6f..df0328b309 100644 --- a/src/lib/libcrypto/man/BN_CTX_start.3 +++ b/src/lib/libcrypto/man/BN_CTX_start.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_CTX_start.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_CTX_start.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_CTX_START 3 .Os .Sh NAME @@ -27,7 +27,7 @@ These functions are used to obtain temporary .Vt BIGNUM variables from a .Vt BN_CTX -(which can been created by using +(which can be created using .Xr BN_CTX_new 3 ) in order to save the overhead of repeatedly creating and freeing .Vt BIGNUM Ns s @@ -75,7 +75,7 @@ has failed, the subsequent calls will return as well, so it is sufficient to check the return value of the last .Fn BN_CTX_get call. -In case of an error, an error code is set, which can be obtained by +In case of an error, an error code is set which can be obtained by .Xr ERR_get_error 3 . .Sh SEE ALSO .Xr BN_CTX_new 3 diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3 index b371527935..bf1c19ffd4 100644 --- a/src/lib/libcrypto/man/BN_bn2bin.3 +++ b/src/lib/libcrypto/man/BN_bn2bin.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_bn2bin.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_bn2bin.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_BN2BIN 3 .Os .Sh NAME @@ -159,7 +159,7 @@ where .Fa to must be large enough to hold the result. The size can be determined by calling -.Fn BN_bn2mpi a , NULL . +.Fn BN_bn2mpi a NULL . .Pp .Fn BN_mpi2bn converts the @@ -216,7 +216,6 @@ on error. The error codes can be obtained by .Xr ERR_get_error 3 . .Sh SEE ALSO -.Xr ASN1_INTEGER_to_BN 3 , .Xr bn 3 , .Xr BN_num_bytes 3 , .Xr BN_zero 3 , diff --git a/src/lib/libcrypto/man/BN_mod_inverse.3 b/src/lib/libcrypto/man/BN_mod_inverse.3 index 2500c178f3..e3667154a9 100644 --- a/src/lib/libcrypto/man/BN_mod_inverse.3 +++ b/src/lib/libcrypto/man/BN_mod_inverse.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_mod_inverse.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_mod_inverse.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_MOD_INVERSE 3 .Os .Sh NAME @@ -21,7 +21,7 @@ computes the inverse of .Fa a modulo .Fa n -add places the result in +and places the result in .Fa r .Pq Li (a*r)%n==1 . If diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 index 8ec14c3ea0..ca5f869d4f 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 @@ -1,15 +1,15 @@ -.\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_mod_mul_montgomery.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_MOD_MUL_MONTGOMERY 3 .Os .Sh NAME -.Nm BN_mod_mul_montgomery , .Nm BN_MONT_CTX_new , .Nm BN_MONT_CTX_init , .Nm BN_MONT_CTX_free , .Nm BN_MONT_CTX_set , .Nm BN_MONT_CTX_copy , +.Nm BN_mod_mul_montgomery , .Nm BN_from_montgomery , .Nm BN_to_montgomery .Nd Montgomery multiplication @@ -107,12 +107,12 @@ and places the result in .Fn BN_from_montgomery performs the Montgomery reduction .Pp -.D1 Fa r No = Fa a No * R^-1. +.D1 Fa r No = Fa a No * R^-1 .Pp .Fn BN_to_montgomery computes .Pp -.D1 Mont Ns Po Fa a , No R^2 Pc = Fa a No * R . +.D1 Mont Ns Po Fa a , No R^2 Pc = Fa a No * R .Pp Note that .Fa a @@ -142,7 +142,7 @@ typedef struct bn_mont_ctx_st { .Fn BN_to_montgomery is a macro. .Pp -.Sy Warning: +.Sy Warning : The inputs must be reduced modulo .Fa m , otherwise the result will be outside the expected range. diff --git a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 index c311cca961..115cdcbbfe 100644 --- a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 +++ b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 @@ -1,18 +1,26 @@ -.\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_mod_mul_reciprocal.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_MOD_MUL_RECIPROCAL 3 .Os .Sh NAME .Nm BN_mod_mul_reciprocal , -.Nm BN_div_recp , .Nm BN_RECP_CTX_new , .Nm BN_RECP_CTX_init , .Nm BN_RECP_CTX_free , -.Nm BN_RECP_CTX_set +.Nm BN_RECP_CTX_set , +.Nm BN_div_recp .Nd modular multiplication using reciprocal .Sh SYNOPSIS .In openssl/bn.h +.Ft int +.Fo BN_mod_mul_reciprocal +.Fa "BIGNUM *r" +.Fa "BIGNUM *a" +.Fa "BIGNUM *b" +.Fa "BN_RECP_CTX *recp" +.Fa "BN_CTX *ctx" +.Fc .Ft BN_RECP_CTX * .Fo BN_RECP_CTX_new .Fa void @@ -39,14 +47,6 @@ .Fa "BN_RECP_CTX *recp" .Fa "BN_CTX *ctx" .Fc -.Ft int -.Fo BN_mod_mul_reciprocal -.Fa "BIGNUM *r" -.Fa "BIGNUM *a" -.Fa "BIGNUM *b" -.Fa "BN_RECP_CTX *recp" -.Fa "BN_CTX *ctx" -.Fc .Sh DESCRIPTION .Fn BN_mod_mul_reciprocal can be used to perform an efficient diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 index 887336e914..cb351d2fa5 100644 --- a/src/lib/libcrypto/man/BN_new.3 +++ b/src/lib/libcrypto/man/BN_new.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_new.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_new.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_NEW 3 .Os .Sh NAME @@ -50,8 +50,8 @@ and sets it to the value 0. .Pp .Fn BN_free frees the components of the -.Vt BIGNUM , -and if it was created by +.Vt BIGNUM +and, if it was created by .Fn BN_new , also the structure itself. .Fn BN_clear_free @@ -81,6 +81,6 @@ return no values. .Fn BN_free , and .Fn BN_clear_free -are available in all versions on SSLeay and OpenSSL. +are available in all versions of SSLeay and OpenSSL. .Fn BN_init was added in SSLeay 0.9.1b. diff --git a/src/lib/libcrypto/man/BN_num_bytes.3 b/src/lib/libcrypto/man/BN_num_bytes.3 index 5223ff1116..3e96a401a5 100644 --- a/src/lib/libcrypto/man/BN_num_bytes.3 +++ b/src/lib/libcrypto/man/BN_num_bytes.3 @@ -1,11 +1,11 @@ -.\" $OpenBSD: BN_num_bytes.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_num_bytes.3,v 1.3 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_NUM_BYTES 3 .Os .Sh NAME -.Nm BN_num_bits , .Nm BN_num_bytes , +.Nm BN_num_bits , .Nm BN_num_bits_word .Nd get BIGNUM size .Sh SYNOPSIS @@ -25,12 +25,12 @@ .Sh DESCRIPTION .Fn BN_num_bytes returns the size of a -.Sy BIGNUM +.Vt BIGNUM in bytes. .Pp .Fn BN_num_bits_word returns the number of significant bits in a word. -If we take 0x00000432 as an example, it returns 11, not 16, not 32. +As an example, 0x00000432 returns 11, not 16 or 32. Basically, except for a zero, it returns .Pp .D1 floor(log2( Ns Fa w ) ) No + 1 . @@ -43,9 +43,7 @@ following the same principle as .Pp .Fn BN_num_bytes is a macro. -.Sh RETURN VALUES -The size. -.Sh NOTES +.Pp Some have tried using .Fn BN_num_bits on individual numbers in RSA keys, DH keys and DSA keys, and found that @@ -65,6 +63,8 @@ or use .Fn BN_num_bytes and multiply with 8 (although there's no real guarantee that will match the "key size", just a lot more probability). +.Sh RETURN VALUES +The size. .Sh SEE ALSO .Xr bn 3 , .Xr DH_size 3 , diff --git a/src/lib/libcrypto/man/BN_set_negative.3 b/src/lib/libcrypto/man/BN_set_negative.3 index 871de9272e..166e2f2971 100644 --- a/src/lib/libcrypto/man/BN_set_negative.3 +++ b/src/lib/libcrypto/man/BN_set_negative.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: BN_set_negative.3,v 1.1 2016/11/05 20:36:11 schwarze Exp $ +.\" $OpenBSD: BN_set_negative.3,v 1.2 2016/11/08 22:19:45 jmc Exp $ .\" .\" Copyright (c) 2016 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 5 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_SET_NEGATIVE 3 .Os .Sh NAME @@ -39,7 +39,7 @@ to negative if both .Fa b and .Fa n -are nonzero, otherwise it sets it to positive. +are non-zero, otherwise it sets it to positive. .Pp .Fn BN_is_negative tests the sign of diff --git a/src/lib/libcrypto/man/BN_zero.3 b/src/lib/libcrypto/man/BN_zero.3 index 2d9b943a96..9f2b18aa1f 100644 --- a/src/lib/libcrypto/man/BN_zero.3 +++ b/src/lib/libcrypto/man/BN_zero.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: BN_zero.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ +.\" $OpenBSD: BN_zero.3,v 1.4 2016/11/08 22:19:45 jmc Exp $ .\" -.Dd $Mdocdate: November 6 2016 $ +.Dd $Mdocdate: November 8 2016 $ .Dt BN_ZERO 3 .Os .Sh NAME @@ -100,6 +100,6 @@ Someone might change the constant. .Pp If a .Vt BIGNUM -is equal to 0xffffffffL it can be represented as an +is equal to 0xffffffffL; it can be represented as an .Vt unsigned long but this value is also returned on error. -- cgit v1.2.3-55-g6feb