aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-03 23:11:44 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:58 -0800
commitbec8be4ccdf3859861a86eaf5622cf0e04cd2459 (patch)
treeb9dcf11437d164a4ff0e40b007012381e819dd22 /lib
parent9452fdea68a51adad8c9934cf1dbc2d2b71cb5d6 (diff)
downloadotp-bec8be4ccdf3859861a86eaf5622cf0e04cd2459.tar.gz
otp-bec8be4ccdf3859861a86eaf5622cf0e04cd2459.tar.bz2
otp-bec8be4ccdf3859861a86eaf5622cf0e04cd2459.zip
Change bin_from_bn to return atom_error on error.
* Add error checking for OpenSSL call.
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/c_src/bn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/crypto/c_src/bn.c b/lib/crypto/c_src/bn.c
index 67a6bb6279..ef69c84679 100644
--- a/lib/crypto/c_src/bn.c
+++ b/lib/crypto/c_src/bn.c
@@ -84,12 +84,13 @@ ERL_NIF_TERM bin_from_bn(ErlNifEnv* env, const BIGNUM *bn)
if ((bin_ptr = enif_make_new_binary(env, (size_t)bn_len, &term)) == NULL)
goto err;
- BN_bn2bin(bn, bin_ptr);
+ if (BN_bn2bin(bn, bin_ptr) < 0)
+ goto err;
return term;
err:
- return enif_make_badarg(env);
+ return atom_error;
}
ERL_NIF_TERM mod_exp_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])