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:34 +0100 |
commit | 29c0d8156629a988db5a4af30704736579f7c313 (patch) | |
tree | 8154177454732ceea7bc22f296c43b559aa3ab5b /doc | |
parent | 017fc90a1c3cc02b272c7adc8d1e9ffd7344b2b0 (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 |