diff options
author | Andreas Schultz <[email protected]> | 2012-09-20 11:29:02 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-01-17 14:48:43 +0100 |
commit | e825090fd18face13a2d89f2676d810f96b2c69c (patch) | |
tree | f20ad923aa759609aa59d649cc7a9a5dd0641b81 /lib/ssl/src/ssl_connection.erl | |
parent | 5456bca05c06426bb8d45de77159734a264620e1 (diff) | |
download | otp-e825090fd18face13a2d89f2676d810f96b2c69c.tar.gz otp-e825090fd18face13a2d89f2676d810f96b2c69c.tar.bz2 otp-e825090fd18face13a2d89f2676d810f96b2c69c.zip |
SSL: unify the different implementations signature check implementations
ssl_handshake and ssl_connection where doing essentially the same when
checking a public key signature. This unify both into a single function
Diffstat (limited to 'lib/ssl/src/ssl_connection.erl')
-rw-r--r-- | lib/ssl/src/ssl_connection.erl | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index cde13069b5..9a2cc0c91e 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1665,26 +1665,13 @@ handle_server_key( ?UINT16(YLen), ServerPublicDhKey/binary>>), - case verify_dh_params(Version, Signed, Hash, HashAlgo, PubKeyInfo) of + case ssl_handshake:verify_signature(Version, Hash, HashSign, Signature, PubKeyInfo) of true -> dh_master_secret(P, G, ServerPublicDhKey, undefined, State); false -> ?ALERT_REC(?FATAL, ?DECRYPT_ERROR) end. -verify_dh_params({3, Minor}, Signed, Hashes, HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) - when Minor >= 3 -> - public_key:verify({digest, Hashes}, HashAlgo, Signed, PubKey); -verify_dh_params(_Version, Signed, Hashes, _HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) -> - case public_key:decrypt_public(Signed, PubKey, - [{rsa_pad, rsa_pkcs1_padding}]) of - Hashes -> - true; - _ -> - false - end; -verify_dh_params(_Version, Signed, Hash, HashAlgo, {?'id-dsa', PublicKey, PublicKeyParams}) -> - public_key:verify({digest, Hash}, HashAlgo, Signed, {PublicKey, PublicKeyParams}). dh_master_secret(Prime, Base, PublicDhKey, undefined, State) -> PMpint = mpint_binary(Prime), |