8235311: Tag mismatch may alert bad_record_mac

Reviewed-by: mullan
This commit is contained in:
Xue-Lei Andrew Fan 2019-12-10 07:07:49 -08:00
parent 02039fd33a
commit 3ba75a656a

View File

@ -28,6 +28,7 @@ package sun.security.ssl;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import javax.crypto.AEADBadTagException;
import javax.crypto.BadPaddingException;
import javax.net.ssl.SSLHandshakeException;
@ -116,6 +117,8 @@ interface SSLTransport {
}
throw context.fatal(Alert.UNEXPECTED_MESSAGE, unsoe);
} catch (AEADBadTagException bte) {
throw context.fatal(Alert.BAD_RECORD_MAC, bte);
} catch (BadPaddingException bpe) {
/*
* The basic SSLv3 record protection involves (optional)
@ -123,9 +126,9 @@ interface SSLTransport {
* data origin authentication. We do them both here, and
* throw a fatal alert if the integrity check fails.
*/
Alert alert = (context.handshakeContext != null) ?
Alert.HANDSHAKE_FAILURE :
Alert.BAD_RECORD_MAC;
Alert alert = (context.handshakeContext != null) ?
Alert.HANDSHAKE_FAILURE :
Alert.BAD_RECORD_MAC;
throw context.fatal(alert, bpe);
} catch (SSLHandshakeException she) {
// may be record sequence number overflow