Commit 20389553 authored by Joel Sing's avatar Joel Sing Committed by Filippo Valsorda

crypto/tls: simplify intermediate certificate handling

The certificates argument to verifyServerCertificate must contain
at least one certificate. Simplify the intermediate certificate
handling code accordingly.

Change-Id: I8292cdfb51f418e011d6d97f47d10b4e631aa932
Reviewed-on: https://go-review.googlesource.com/c/go/+/169657Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
parent 2d683807
......@@ -826,11 +826,7 @@ func (c *Conn) verifyServerCertificate(certificates [][]byte) error {
DNSName: c.config.ServerName,
Intermediates: x509.NewCertPool(),
}
for i, cert := range certs {
if i == 0 {
continue
}
for _, cert := range certs[1:] {
opts.Intermediates.AddCert(cert)
}
var err error
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment