diff options
author | Doug Hogan <[email protected]> | 2019-01-03 23:11:44 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-08 01:11:58 -0800 |
commit | bec8be4ccdf3859861a86eaf5622cf0e04cd2459 (patch) | |
tree | b9dcf11437d164a4ff0e40b007012381e819dd22 /lib | |
parent | 9452fdea68a51adad8c9934cf1dbc2d2b71cb5d6 (diff) | |
download | otp-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.c | 5 |
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[]) |