]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/x509: use macOS/AMD64 implementation on macOS/ARM64
authorCherry Zhang <cherryyz@google.com>
Wed, 7 Oct 2020 01:13:16 +0000 (21:13 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 7 Oct 2020 20:18:35 +0000 (20:18 +0000)
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>
src/crypto/x509/internal/macos/corefoundation.go
src/crypto/x509/internal/macos/corefoundation.s
src/crypto/x509/internal/macos/security.go
src/crypto/x509/internal/macos/security.s
src/crypto/x509/root.go
src/crypto/x509/root_cgo_darwin.go [moved from src/crypto/x509/root_cgo_darwin_amd64.go with 100% similarity]
src/crypto/x509/root_darwin.go [moved from src/crypto/x509/root_darwin_amd64.go with 100% similarity]
src/crypto/x509/root_ios.go [moved from src/crypto/x509/root_darwin_iosx.go with 99% similarity]
src/crypto/x509/root_ios_gen.go [moved from src/crypto/x509/root_darwin_ios_gen.go with 90% similarity]
src/runtime/sys_darwin_arm64.s

index 359694fabf2694eac06fe725fa67893b40d64f93..a248ee3292d03893a67cda944249b8cb68789c3f 100644 (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
index 8f6be47e4b57e32f91b05ad4cfbb0fc96c67dd6b..a4495d68dd3575bda0423647dd4dee296ab8ceb4 100644 (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"
 
index 64fe20639019d9cc339a586935aba3ca11d3d363..59cc19c5878d15565caab7b1114c7192477221cf 100644 (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
 
index 1630c55bab256b42303836f2dea24272b79a75ed..bd446dbcbe260fa0b310667ef3dc96faa54a63cf 100644 (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"
 
index da5e91b91cc3a602d30532922ce7eceef2dc591d..eccb64121fa21da26bfb84052280a5778b9ab98c 100644 (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"
 
similarity index 99%
rename from src/crypto/x509/root_darwin_iosx.go
rename to src/crypto/x509/root_ios.go
index 5ecc4911b356ce7cadc4ddb9de1b54da4d8cdd46..98e747733a5b0d1847f21c3e624db736ca13bfb4 100644 (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
similarity index 90%
rename from src/crypto/x509/root_darwin_ios_gen.go
rename to src/crypto/x509/root_ios_gen.go
index 61152b4d112640f901fa67d23af1d13fc1628ab3..34dd5d5b227776cfa7c465907f82512c1ddae5c1 100644 (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
index 427cb177812119c952d5ffa049f2cf14e56bdf1a..f8d6f28dc75b915cf80b09fc38e5643ed75c232b 100644 (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