diff options
author | Ingela Anderton Andin <[email protected]> | 2010-11-10 17:49:47 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2010-11-10 17:49:47 +0100 |
commit | 7400f4e990c0e33c0b1f1638f055a2a7c76b4fa3 (patch) | |
tree | 77e796bf05541cd2e117f8f7d4d392b7cf7fa807 /lib/ssl/src/ssl_cipher.erl | |
parent | a77d2b315600bbc851d3ab6d8d70c62715d5ce7c (diff) | |
download | otp-7400f4e990c0e33c0b1f1638f055a2a7c76b4fa3.tar.gz otp-7400f4e990c0e33c0b1f1638f055a2a7c76b4fa3.tar.bz2 otp-7400f4e990c0e33c0b1f1638f055a2a7c76b4fa3.zip |
Added "DECRYPTION_FAILED ALERT" for block decipher failure.
Also fixed incorrect dialyzer spec.
Diffstat (limited to 'lib/ssl/src/ssl_cipher.erl')
-rw-r--r-- | lib/ssl/src/ssl_cipher.erl | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl index 9824e17fcd..175d589931 100644 --- a/lib/ssl/src/ssl_cipher.erl +++ b/lib/ssl/src/ssl_cipher.erl @@ -164,22 +164,22 @@ decipher(?AES, HashSz, CipherState, Fragment, Version) -> block_decipher(Fun, #cipher_state{key=Key, iv=IV} = CipherState0, HashSz, Fragment, Version) -> - ?DBG_HEX(Key), - ?DBG_HEX(IV), - ?DBG_HEX(Fragment), - T = Fun(Key, IV, Fragment), - ?DBG_HEX(T), - GBC = generic_block_cipher_from_bin(T, HashSz), - case is_correct_padding(GBC, Version) of - true -> - Content = GBC#generic_block_cipher.content, - Mac = GBC#generic_block_cipher.mac, - CipherState1 = CipherState0#cipher_state{iv=next_iv(Fragment, IV)}, - {Content, Mac, CipherState1}; - false -> - ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) + try Fun(Key, IV, Fragment) of + Text -> + GBC = generic_block_cipher_from_bin(Text, HashSz), + case is_correct_padding(GBC, Version) of + true -> + Content = GBC#generic_block_cipher.content, + Mac = GBC#generic_block_cipher.mac, + CipherState1 = CipherState0#cipher_state{iv=next_iv(Fragment, IV)}, + {Content, Mac, CipherState1}; + false -> + ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC) + end + catch + _:_ -> + ?ALERT_REC(?FATAL, ?DECRYPTION_FAILED) end. - %%-------------------------------------------------------------------- -spec suites(tls_version()) -> [cipher_suite()]. %% |