Error out on negative shifts in BN_{r,l}shift()
authortb <tb@openbsd.org>
Wed, 22 Jun 2022 09:03:06 +0000 (09:03 +0000)
committertb <tb@openbsd.org>
Wed, 22 Jun 2022 09:03:06 +0000 (09:03 +0000)
commita990b40e6d87ee721e36986e60fe36b7a033729c
treee4e9cb377941168031219eb523717cd6410b4795
parent853b9c1d53fdecb12073390f3627bcbbea37aebd
Error out on negative shifts in BN_{r,l}shift()

Without these checks in both functions nw = n / BN_BITS2 will be negative
and this leads to out-of-bounds accesses via negative array indices and
memset with a negative size.

Pointed out by cheloha

ok jsing
lib/libcrypto/bn/bn_shift.c