Prevent negative zero from being created via BN bit functions.
authorjsing <jsing@openbsd.org>
Mon, 15 Apr 2024 14:35:25 +0000 (14:35 +0000)
committerjsing <jsing@openbsd.org>
Mon, 15 Apr 2024 14:35:25 +0000 (14:35 +0000)
commit7c058c6a061daa2a82ab01b18d467f0b177acd49
tree6217247a18088708a0b029b5bdf5491569ec3479
parented759541c5fc4ccbc1a0be552fc63c7b344b66df
Prevent negative zero from being created via BN bit functions.

Both BN_clear_bit() and BN_mask_bits() can create zero values - in both
cases ensure that the negative sign is correctly handled if the value
becomes zero.

Thanks to Guido Vranken for providing a reproducer.

Fixes oss-fuzz #67901

ok tb@
lib/libcrypto/bn/bn_lib.c