aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/ssl_handshake.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2018-11-06 10:07:26 +0100
committerIngela Anderton Andin <[email protected]>2018-11-09 16:29:07 +0100
commit8cc880c2ef369ff0e2e395927ae71b591cd267c2 (patch)
tree77b5b1a9bb1a637dc8d57dfabe0040a58f58ff9f /lib/ssl/src/ssl_handshake.erl
parente7e3f59e5350bb39f57f0403f3c78443c58039b1 (diff)
downloadotp-8cc880c2ef369ff0e2e395927ae71b591cd267c2.tar.gz
otp-8cc880c2ef369ff0e2e395927ae71b591cd267c2.tar.bz2
otp-8cc880c2ef369ff0e2e395927ae71b591cd267c2.zip
ssl: Add engine handling clause to RSA key exchange
Diffstat (limited to 'lib/ssl/src/ssl_handshake.erl')
-rw-r--r--lib/ssl/src/ssl_handshake.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl
index dc89fb0029..14df1d2e02 100644
--- a/lib/ssl/src/ssl_handshake.erl
+++ b/lib/ssl/src/ssl_handshake.erl
@@ -925,6 +925,13 @@ premaster_secret(EncSecret, #'RSAPrivateKey'{} = RSAPrivateKey) ->
catch
_:_ ->
throw(?ALERT_REC(?FATAL, ?DECRYPT_ERROR))
+ end;
+premaster_secret(EncSecret, #{algorithm := rsa} = Engine) ->
+ try crypto:private_decrypt(rsa, EncSecret, maps:remove(algorithm, Engine),
+ [{rsa_pad, rsa_pkcs1_padding}])
+ catch
+ _:_ ->
+ throw(?ALERT_REC(?FATAL, ?DECRYPT_ERROR))
end.
%%====================================================================
%% Extensions handling