forked from quic-go/quic-go
randomly generate the server config ID and check whether it matches
This commit is contained in:
@@ -47,7 +47,8 @@ func (h *CryptoSetup) HandleCryptoMessage(data []byte) ([]byte, error) {
|
||||
return nil, errors.New("Session: expected CHLO")
|
||||
}
|
||||
|
||||
if _, ok := cryptoData[TagSCID]; ok {
|
||||
if scid, ok := cryptoData[TagSCID]; ok && bytes.Equal(h.scfg.ID, scid) {
|
||||
// We have a CHLO matching our server config, we can continue with the 0-RTT handshake
|
||||
var sharedSecret []byte
|
||||
sharedSecret, err = h.scfg.kex.CalculateSharedKey(cryptoData[TagPUBS])
|
||||
if err != nil {
|
||||
@@ -61,6 +62,8 @@ func (h *CryptoSetup) HandleCryptoMessage(data []byte) ([]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// We have an inacholate or non-matching CHLO, we now send a rejection
|
||||
|
||||
var chloOrNil []byte
|
||||
if h.version > protocol.VersionNumber(30) {
|
||||
chloOrNil = data
|
||||
|
||||
Reference in New Issue
Block a user