Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
13713ed3
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
13713ed3
编写于
4月 05, 2020
作者:
X
xuelei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8215711: Missing key_share extension for (EC)DHE key exchange should alert missing_extension
Reviewed-by: ascarpino
上级
6b2c0a86
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
103 addition
and
5 deletion
+103
-5
src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java
...ase/share/classes/sun/security/ssl/KeyShareExtension.java
+32
-0
src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java
...share/classes/sun/security/ssl/PreSharedKeyExtension.java
+35
-2
src/java.base/share/classes/sun/security/ssl/SSLExtension.java
...ava.base/share/classes/sun/security/ssl/SSLExtension.java
+5
-3
src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
...re/classes/sun/security/ssl/SupportedGroupsExtension.java
+31
-0
未找到文件。
src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java
浏览文件 @
13713ed3
...
...
@@ -59,6 +59,8 @@ final class KeyShareExtension {
new
CHKeyShareProducer
();
static
final
ExtensionConsumer
chOnLoadConsumer
=
new
CHKeyShareConsumer
();
static
final
HandshakeAbsence
chOnTradAbsence
=
new
CHKeyShareOnTradeAbsence
();
static
final
SSLStringizer
chStringizer
=
new
CHKeyShareStringizer
();
...
...
@@ -410,6 +412,36 @@ final class KeyShareExtension {
}
}
/**
* The absence processing if the extension is not present in
* a ClientHello handshake message.
*/
private
static
final
class
CHKeyShareOnTradeAbsence
implements
HandshakeAbsence
{
@Override
public
void
absent
(
ConnectionContext
context
,
HandshakeMessage
message
)
throws
IOException
{
// The producing happens in server side only.
ServerHandshakeContext
shc
=
(
ServerHandshakeContext
)
context
;
// A client is considered to be attempting to negotiate using this
// specification if the ClientHello contains a "supported_versions"
// extension with 0x0304 contained in its body. Such a ClientHello
// message MUST meet the following requirements:
// - If containing a "supported_groups" extension, it MUST also
// contain a "key_share" extension, and vice versa. An empty
// KeyShare.client_shares vector is permitted.
if
(
shc
.
negotiatedProtocol
.
useTLS13PlusSpec
()
&&
shc
.
handshakeExtensions
.
containsKey
(
SSLExtension
.
CH_SUPPORTED_GROUPS
))
{
throw
shc
.
conContext
.
fatal
(
Alert
.
MISSING_EXTENSION
,
"No key_share extension to work with "
+
"the supported_groups extension"
);
}
}
}
/**
* The key share entry used in ServerHello "key_share" extensions.
*/
...
...
src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java
浏览文件 @
13713ed3
...
...
@@ -53,9 +53,11 @@ final class PreSharedKeyExtension {
static
final
ExtensionConsumer
chOnLoadConsumer
=
new
CHPreSharedKeyConsumer
();
static
final
HandshakeAbsence
chOnLoadAbsence
=
new
CHPreSharedKeyAbsence
();
new
CHPreSharedKey
OnLoad
Absence
();
static
final
HandshakeConsumer
chOnTradeConsumer
=
new
CHPreSharedKeyUpdate
();
static
final
HandshakeAbsence
chOnTradAbsence
=
new
CHPreSharedKeyOnTradeAbsence
();
static
final
SSLStringizer
chStringizer
=
new
CHPreSharedKeyStringizer
();
...
...
@@ -795,7 +797,7 @@ final class PreSharedKeyExtension {
}
private
static
final
class
CHPreSharedKeyAbsence
implements
HandshakeAbsence
{
class
CHPreSharedKey
OnLoad
Absence
implements
HandshakeAbsence
{
@Override
public
void
absent
(
ConnectionContext
context
,
HandshakeMessage
message
)
throws
IOException
{
...
...
@@ -813,6 +815,37 @@ final class PreSharedKeyExtension {
}
}
/**
* The absence processing if the extension is not present in
* a ClientHello handshake message.
*/
private
static
final
class
CHPreSharedKeyOnTradeAbsence
implements
HandshakeAbsence
{
@Override
public
void
absent
(
ConnectionContext
context
,
HandshakeMessage
message
)
throws
IOException
{
// The producing happens in server side only.
ServerHandshakeContext
shc
=
(
ServerHandshakeContext
)
context
;
// A client is considered to be attempting to negotiate using this
// specification if the ClientHello contains a "supported_versions"
// extension with 0x0304 contained in its body. Such a ClientHello
// message MUST meet the following requirements:
// - If not containing a "pre_shared_key" extension, it MUST
// contain both a "signature_algorithms" extension and a
// "supported_groups" extension.
if
(
shc
.
negotiatedProtocol
.
useTLS13PlusSpec
()
&&
(!
shc
.
handshakeExtensions
.
containsKey
(
SSLExtension
.
CH_SIGNATURE_ALGORITHMS
)
||
!
shc
.
handshakeExtensions
.
containsKey
(
SSLExtension
.
CH_SUPPORTED_GROUPS
)))
{
throw
shc
.
conContext
.
fatal
(
Alert
.
MISSING_EXTENSION
,
"No supported_groups or signature_algorithms extension "
+
"when pre_shared_key extension is not present"
);
}
}
}
private
static
final
class
SHPreSharedKeyConsumer
implements
ExtensionConsumer
{
// Prevent instantiation of this class.
...
...
src/java.base/share/classes/sun/security/ssl/SSLExtension.java
浏览文件 @
13713ed3
...
...
@@ -142,7 +142,7 @@ enum SSLExtension implements SSLStringizer {
SupportedGroupsExtension
.
chOnLoadConsumer
,
null
,
null
,
null
,
SupportedGroupsExtension
.
chOnTradAbsence
,
SupportedGroupsExtension
.
sgsStringizer
),
EE_SUPPORTED_GROUPS
(
0x000A
,
"supported_groups"
,
SSLHandshake
.
ENCRYPTED_EXTENSIONS
,
...
...
@@ -396,7 +396,9 @@ enum SSLExtension implements SSLStringizer {
ProtocolVersion
.
PROTOCOLS_OF_13
,
KeyShareExtension
.
chNetworkProducer
,
KeyShareExtension
.
chOnLoadConsumer
,
null
,
null
,
null
,
null
,
null
,
KeyShareExtension
.
chOnTradAbsence
,
KeyShareExtension
.
chStringizer
),
SH_KEY_SHARE
(
0x0033
,
"key_share"
,
SSLHandshake
.
SERVER_HELLO
,
...
...
@@ -449,7 +451,7 @@ enum SSLExtension implements SSLStringizer {
PreSharedKeyExtension
.
chOnLoadConsumer
,
PreSharedKeyExtension
.
chOnLoadAbsence
,
PreSharedKeyExtension
.
chOnTradeConsumer
,
null
,
PreSharedKeyExtension
.
chOnTradAbsence
,
PreSharedKeyExtension
.
chStringizer
),
SH_PRE_SHARED_KEY
(
0x0029
,
"pre_shared_key"
,
SSLHandshake
.
SERVER_HELLO
,
...
...
src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
浏览文件 @
13713ed3
...
...
@@ -61,6 +61,8 @@ final class SupportedGroupsExtension {
new
CHSupportedGroupsProducer
();
static
final
ExtensionConsumer
chOnLoadConsumer
=
new
CHSupportedGroupsConsumer
();
static
final
HandshakeAbsence
chOnTradAbsence
=
new
CHSupportedGroupsOnTradeAbsence
();
static
final
SSLStringizer
sgsStringizer
=
new
SupportedGroupsStringizer
();
...
...
@@ -913,6 +915,35 @@ final class SupportedGroupsExtension {
}
}
/**
* The absence processing if the extension is not present in
* a ClientHello handshake message.
*/
private
static
final
class
CHSupportedGroupsOnTradeAbsence
implements
HandshakeAbsence
{
@Override
public
void
absent
(
ConnectionContext
context
,
HandshakeMessage
message
)
throws
IOException
{
// The producing happens in server side only.
ServerHandshakeContext
shc
=
(
ServerHandshakeContext
)
context
;
// A client is considered to be attempting to negotiate using this
// specification if the ClientHello contains a "supported_versions"
// extension with 0x0304 contained in its body. Such a ClientHello
// message MUST meet the following requirements:
// - If containing a "supported_groups" extension, it MUST also
// contain a "key_share" extension, and vice versa. An empty
// KeyShare.client_shares vector is permitted.
if
(
shc
.
negotiatedProtocol
.
useTLS13PlusSpec
()
&&
shc
.
handshakeExtensions
.
containsKey
(
SSLExtension
.
CH_KEY_SHARE
))
{
throw
shc
.
conContext
.
fatal
(
Alert
.
MISSING_EXTENSION
,
"No supported_groups extension to work with "
+
"the key_share extension"
);
}
}
}
/**
* Network data producer of a "supported_groups" extension in
* the EncryptedExtensions handshake message.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录