Check for BN_copy failures. BN_copy can fail on malloc failure. The case in crypto/rsa was causing the malloc tests in all_tests.go to infinite loop. Change-Id: Id5900512013fba9960444d78a8c056aa4314fb2d Reviewed-on: https://boringssl-review.googlesource.com/5110 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bn.h b/include/openssl/bn.h index ec1c8ff..a61e5cf 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h
@@ -182,7 +182,8 @@ * allocated BIGNUM on success or NULL otherwise. */ OPENSSL_EXPORT BIGNUM *BN_dup(const BIGNUM *src); -/* BN_copy sets |dest| equal to |src| and returns |dest|. */ +/* BN_copy sets |dest| equal to |src| and returns |dest| or NULL on allocation + * failure. */ OPENSSL_EXPORT BIGNUM *BN_copy(BIGNUM *dest, const BIGNUM *src); /* BN_clear sets |bn| to zero and erases the old data. */