diff options
author | Hans Nilsson <[email protected]> | 2017-01-31 17:02:23 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-01-31 17:02:23 +0100 |
commit | 9b133547ba26090dfc0dd457fa7ec8dc8329109c (patch) | |
tree | 0485c93182c16bdfdd65c43fef4e2e3589e60e79 /lib/crypto/src/crypto.erl | |
parent | 9bdaf40c9e5242593e011a3f5fb4e37818ddc459 (diff) | |
parent | 21d21786abdaae2ae0a601baf5102412399d7af6 (diff) | |
download | otp-9b133547ba26090dfc0dd457fa7ec8dc8329109c.tar.gz otp-9b133547ba26090dfc0dd457fa7ec8dc8329109c.tar.bz2 otp-9b133547ba26090dfc0dd457fa7ec8dc8329109c.zip |
Merge branch 'maint'
Conflicts:
lib/crypto/c_src/crypto.c
lib/crypto/src/crypto.erl
Diffstat (limited to 'lib/crypto/src/crypto.erl')
-rw-r--r-- | lib/crypto/src/crypto.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 9767a13dfc..5a915d4233 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -426,9 +426,15 @@ exor(Bin1, Bin2) -> generate_key(Type, Params) -> generate_key(Type, Params, undefined). -generate_key(dh, DHParameters, PrivateKey) -> +generate_key(dh, DHParameters0, PrivateKey) -> + {DHParameters, Len} = + case DHParameters0 of + [P,G,L] -> {[P,G], L}; + [P,G] -> {[P,G], 0} + end, dh_generate_key_nif(ensure_int_as_bin(PrivateKey), - map_ensure_int_as_bin(DHParameters), 0); + map_ensure_int_as_bin(DHParameters), + 0, Len); generate_key(srp, {host, [Verifier, Generator, Prime, Version]}, PrivArg) when is_binary(Verifier), is_binary(Generator), is_binary(Prime), is_atom(Version) -> @@ -807,7 +813,7 @@ dh_check([_Prime,_Gen]) -> ?nif_stub. %% DHParameters = [P (Prime)= mpint(), G(Generator) = mpint()] %% PrivKey = mpint() -dh_generate_key_nif(_PrivateKey, _DHParameters, _Mpint) -> ?nif_stub. +dh_generate_key_nif(_PrivateKey, _DHParameters, _Mpint, _Length) -> ?nif_stub. %% DHParameters = [P (Prime)= mpint(), G(Generator) = mpint()] %% MyPrivKey, OthersPublicKey = mpint() |