From 8f4514029cae80ab30d91e11ff38d6a3ad2dcb2e Mon Sep 17 00:00:00 2001 From: erbsland-dev Date: Mon, 8 Jul 2024 12:35:55 +0200 Subject: [PATCH] Enhance documentation for `BN_mask_bits()` Fixes #5537 Added a note that the error check for `BN_mask_bits()` depends on the internal representation that depends on the platform's word size. Included a reference to the `BN_num_bits()` function for precise bit checking. Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24812) (cherry picked from commit 2a45839778955ffcab01918f10544d46e42f9a5b) --- doc/man3/BN_set_bit.pod | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/man3/BN_set_bit.pod b/doc/man3/BN_set_bit.pod index 349ef9e0562..e4d66791e88 100644 --- a/doc/man3/BN_set_bit.pod +++ b/doc/man3/BN_set_bit.pod @@ -33,8 +33,11 @@ error occurs if B is shorter than B bits. BN_is_bit_set() tests if bit B in B is set. BN_mask_bits() truncates B to an B bit number -(CEn)>). An error occurs if B already is -shorter than B bits. +(CEn)>). An error occurs if B is negative. An error is +also returned if the internal representation of B is already shorter than +B bits. The internal representation depends on the platform's word size, and +this error can be safely ignored. Use L to determine the exact +number of bits if needed. BN_lshift() shifts B left by B bits and places the result in B (C). Note that B must be nonnegative. BN_lshift1() shifts -- 2.47.2