Remove the now impossible BN_R_NOT_INITIALIZED check in BN_div This was just checking the bn_correct_top invariant. But since we got rid of the bn_correct_top invariant and dynamically compute bn_minimal_width anyway, bn_minimal_width will always be computed such that the check succeeds. Bug: 358687140 Change-Id: Idc1abbc46c38d47f319ee5835a5a601a8a3d9c0e Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/70171 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/crypto/fipsmodule/bn/div.c b/crypto/fipsmodule/bn/div.c index 0410fb7..06bc4f8 100644 --- a/crypto/fipsmodule/bn/div.c +++ b/crypto/fipsmodule/bn/div.c
@@ -198,15 +198,6 @@ BN_ULONG d0, d1; int num_n, div_n; - // Invalid zero-padding would have particularly bad consequences. - int numerator_width = bn_minimal_width(numerator); - int divisor_width = bn_minimal_width(divisor); - if ((numerator_width > 0 && numerator->d[numerator_width - 1] == 0) || - (divisor_width > 0 && divisor->d[divisor_width - 1] == 0)) { - OPENSSL_PUT_ERROR(BN, BN_R_NOT_INITIALIZED); - return 0; - } - if (BN_is_zero(divisor)) { OPENSSL_PUT_ERROR(BN, BN_R_DIV_BY_ZERO); return 0;