Skip to content

Commit 5abccec

Browse files
Juktongmingyech
authored andcommitted
refactor: only keeps the second approach and passes test in the same way with severHelloMsg and clientHelloMsg
1 parent 69c3729 commit 5abccec

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

common.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ const (
116116
extensionStatusRequestV2 uint16 = 17
117117
extensionSCT uint16 = 18
118118
extensionExtendedMasterSecret uint16 = 23
119-
extensionCompressCertificate uint16 = 27
120119
extensionDelegatedCredentials uint16 = 34
121120
extensionSessionTicket uint16 = 35
122121
extensionPreSharedKey uint16 = 41

examples/ech/sslkeylogging.log

Lines changed: 0 additions & 4 deletions
This file was deleted.

handshake_messages.go

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,12 +1276,11 @@ func (m *newSessionTicketMsgTLS13) unmarshal(data []byte) bool {
12761276
}
12771277

12781278
type certificateRequestMsgTLS13 struct {
1279-
original []byte
1279+
original []byte // [uTLS]
12801280
ocspStapling bool
12811281
scts bool
12821282
supportedSignatureAlgorithms []SignatureScheme
12831283
supportedSignatureAlgorithmsCert []SignatureScheme
1284-
certRequestCompressionAlgs []CertCompressionAlgo
12851284
certificateAuthorities [][]byte
12861285
}
12871286

@@ -1317,17 +1316,6 @@ func (m *certificateRequestMsgTLS13) marshal() ([]byte, error) {
13171316
})
13181317
})
13191318
}
1320-
if len(m.certRequestCompressionAlgs) > 0 {
1321-
b.AddUint16(extensionCompressCertificate)
1322-
b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
1323-
b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) {
1324-
for _, algo := range m.certRequestCompressionAlgs {
1325-
b.AddUint16(uint16(algo))
1326-
}
1327-
})
1328-
})
1329-
}
1330-
13311319
if len(m.supportedSignatureAlgorithmsCert) > 0 {
13321320
b.AddUint16(extensionSignatureAlgorithmsCert)
13331321
b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
@@ -1357,7 +1345,7 @@ func (m *certificateRequestMsgTLS13) marshal() ([]byte, error) {
13571345
}
13581346

13591347
func (m *certificateRequestMsgTLS13) unmarshal(data []byte) bool {
1360-
*m = certificateRequestMsgTLS13{original: data}
1348+
*m = certificateRequestMsgTLS13{original: data} // [uTLS]
13611349
s := cryptobyte.String(data)
13621350

13631351
var context, extensions cryptobyte.String
@@ -1394,19 +1382,6 @@ func (m *certificateRequestMsgTLS13) unmarshal(data []byte) bool {
13941382
m.supportedSignatureAlgorithms = append(
13951383
m.supportedSignatureAlgorithms, SignatureScheme(sigAndAlg))
13961384
}
1397-
case extensionCompressCertificate:
1398-
var algs cryptobyte.String
1399-
if !extData.ReadUint8LengthPrefixed(&algs) || algs.Empty() {
1400-
return false
1401-
}
1402-
for !algs.Empty() {
1403-
var alg uint16
1404-
if !algs.ReadUint16(&alg) {
1405-
return false
1406-
}
1407-
m.certRequestCompressionAlgs = append(
1408-
m.certRequestCompressionAlgs, CertCompressionAlgo(alg))
1409-
}
14101385
case extensionSignatureAlgorithmsCert:
14111386
var sigAndAlgs cryptobyte.String
14121387
if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() {
@@ -1445,10 +1420,13 @@ func (m *certificateRequestMsgTLS13) unmarshal(data []byte) bool {
14451420
return true
14461421
}
14471422

1423+
// [UTLS SECTION BEGINS]
14481424
func (m *certificateRequestMsgTLS13) originalBytes() []byte {
14491425
return m.original
14501426
}
14511427

1428+
// [UTLS SECTION ENDS]
1429+
14521430
type certificateMsg struct {
14531431
certificates [][]byte
14541432
}

handshake_messages_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func TestMarshalUnmarshal(t *testing.T) {
9898
t.original = nil
9999
case *serverHelloMsg:
100100
t.original = nil
101+
case *certificateRequestMsgTLS13: // [UTLS]
102+
t.original = nil // [UTLS]
101103
}
102104

103105
if !reflect.DeepEqual(m1, m) {

0 commit comments

Comments
 (0)