aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-12-01 14:50:04 +0100
committerHans Nilsson <[email protected]>2017-12-01 14:50:04 +0100
commitcba4dc777a3b870985d0a925c7b4e827468a4bb2 (patch)
tree54bdae2dd0f751d87682391f1973ceb0c2b56774 /lib/crypto/src
parentf4f1feb082cda50cf73d2156f87d663619ad6864 (diff)
parente3a55e0e3d9772b89bcad88e88d914ac2477d2e5 (diff)
downloadotp-cba4dc777a3b870985d0a925c7b4e827468a4bb2.tar.gz
otp-cba4dc777a3b870985d0a925c7b4e827468a4bb2.tar.bz2
otp-cba4dc777a3b870985d0a925c7b4e827468a4bb2.zip
Merge branch 'hans/crypto/fix_wrong_error_return_privkey_to_pubkey' into maint
* hans/crypto/fix_wrong_error_return_privkey_to_pubkey: crypto: engine_SUITE update crypto: fix pubkey_to_privkey
Diffstat (limited to 'lib/crypto/src')
-rw-r--r--lib/crypto/src/crypto.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 8e3d41c1e9..641e526537 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -1061,9 +1061,17 @@ ec_curve(X) ->
privkey_to_pubkey(Alg, EngineMap) when Alg == rsa; Alg == dss; Alg == ecdsa ->
- case notsup_to_error(privkey_to_pubkey_nif(Alg, format_pkey(Alg,EngineMap))) of
+ try privkey_to_pubkey_nif(Alg, format_pkey(Alg,EngineMap))
+ of
[_|_]=L -> map_ensure_bin_as_int(L);
X -> X
+ catch
+ error:badarg when Alg==ecdsa ->
+ {error, notsup};
+ error:badarg ->
+ {error, not_found};
+ error:notsup ->
+ {error, notsup}
end.
privkey_to_pubkey_nif(_Alg, _EngineMap) -> ?nif_stub.