Skip to content

Commit 4790181

Browse files
committed
all: remove support for macOS 10.9 and earlier
Updates #23122 Change-Id: I4c12ec5cb1a1f15d7858f3deab636710c0660e26 Reviewed-on: https://go-review.googlesource.com/115038 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 23b687e commit 4790181

File tree

3 files changed

+0
-83
lines changed

3 files changed

+0
-83
lines changed

src/crypto/x509/root_cgo_darwin.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,6 @@ package x509
1616
#include <CoreFoundation/CoreFoundation.h>
1717
#include <Security/Security.h>
1818
19-
// FetchPEMRoots_MountainLion is the version of FetchPEMRoots from Go 1.6
20-
// which still works on OS X 10.8 (Mountain Lion).
21-
// It lacks support for admin & user cert domains.
22-
// See golang.org/issue/16473
23-
int FetchPEMRoots_MountainLion(CFDataRef *pemRoots) {
24-
if (pemRoots == NULL) {
25-
return -1;
26-
}
27-
CFArrayRef certs = NULL;
28-
OSStatus err = SecTrustCopyAnchorCertificates(&certs);
29-
if (err != noErr) {
30-
return -1;
31-
}
32-
CFMutableDataRef combinedData = CFDataCreateMutable(kCFAllocatorDefault, 0);
33-
int i, ncerts = CFArrayGetCount(certs);
34-
for (i = 0; i < ncerts; i++) {
35-
CFDataRef data = NULL;
36-
SecCertificateRef cert = (SecCertificateRef)CFArrayGetValueAtIndex(certs, i);
37-
if (cert == NULL) {
38-
continue;
39-
}
40-
// Note: SecKeychainItemExport is deprecated as of 10.7 in favor of SecItemExport.
41-
// Once we support weak imports via cgo we should prefer that, and fall back to this
42-
// for older systems.
43-
err = SecKeychainItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data);
44-
if (err != noErr) {
45-
continue;
46-
}
47-
if (data != NULL) {
48-
CFDataAppendBytes(combinedData, CFDataGetBytePtr(data), CFDataGetLength(data));
49-
CFRelease(data);
50-
}
51-
}
52-
CFRelease(certs);
53-
*pemRoots = combinedData;
54-
return 0;
55-
}
56-
57-
// useOldCode reports whether the running machine is OS X 10.8 Mountain Lion
58-
// or older. We only support Mountain Lion and higher, but we'll at least try our
59-
// best on older machines and continue to use the old code path.
60-
//
61-
// See golang.org/issue/16473
62-
int useOldCode() {
63-
char str[256];
64-
size_t size = sizeof(str);
65-
memset(str, 0, size);
66-
sysctlbyname("kern.osrelease", str, &size, NULL, 0);
67-
// OS X 10.8 is osrelease "12.*", 10.7 is 11.*, 10.6 is 10.*.
68-
// We never supported things before that.
69-
return memcmp(str, "12.", 3) == 0 || memcmp(str, "11.", 3) == 0 || memcmp(str, "10.", 3) == 0;
70-
}
71-
7219
// FetchPEMRoots fetches the system's list of trusted X.509 root certificates.
7320
//
7421
// On success it returns 0 and fills pemRoots with a CFDataRef that contains the extracted root
@@ -80,10 +27,6 @@ int useOldCode() {
8027
int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots) {
8128
int i;
8229
83-
if (useOldCode()) {
84-
return FetchPEMRoots_MountainLion(pemRoots);
85-
}
86-
8730
// Get certificates from all domains, not just System, this lets
8831
// the user add CAs to their "login" keychain, and Admins to add
8932
// to the "System" keychain

src/net/fd_unix.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,6 @@ var tryDupCloexec = int32(1)
263263
func dupCloseOnExec(fd int) (newfd int, err error) {
264264
if atomic.LoadInt32(&tryDupCloexec) == 1 {
265265
r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD_CLOEXEC, 0)
266-
if runtime.GOOS == "darwin" && e1 == syscall.EBADF {
267-
// On OS X 10.6 and below (but we only support
268-
// >= 10.6), F_DUPFD_CLOEXEC is unsupported
269-
// and fcntl there falls back (undocumented)
270-
// to doing an ioctl instead, returning EBADF
271-
// in this case because fd is not of the
272-
// expected device fd type. Treat it as
273-
// EINVAL instead, so we fall back to the
274-
// normal dup path.
275-
// TODO: only do this on 10.6 if we can detect 10.6
276-
// cheaply.
277-
e1 = syscall.EINVAL
278-
}
279266
switch e1 {
280267
case 0:
281268
return int(r0), nil

src/runtime/crash_cgo_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,6 @@ func TestCgoExternalThreadSIGPROF(t *testing.T) {
8989
switch runtime.GOOS {
9090
case "plan9", "windows":
9191
t.Skipf("no pthreads on %s", runtime.GOOS)
92-
case "darwin":
93-
if runtime.GOARCH != "arm" && runtime.GOARCH != "arm64" {
94-
// static constructor needs external linking, but we don't support
95-
// external linking on OS X 10.6.
96-
out, err := exec.Command("uname", "-r").Output()
97-
if err != nil {
98-
t.Fatalf("uname -r failed: %v", err)
99-
}
100-
// OS X 10.6 == Darwin 10.x
101-
if strings.HasPrefix(string(out), "10.") {
102-
t.Skipf("no external linking on OS X 10.6")
103-
}
104-
}
10592
}
10693
if runtime.GOARCH == "ppc64" {
10794
// TODO(austin) External linking not implemented on

0 commit comments

Comments
 (0)