Make NativeBN's error-handling more robust.

Functions in OpenSSL/BoringSSL return some result that signals success
or failure. NativeBN was using throwExceptionIfNecessary which is almost
the same, except:

- If BoringSSL has a failure path that forgets to push an exception, it
  would break. Ideally this wouldn't happen, but there may be cases.

- If some other BoringSSL consumer forgets to clear the error queue on
  failure, it would appear as if a NativeBN operation failed.

Instead, consider the result code as the source of truth and change
throwExceptionIfNecessary to throwException. Also remove some unused
BN_GENCB parameters from JNI functions and tidy error paths up with
early returns.

Bug: 30917411
Change-Id: I6f73f67d559e5f02f62ed0d7e63b8ae3bf1e56be
Test: run cts -c org.apache.harmony.tests.java.math.BigIntegerTest
3 files changed