diff options
author | Péter Dimitrov <[email protected]> | 2018-12-14 13:20:14 +0100 |
---|---|---|
committer | Péter Dimitrov <[email protected]> | 2019-01-11 09:59:12 +0100 |
commit | 4f5f693bf4ece8c102a2f2f10c8d4693d2957a60 (patch) | |
tree | 2b617b39b8aff3cd221e99b0e431495cca0d22d1 /lib/ssl/src/tls_connection_1_3.erl | |
parent | 0f35bb7eeb4360ac3b0a0c2ded3e5e8e2e4255d4 (diff) | |
download | otp-4f5f693bf4ece8c102a2f2f10c8d4693d2957a60.tar.gz otp-4f5f693bf4ece8c102a2f2f10c8d4693d2957a60.tar.bz2 otp-4f5f693bf4ece8c102a2f2f10c8d4693d2957a60.zip |
ssl: Add support for x25519 and x448 in ECDH
Change-Id: I206b851fc616c53475f4a2935f6f52baf8f3e1e6
Diffstat (limited to 'lib/ssl/src/tls_connection_1_3.erl')
-rw-r--r-- | lib/ssl/src/tls_connection_1_3.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/ssl/src/tls_connection_1_3.erl b/lib/ssl/src/tls_connection_1_3.erl index 42ae784222..4795ade2a1 100644 --- a/lib/ssl/src/tls_connection_1_3.erl +++ b/lib/ssl/src/tls_connection_1_3.erl @@ -269,14 +269,19 @@ get_private_key(#key_share_entry{ PrivateKey. -%% DH +%% X25519, X448 +calculate_shared_secret(OthersKey, MyKey, Group) + when is_binary(OthersKey) andalso is_binary(MyKey) andalso + (Group =:= x25519 orelse Group =:= x448)-> + crypto:compute_key(ecdh, OthersKey, MyKey, Group); +%% FFDHE calculate_shared_secret(OthersKey, MyKey, Group) when is_binary(OthersKey) andalso is_binary(MyKey) -> Params = #'DHParameter'{prime = P} = ssl_dh_groups:dh_params(Group), S = public_key:compute_key(OthersKey, MyKey, Params), Size = byte_size(binary:encode_unsigned(P)), ssl_cipher:add_zero_padding(S, Size); -%% ECDH +%% ECDHE calculate_shared_secret(OthersKey, MyKey = #'ECPrivateKey'{}, _Group) when is_binary(OthersKey) -> Point = #'ECPoint'{point = OthersKey}, |