1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:40:22 -07:00

crypto/x509: use macOS/AMD64 implementation on macOS/ARM64

Updates #38485.

Change-Id: I0582a53171ce803ca1b0237cfa9bc022fc1da6f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/260340
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Cherry Zhang 2020-10-06 21:13:16 -04:00
parent 83dfc0d02d
commit ade5161f51
10 changed files with 31 additions and 14 deletions

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,amd64
// +build darwin,!ios
// Package macOS provides cgo-less wrappers for Core Foundation and
// Security.framework, similarly to how package syscall provides access to

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,amd64
// +build darwin,!ios
#include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,amd64
// +build darwin,!ios
package macOS

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,amd64
// +build darwin,!ios
#include "textflag.h"

View File

@ -4,7 +4,7 @@
package x509
//go:generate go run root_darwin_ios_gen.go -version 55161.80.1
//go:generate go run root_ios_gen.go -version 55161.80.1
import "sync"

View File

@ -1,7 +1,7 @@
// Code generated by root_darwin_ios_gen.go -version 55161.80.1; DO NOT EDIT.
// Code generated by root_ios_gen.go -version 55161.80.1; DO NOT EDIT.
// Update the version in root.go and regenerate with "go generate".
// +build darwin,arm64 darwin,amd64,ios
// +build ios
// +build !x509omitbundledroots
package x509

View File

@ -4,7 +4,7 @@
// +build ignore
// Generates root_darwin_iosx.go.
// Generates root_ios.go.
//
// As of iOS 13, there is no API for querying the system trusted X.509 root
// certificates.
@ -37,10 +37,7 @@ import (
)
func main() {
// Temporarily name the file _iosx.go, to avoid restricting it to GOOS=ios,
// as this is also used for darwin/arm64 (macOS).
// TODO: maybe use darwin/amd64 implementation on macOS arm64?
var output = flag.String("output", "root_darwin_iosx.go", "file name to write")
var output = flag.String("output", "root_ios.go", "file name to write")
var version = flag.String("version", "", "security_certificates version")
flag.Parse()
if *version == "" {
@ -159,10 +156,10 @@ func main() {
}
}
const header = `// Code generated by root_darwin_ios_gen.go -version %s; DO NOT EDIT.
const header = `// Code generated by root_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 ios
// +build !x509omitbundledroots
package x509

View File

@ -707,3 +707,23 @@ TEXT runtime·syscall6X(SB),NOSPLIT,$0
MOVD R0, 72(R2) // save err
ok:
RET
// syscallNoErr is like syscall6 but does not check for errors, and
// only returns one value, for use with standard C ABI library functions.
TEXT runtime·syscallNoErr(SB),NOSPLIT,$0
SUB $16, RSP // push structure pointer
MOVD R0, (RSP)
MOVD 0(R0), R12 // fn
MOVD 16(R0), R1 // a2
MOVD 24(R0), R2 // a3
MOVD 32(R0), R3 // a4
MOVD 40(R0), R4 // a5
MOVD 48(R0), R5 // a6
MOVD 8(R0), R0 // a1
BL (R12)
MOVD (RSP), R2 // pop structure pointer
ADD $16, RSP
MOVD R0, 56(R2) // save r1
RET