Math::BigInt does floored divs, BN_div does truncated div, compensate
authorRichard Levitte <levitte@openssl.org>
Fri, 25 Mar 2016 23:07:50 +0000 (00:07 +0100)
committerRichard Levitte <levitte@openssl.org>
Sun, 27 Mar 2016 19:39:23 +0000 (21:39 +0200)
commitce84456ddf4e57c18a84858755b8b90c183a270e
treef9813827b1dd4fc2c4bca43afeb11dc9d9c0037b
parentc828cd7cd0426dde10b07e7b68f3741a5ea91fc6
Math::BigInt does floored divs, BN_div does truncated div, compensate

According to documentation, perl's Math::BigInt does floored division,
i.e. the bdiv function does 1 / -4 = -1.  OpenSSL's BN_div, as well as
bc, do truncated division, i.e. 1 / -4 = 0.

We need to compensate for that difference in test/recipes/bc.pl to
make sure to verify the bntest results under its own conditions, by
dividing the absolute values of the given numbers and fixup the
result's negativity afterwards.

Closes RT#4485

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
test/recipes/bc.pl