aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src/crypto.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-01-31 17:02:23 +0100
committerHans Nilsson <[email protected]>2017-01-31 17:02:23 +0100
commit9b133547ba26090dfc0dd457fa7ec8dc8329109c (patch)
tree0485c93182c16bdfdd65c43fef4e2e3589e60e79 /lib/crypto/src/crypto.erl
parent9bdaf40c9e5242593e011a3f5fb4e37818ddc459 (diff)
parent21d21786abdaae2ae0a601baf5102412399d7af6 (diff)
downloadotp-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.erl12
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()