瀏覽代碼

crypto/tls: avoid sending empty OCSP or SCT cert extensions

v1.2.3
Filippo Valsorda 7 年之前
committed by Peter Wu
父節點
當前提交
80f82d89c7
共有 1 個檔案被更改,包括 4 行新增4 行删除
  1. +4
    -4
      handshake_messages.go

+ 4
- 4
handshake_messages.go 查看文件

@@ -1419,10 +1419,10 @@ func (m *certificateMsg13) marshal() (x []byte) {
var i int
for _, cert := range m.certificates {
i += len(cert.data)
if cert.ocspStaple != nil {
if len(cert.ocspStaple) != 0 {
i += 8 + len(cert.ocspStaple)
}
if cert.sctList != nil {
if len(cert.sctList) != 0 {
i += 4
for _, sct := range cert.sctList {
i += 2 + len(sct)
@@ -1462,7 +1462,7 @@ func (m *certificateMsg13) marshal() (x []byte) {
z = z[2:]

extensionLen := 0
if cert.ocspStaple != nil {
if len(cert.ocspStaple) != 0 {
stapleLen := 4 + len(cert.ocspStaple)
z[0] = uint8(extensionStatusRequest >> 8)
z[1] = uint8(extensionStatusRequest)
@@ -1479,7 +1479,7 @@ func (m *certificateMsg13) marshal() (x []byte) {

extensionLen += 8 + stapleLen
}
if cert.sctList != nil {
if len(cert.sctList) != 0 {
z[0] = uint8(extensionSCT >> 8)
z[1] = uint8(extensionSCT)
sctLenPos := z[2:4]


Loading…
取消
儲存