MCPcopy Create free account
hub / github.com/XTLS/Go / unmarshal

Method unmarshal

ticket.go:53–75  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

51}
52
53func (m *sessionState) unmarshal(data []byte) bool {
54 *m = sessionState{usedOldKey: m.usedOldKey}
55 s := cryptobyte.String(data)
56 if ok := s.ReadUint16(&m.vers) &&
57 s.ReadUint16(&m.cipherSuite) &&
58 readUint64(&s, &m.createdAt) &&
59 readUint16LengthPrefixed(&s, &m.masterSecret) &&
60 len(m.masterSecret) != 0; !ok {
61 return false
62 }
63 var certList cryptobyte.String
64 if !s.ReadUint24LengthPrefixed(&certList) {
65 return false
66 }
67 for !certList.Empty() {
68 var cert []byte
69 if !readUint24LengthPrefixed(&certList, &cert) {
70 return false
71 }
72 m.certificates = append(m.certificates, cert)
73 }
74 return s.Empty()
75}
76
77// sessionStateTLS13 is the content of a TLS 1.3 session ticket. Its first
78// version (revision = 0) doesn't carry any of the information needed for 0-RTT

Callers

nothing calls this directly

Calls 4

readUint64Function · 0.85
readUint16LengthPrefixedFunction · 0.85
readUint24LengthPrefixedFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected