Skip to content

Commit 3fad58f

Browse files
committed
crypto/x509: update iOS bundled roots to version 55161.140.3
Extended the sorting logic to be stable even when there are two roots with the same name and notBefore timestamp, like the GlobalSign ones. Updates #38843 Change-Id: Ie4db0bb8b6a8b5ffbb7390b6bd527fc0c3badaca Reviewed-on: https://go-review.googlesource.com/c/go/+/266677 Reviewed-by: Katie Hockman <[email protected]> Trust: Filippo Valsorda <[email protected]>
1 parent 564ec48 commit 3fad58f

File tree

3 files changed

+41
-180
lines changed

3 files changed

+41
-180
lines changed

src/crypto/x509/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package x509
66

7-
//go:generate go run root_ios_gen.go -version 55161.80.1
7+
//go:generate go run root_ios_gen.go -version 55161.140.3
88

99
import "sync"
1010

src/crypto/x509/root_ios.go

+35-178
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/crypto/x509/root_ios_gen.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ func main() {
124124
if strings.ToLower(certName(certs[i])) != strings.ToLower(certName(certs[j])) {
125125
return strings.ToLower(certName(certs[i])) < strings.ToLower(certName(certs[j]))
126126
}
127-
return certs[i].NotBefore.Before(certs[j].NotBefore)
127+
if !certs[i].NotBefore.Equal(certs[j].NotBefore) {
128+
return certs[i].NotBefore.Before(certs[j].NotBefore)
129+
}
130+
fi, fj := sha256.Sum256(certs[i].Raw), sha256.Sum256(certs[j].Raw)
131+
return bytes.Compare(fi[:], fj[:]) < 0
128132
})
129133

130134
out := new(bytes.Buffer)

0 commit comments

Comments
 (0)