implement the Retry integrity tag

This commit is contained in:
Marten Seemann 2019-11-22 10:33:52 +08:00
parent 9ea9c7947f
commit 7b10453af8
10 changed files with 95 additions and 111 deletions

View file

@ -83,15 +83,6 @@ func main() {
Length: protocol.ByteCount(rand.Intn(1000)),
Version: version,
},
wire.Header{ // Retry Packet
IsLongHeader: true,
SrcConnectionID: protocol.ConnectionID(getRandomData(8)),
DestConnectionID: protocol.ConnectionID(getRandomData(9)),
OrigDestConnectionID: protocol.ConnectionID(getRandomData(10)),
Type: protocol.PacketTypeRetry,
Token: getRandomData(10),
Version: version,
},
wire.Header{ // Retry Packet, with empty orig dest conn id
IsLongHeader: true,
SrcConnectionID: protocol.ConnectionID(getRandomData(8)),
@ -100,14 +91,6 @@ func main() {
Token: getRandomData(1000),
Version: version,
},
wire.Header{ // Retry Packet, with zero-length dest conn id
IsLongHeader: true,
SrcConnectionID: protocol.ConnectionID(getRandomData(8)),
OrigDestConnectionID: protocol.ConnectionID(getRandomData(10)),
Type: protocol.PacketTypeRetry,
Token: getRandomData(1000),
Version: version,
},
wire.Header{ // Short-Header
DestConnectionID: protocol.ConnectionID(getRandomData(8)),
},
@ -123,6 +106,9 @@ func main() {
if err := extHdr.Write(b, version); err != nil {
panic(err)
}
if h.Type == protocol.PacketTypeRetry {
b.Write([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})
}
if h.Length > 0 {
b.Write(make([]byte, h.Length))
}