crypto/tls: pick the first group the client sent a key share for

Fixes NCC-2016-002
This commit is contained in:
Filippo Valsorda 2016-12-05 12:15:16 -05:00 committed by Peter Wu
parent 831410a948
commit 3e31621f57

3
13.go
View File

@ -31,11 +31,12 @@ func (hs *serverHandshakeState) doTLS13Handshake() error {
// that the client provided a keyShare for, so to avoid a round-trip.
// After that the order of CurvePreferences is respected.
var ks keyShare
CurvePreferenceLoop:
for _, curveID := range config.curvePreferences() {
for _, keyShare := range hs.clientHello.keyShares {
if curveID == keyShare.group {
ks = keyShare
break
break CurvePreferenceLoop
}
}
}