diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-10-18 15:50:30 +0200 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-10-26 15:26:29 +0100 |
commit | 1067944c12691c7311c50d565e02cc53577b0f09 (patch) | |
tree | 714db2cad8926cb65b04e5bece838a4ba4b6dd13 /doc | |
parent | efbf2b9881c62f01047e008c85acb350427b553d (diff) |
bn: Properly error out if aliasing return value with modulus
Test case amended from code initially written by Bernd Edlinger.
Fixes #21110
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22421)
(cherry picked from commit af0025fc40779cc98c06db7e29936f9d5de8cc9e)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man3/BN_add.pod | 5 | ||||
-rw-r--r-- | doc/man3/BN_mod_inverse.pod | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/man3/BN_add.pod b/doc/man3/BN_add.pod index 9561d55431..35cfdd1495 100644 --- a/doc/man3/BN_add.pod +++ b/doc/man3/BN_add.pod @@ -114,6 +114,11 @@ temporary variables; see L<BN_CTX_new(3)>. Unless noted otherwise, the result B<BIGNUM> must be different from the arguments. +=head1 NOTES + +For modular operations such as BN_nnmod() or BN_mod_exp() it is an error +to use the same B<BIGNUM> object for the modulus as for the output. + =head1 RETURN VALUES The BN_mod_sqrt() returns the result (possibly incorrect if I<p> is diff --git a/doc/man3/BN_mod_inverse.pod b/doc/man3/BN_mod_inverse.pod index 5dbb5c3cc2..f88e0e63fa 100644 --- a/doc/man3/BN_mod_inverse.pod +++ b/doc/man3/BN_mod_inverse.pod @@ -18,7 +18,11 @@ places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, a new B<BIGNUM> is created. B<ctx> is a previously allocated B<BN_CTX> used for temporary -variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>. +variables. B<r> may be the same B<BIGNUM> as B<a>. + +=head1 NOTES + +It is an error to use the same B<BIGNUM> as B<n>. =head1 RETURN VALUES |