diff options
author | Ingela Anderton Andin <[email protected]> | 2019-03-21 10:15:21 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2019-03-21 10:15:21 +0100 |
commit | 5f324f5077c45b51c727356c0d32a3847cf510af (patch) | |
tree | afe3eb01600b219932f47eacea0f8d1f0c15f065 | |
parent | 96bc98aefa9b5b52aebeceb52d4d92ed9d7046db (diff) | |
parent | 884503bc69157d2a3c6bd72389b4e2a800f97fb6 (diff) | |
download | otp-5f324f5077c45b51c727356c0d32a3847cf510af.tar.gz otp-5f324f5077c45b51c727356c0d32a3847cf510af.tar.bz2 otp-5f324f5077c45b51c727356c0d32a3847cf510af.zip |
Merge branch 'ingela/ssl/crypto-exception-handling'
* ingela/ssl/crypto-exception-handling:
ssl: Correct handling of crypto exception handling.
-rw-r--r-- | lib/ssl/src/ssl_record.erl | 7 | ||||
-rw-r--r-- | lib/ssl/src/tls_record_1_3.erl | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/lib/ssl/src/ssl_record.erl b/lib/ssl/src/ssl_record.erl index 91f1876980..669626aefb 100644 --- a/lib/ssl/src/ssl_record.erl +++ b/lib/ssl/src/ssl_record.erl @@ -395,12 +395,7 @@ decipher_aead(Type, #cipher_state{key = Key} = CipherState, AAD0, CipherFragment try Nonce = decrypt_nonce(Type, CipherState, CipherFragment), {AAD, CipherText, CipherTag} = aead_ciphertext_split(Type, CipherState, CipherFragment, AAD0), - case ssl_cipher:aead_decrypt(Type, Key, Nonce, CipherText, CipherTag, AAD) of - Content when is_binary(Content) -> - Content; - _ -> - ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC, decryption_failed) - end + ssl_cipher:aead_decrypt(Type, Key, Nonce, CipherText, CipherTag, AAD) catch _:_ -> ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC, decryption_failed) diff --git a/lib/ssl/src/tls_record_1_3.erl b/lib/ssl/src/tls_record_1_3.erl index 97331e1510..5f1c64eae6 100644 --- a/lib/ssl/src/tls_record_1_3.erl +++ b/lib/ssl/src/tls_record_1_3.erl @@ -267,12 +267,7 @@ decipher_aead(CipherFragment, BulkCipherAlgo, Key, Seq, IV, TagLen) -> AAD = additional_data(erlang:iolist_size(CipherFragment)), Nonce = nonce(Seq, IV), {CipherText, CipherTag} = aead_ciphertext_split(CipherFragment, TagLen), - case ssl_cipher:aead_decrypt(BulkCipherAlgo, Key, Nonce, CipherText, CipherTag, AAD) of - Content when is_binary(Content) -> - Content; - _ -> - ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC, decryption_failed) - end + ssl_cipher:aead_decrypt(BulkCipherAlgo, Key, Nonce, CipherText, CipherTag, AAD) catch _:_ -> ?ALERT_REC(?FATAL, ?BAD_RECORD_MAC, decryption_failed) |