Skip to content

Commit

Permalink
crypto/x509: restore support for ios tag on darwin/amd64
Browse files Browse the repository at this point in the history
Fixes #38710

Change-Id: I9b210e95fd997ff53ec704c5f61110045aaa94bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/239559
Run-TryBot: Filippo Valsorda <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
FiloSottile committed Jun 24, 2020
1 parent 3e95c5b commit 72019cf
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 7 deletions.
12 changes: 12 additions & 0 deletions src/cmd/dist/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,18 @@ func (t *tester) registerTests() {
})
}

// Test the ios build tag on darwin/amd64 for the iOS simulator.
if goos == "darwin" && !t.iOS() {
t.tests = append(t.tests, distTest{
name: "amd64ios",
heading: "ios tag on darwin/amd64",
fn: func(dt *distTest) error {
t.addCmd(dt, "src", t.goTest(), t.timeout(300), "-tags=ios", "-run=SystemRoots", "crypto/x509")
return nil
},
})
}

if t.race {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package x509

//go:generate go run root_darwin_arm64_gen.go -version 55161.80.1
//go:generate go run root_darwin_ios_gen.go -version 55161.80.1

import "sync"

Expand Down
2 changes: 2 additions & 0 deletions src/crypto/x509/root_cgo_darwin_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !ios

package x509

// This cgo implementation exists only to support side-by-side testing by
Expand Down
2 changes: 2 additions & 0 deletions src/crypto/x509/root_darwin_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !ios

package x509

import (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// +build ignore

// Generates root_darwin_arm64.go.
// Generates root_darwin_ios.go.
//
// As of iOS 13, there is no API for querying the system trusted X.509 root
// certificates.
Expand Down Expand Up @@ -37,7 +37,7 @@ import (
)

func main() {
var output = flag.String("output", "root_darwin_arm64.go", "file name to write")
var output = flag.String("output", "root_darwin_ios.go", "file name to write")
var version = flag.String("version", "", "security_certificates version")
flag.Parse()
if *version == "" {
Expand Down Expand Up @@ -156,9 +156,10 @@ func main() {
}
}

const header = `// Code generated by root_darwin_arm64_gen.go -version %s; DO NOT EDIT.
const header = `// Code generated by root_darwin_ios_gen.go -version %s; DO NOT EDIT.
// Update the version in root.go and regenerate with "go generate".
// +build darwin,arm64 darwin,amd64,ios
// +build !x509omitbundledroots
package x509
Expand Down
3 changes: 2 additions & 1 deletion src/crypto/x509/root_omit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin,arm64,x509omitbundledroots
// +build darwin,arm64 darwin,amd64,ios
// +build x509omitbundledroots

// This file provides the loadSystemRoots func when the
// "x509omitbundledroots" build tag has disabled bundling a copy,
Expand Down
3 changes: 2 additions & 1 deletion src/crypto/x509/root_omit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin,arm64,x509omitbundledroots
// +build darwin,arm64 darwin,amd64,ios
// +build x509omitbundledroots

package x509

Expand Down

0 comments on commit 72019cf

Please sign in to comment.