summaryrefslogtreecommitdiffstats
path: root/doc/crypto/BN_set_bit.pod
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-05-19 15:19:30 +0100
committerMatt Caswell <matt@openssl.org>2015-05-22 23:19:34 +0100
commit1a9499cf23dfd441628f37c29cfe5ac615255ee1 (patch)
treee1a9bc9bd70c78ea98433a351f09bf0b2ba3312f /doc/crypto/BN_set_bit.pod
parent254c01ed548263cf7128f54dc5c51b4df18f9b37 (diff)
Reject negative shifts for BN_rshift and BN_lshift
The functions BN_rshift and BN_lshift shift their arguments to the right or left by a specified number of bits. Unpredicatable results (including crashes) can occur if a negative number is supplied for the shift value. Thanks to Mateusz Kocielski (LogicalTrust), Marek Kroemeke and Filip Palian for discovering and reporting this issue. Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 7cc18d8158b5fc2676393d99b51c30c135502107) Conflicts: crypto/bn/bn.h crypto/bn/bn_err.c
Diffstat (limited to 'doc/crypto/BN_set_bit.pod')
-rw-r--r--doc/crypto/BN_set_bit.pod8
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/crypto/BN_set_bit.pod b/doc/crypto/BN_set_bit.pod
index b7c47b9b01..a32cca2cee 100644
--- a/doc/crypto/BN_set_bit.pod
+++ b/doc/crypto/BN_set_bit.pod
@@ -37,12 +37,12 @@ BN_mask_bits() truncates B<a> to an B<n> bit number
shorter than B<n> bits.
BN_lshift() shifts B<a> left by B<n> bits and places the result in
-B<r> (C<r=a*2^n>). BN_lshift1() shifts B<a> left by one and places
-the result in B<r> (C<r=2*a>).
+B<r> (C<r=a*2^n>). Note that B<n> must be non-negative. BN_lshift1() shifts
+B<a> left by one and places the result in B<r> (C<r=2*a>).
BN_rshift() shifts B<a> right by B<n> bits and places the result in
-B<r> (C<r=a/2^n>). BN_rshift1() shifts B<a> right by one and places
-the result in B<r> (C<r=a/2>).
+B<r> (C<r=a/2^n>). Note that B<n> must be non-negative. BN_rshift1() shifts
+B<a> right by one and places the result in B<r> (C<r=a/2>).
For the shift functions, B<r> and B<a> may be the same variable.