Skip to content

Commit 11f6cb4

Browse files
tklauserbradfitz
authored andcommitted
crypto/x509: use SecItemExport instead of deprecated SecKeychainItemExport
SecKeychainItemExport is deprecated as of macOS 10.7. The minimum supported version is macOS 10.10, so use SecItemExport instead. While at it also bump macosx-version-min to 10.10 and __MAC_OS_X_VERSION_MAX_ALLOWED to 101300 (for macOS 10.13). Tested on macOS 10.10, 10.11 and 10.12. Updates #23122 Change-Id: Id4cd6a5cea93315791253dc248e40e5615760a6c Reviewed-on: https://go-review.googlesource.com/116396 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 7c1f361 commit 11f6cb4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/crypto/x509/root_cgo_darwin.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
package x509
88

99
/*
10-
#cgo CFLAGS: -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1080
10+
#cgo CFLAGS: -mmacosx-version-min=10.10 -D__MAC_OS_X_VERSION_MAX_ALLOWED=101300
1111
#cgo LDFLAGS: -framework CoreFoundation -framework Security
1212
1313
#include <errno.h>
@@ -136,10 +136,7 @@ int FetchPEMRoots(CFDataRef *pemRoots, CFDataRef *untrustedPemRoots) {
136136
}
137137
}
138138
139-
// Note: SecKeychainItemExport is deprecated as of 10.7 in favor of SecItemExport.
140-
// Once we support weak imports via cgo we should prefer that, and fall back to this
141-
// for older systems.
142-
err = SecKeychainItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data);
139+
err = SecItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data);
143140
if (err != noErr) {
144141
continue;
145142
}

0 commit comments

Comments
 (0)