diff --git a/internal/crypto/key_derivation.go b/internal/crypto/key_derivation.go index 5cffba590..89b9e1f12 100644 --- a/internal/crypto/key_derivation.go +++ b/internal/crypto/key_derivation.go @@ -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)) diff --git a/internal/crypto/null_aead_aesgcm.go b/internal/crypto/null_aead_aesgcm.go index 0b192b52b..92c6362f4 100644 --- a/internal/crypto/null_aead_aesgcm.go +++ b/internal/crypto/null_aead_aesgcm.go @@ -8,7 +8,7 @@ import ( "github.com/lucas-clemente/quic-go/internal/protocol" ) -var quicVersion1Salt = []byte{0xaf, 0xc8, 0x24, 0xec, 0x5f, 0xc7, 0x7e, 0xca, 0x1e, 0x9d, 0x36, 0xf3, 0x7f, 0xb2, 0xd4, 0x65, 0x18, 0xc3, 0x66, 0x39} +var quicVersion1Salt = []byte{0x9c, 0x10, 0x8f, 0x98, 0x52, 0x0a, 0x5c, 0x5c, 0x32, 0x96, 0x8e, 0x95, 0x0e, 0x8a, 0x2c, 0x5f, 0xe0, 0x6d, 0x6c, 0x38} func newNullAEADAESGCM(connectionID protocol.ConnectionID, pers protocol.Perspective) (AEAD, error) { clientSecret, serverSecret := computeSecrets(connectionID) diff --git a/internal/crypto/null_aead_aesgcm_test.go b/internal/crypto/null_aead_aesgcm_test.go index e5090b55b..d56641edf 100644 --- a/internal/crypto/null_aead_aesgcm_test.go +++ b/internal/crypto/null_aead_aesgcm_test.go @@ -14,16 +14,16 @@ var _ = Describe("NullAEAD using AES-GCM", func() { It("computes the secrets", func() { clientSecret, serverSecret := computeSecrets(connID) Expect(clientSecret).To(Equal([]byte{ - 0x8e, 0x28, 0x6a, 0x27, 0x38, 0xe6, 0x66, 0x50, - 0xb4, 0xf8, 0x8f, 0xac, 0x5d, 0xc5, 0xd0, 0xef, - 0x7d, 0x36, 0x9b, 0x07, 0xd4, 0x74, 0x42, 0x99, - 0x1a, 0x00, 0x0c, 0x55, 0xac, 0xc4, 0x0c, 0xf4, + 0x83, 0x55, 0xf2, 0x1a, 0x3d, 0x8f, 0x83, 0xec, + 0xb3, 0xd0, 0xf9, 0x71, 0x08, 0xd3, 0xf9, 0x5e, + 0x0f, 0x65, 0xb4, 0xd8, 0xae, 0x88, 0xa0, 0x61, + 0x1e, 0xe4, 0x9d, 0xb0, 0xb5, 0x23, 0x59, 0x1d, })) Expect(serverSecret).To(Equal([]byte{ - 0xfa, 0xb5, 0xb7, 0xf5, 0x26, 0xec, 0xaf, 0xaf, - 0x74, 0x71, 0x52, 0xdd, 0xaa, 0x88, 0x28, 0x56, - 0xf9, 0xbe, 0xd7, 0x48, 0x81, 0x1e, 0x37, 0xff, - 0xe1, 0xcb, 0xb1, 0x55, 0xe1, 0xc9, 0x91, 0xad, + 0xf8, 0x0e, 0x57, 0x71, 0x48, 0x4b, 0x21, 0xcd, + 0xeb, 0xb5, 0xaf, 0xe0, 0xa2, 0x56, 0xa3, 0x17, + 0x41, 0xef, 0xe2, 0xb5, 0xc6, 0xb6, 0x17, 0xba, + 0xe1, 0xb2, 0xf1, 0x5a, 0x83, 0x04, 0x83, 0xd6, })) }) @@ -31,12 +31,12 @@ var _ = Describe("NullAEAD using AES-GCM", func() { clientSecret, _ := computeSecrets(connID) key, iv := computeNullAEADKeyAndIV(clientSecret) Expect(key).To(Equal([]byte{ - 0x6b, 0x6a, 0xbc, 0x50, 0xf7, 0xac, 0x46, 0xd1, - 0x10, 0x8c, 0x19, 0xcc, 0x63, 0x64, 0xbd, 0xe3, + 0x3a, 0xd0, 0x54, 0x2c, 0x4a, 0x85, 0x84, 0x74, + 0x00, 0x63, 0x04, 0x9e, 0x3b, 0x3c, 0xaa, 0xb2, })) Expect(iv).To(Equal([]byte{ - 0xb1, 0xf9, 0xa7, 0xe2, 0x7c, 0xc2, 0x33, 0xbb, - 0x99, 0xe2, 0x03, 0x71, + 0xd1, 0xfd, 0x26, 0x05, 0x42, 0x75, 0x3a, 0xba, + 0x38, 0x58, 0x9b, 0xad, })) }) @@ -44,12 +44,12 @@ var _ = Describe("NullAEAD using AES-GCM", func() { _, serverSecret := computeSecrets(connID) key, iv := computeNullAEADKeyAndIV(serverSecret) Expect(key).To(Equal([]byte{ - 0x9e, 0xe7, 0xe8, 0x57, 0x72, 0x00, 0x59, 0xaf, - 0x30, 0x11, 0xfb, 0x26, 0xe1, 0x21, 0x42, 0xc9, + 0xbe, 0xe4, 0xc2, 0x4d, 0x2a, 0xf1, 0x33, 0x80, + 0xa9, 0xfa, 0x24, 0xa5, 0xe2, 0xba, 0x2c, 0xff, })) Expect(iv).To(Equal([]byte{ - 0xd5, 0xee, 0xe8, 0xb5, 0x7c, 0x9e, 0xc7, 0xc4, - 0xbe, 0x98, 0x4a, 0xa5, + 0x25, 0xb5, 0x8e, 0x24, 0x6d, 0x9e, 0x7d, 0x5f, + 0xfe, 0x43, 0x23, 0xfe, })) }) })