implement draft-10 changes for QHKDF-Expand

This commit is contained in:
Marten Seemann
2018-03-29 14:21:53 +07:00
parent 51b9820084
commit 469bad6350
3 changed files with 18 additions and 20 deletions

View File

@@ -20,9 +20,7 @@ type TLSExporter interface {
}
func qhkdfExpand(secret []byte, label string, length int) []byte {
// The last byte should be 0x0.
// Since Go initializes the slice to 0, we don't need to set it explicitly.
qlabel := make([]byte, 2+1+5+len(label)+1)
qlabel := make([]byte, 2+1+5+len(label))
binary.BigEndian.PutUint16(qlabel[0:2], uint16(length))
qlabel[2] = uint8(5 + len(label))
copy(qlabel[3:], []byte("QUIC "+label))