summaryrefslogtreecommitdiff
path: root/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java')
-rw-r--r--src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java
index be5814acc50..19fa2584ad8 100644
--- a/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java
+++ b/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -92,6 +92,15 @@ final class ServerKeyExchange {
// clean up this consumer
chc.handshakeConsumers.remove(SSLHandshake.SERVER_KEY_EXCHANGE.id);
+ // If the Certificate consumer is still registered, the server
+ // omitted the required Certificate message before sending
+ // ServerKeyExchange.
+ if (chc.handshakeConsumers.containsKey(
+ SSLHandshake.CERTIFICATE.id)) {
+ throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+ "Unexpected ServerKeyExchange handshake message.");
+ }
+
// Any receipt/consumption of the CertificateRequest before
// ServerKeyExchange is a state machine violation. We may not
// know for sure if an early CR message is a violation though until
@@ -131,4 +140,3 @@ final class ServerKeyExchange {
}
}
}
-