diff options
author | Sverker Eriksson <[email protected]> | 2013-05-20 16:44:14 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-05-24 23:30:38 +0200 |
commit | 45c4152d54bd4476f1261182706495c50b837117 (patch) | |
tree | f897e3c3a77744c75649cb047613dcb32dc895b7 /lib/crypto/src/crypto.erl | |
parent | 7be7100750d0ed29a2756e15b26f3b75a1d577dc (diff) | |
download | otp-45c4152d54bd4476f1261182706495c50b837117.tar.gz otp-45c4152d54bd4476f1261182706495c50b837117.tar.bz2 otp-45c4152d54bd4476f1261182706495c50b837117.zip |
crypto: Allow integer as srp_private arguments according to docs
Diffstat (limited to 'lib/crypto/src/crypto.erl')
-rw-r--r-- | lib/crypto/src/crypto.erl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 696b182436..449ff3e872 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -1423,7 +1423,7 @@ generate_key(srp, {host, [Verifier, Generator, Prime, Version]}, PrivArg) when is_binary(Verifier), is_binary(Generator), is_binary(Prime), is_atom(Version) -> Private = case PrivArg of undefined -> random_bytes(32); - _ -> PrivArg + _ -> ensure_int_as_bin(PrivArg) end, host_srp_gen_key(Private, Verifier, Generator, Prime, Version); @@ -1455,7 +1455,6 @@ compute_key(srp, HostPublic, {UserPublic, UserPrivate}, {user, [DerivedKey, Prime, Generator, Version | ScramblerArg]}) when is_binary(Prime), is_binary(Generator), - is_binary(UserPrivate), is_atom(Version) -> HostPubBin = ensure_int_as_bin(HostPublic), Multiplier = srp_multiplier(Version, Generator, Prime), @@ -1464,21 +1463,21 @@ compute_key(srp, HostPublic, {UserPublic, UserPrivate}, HostPubBin, Prime); [S] -> S end, - srp_user_secret_nif(UserPrivate, Scrambler, HostPubBin, Multiplier, - Generator, DerivedKey, Prime); + srp_user_secret_nif(ensure_int_as_bin(UserPrivate), Scrambler, HostPubBin, + Multiplier, Generator, DerivedKey, Prime); compute_key(srp, UserPublic, {HostPublic, HostPrivate}, {host,[Verifier, Prime, Version | ScramblerArg]}) when is_binary(Verifier), is_binary(Prime), - is_binary(HostPrivate), is_atom(Version) -> UserPubBin = ensure_int_as_bin(UserPublic), Scrambler = case ScramblerArg of [] -> srp_scrambler(Version, UserPubBin, ensure_int_as_bin(HostPublic), Prime); [S] -> S end, - srp_host_secret_nif(Verifier, HostPrivate, Scrambler, UserPubBin, Prime); + srp_host_secret_nif(Verifier, ensure_int_as_bin(HostPrivate), Scrambler, + UserPubBin, Prime); compute_key(ecdh, Others, My, Curve) -> ecdh_compute_key_nif(ensure_int_as_bin(Others), |