mirror of https://github.com/golang/go.git
crypto/x509/internal/macos: remove unused types and functions
Some of the types and functions in the macos package are unused since CL 353132. They can be removed. Change-Id: Ifb7c9619d3c77b83852e785b82877dfa3ca8fe6f Reviewed-on: https://go-review.googlesource.com/c/go/+/643277 Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
1118da2514
commit
52e32ad79e
|
|
@ -20,37 +20,6 @@ import (
|
|||
|
||||
// Based on https://opensource.apple.com/source/Security/Security-59306.41.2/base/Security.h
|
||||
|
||||
type SecTrustSettingsResult int32
|
||||
|
||||
const (
|
||||
SecTrustSettingsResultInvalid SecTrustSettingsResult = iota
|
||||
SecTrustSettingsResultTrustRoot
|
||||
SecTrustSettingsResultTrustAsRoot
|
||||
SecTrustSettingsResultDeny
|
||||
SecTrustSettingsResultUnspecified
|
||||
)
|
||||
|
||||
type SecTrustResultType int32
|
||||
|
||||
const (
|
||||
SecTrustResultInvalid SecTrustResultType = iota
|
||||
SecTrustResultProceed
|
||||
SecTrustResultConfirm // deprecated
|
||||
SecTrustResultDeny
|
||||
SecTrustResultUnspecified
|
||||
SecTrustResultRecoverableTrustFailure
|
||||
SecTrustResultFatalTrustFailure
|
||||
SecTrustResultOtherError
|
||||
)
|
||||
|
||||
type SecTrustSettingsDomain int32
|
||||
|
||||
const (
|
||||
SecTrustSettingsDomainUser SecTrustSettingsDomain = iota
|
||||
SecTrustSettingsDomainAdmin
|
||||
SecTrustSettingsDomainSystem
|
||||
)
|
||||
|
||||
const (
|
||||
// various macOS error codes that can be returned from
|
||||
// SecTrustEvaluateWithError that we can map to Go cert
|
||||
|
|
@ -69,54 +38,6 @@ func (s OSStatus) Error() string {
|
|||
return s.call + " error: " + strconv.Itoa(int(s.status))
|
||||
}
|
||||
|
||||
// Dictionary keys are defined as build-time strings with CFSTR, but the Go
|
||||
// linker's internal linking mode can't handle CFSTR relocations. Create our
|
||||
// own dynamic strings instead and just never release them.
|
||||
//
|
||||
// Note that this might be the only thing that can break over time if
|
||||
// these values change, as the ABI arguably requires using the strings
|
||||
// pointed to by the symbols, not values that happen to be equal to them.
|
||||
|
||||
var SecTrustSettingsResultKey = StringToCFString("kSecTrustSettingsResult")
|
||||
var SecTrustSettingsPolicy = StringToCFString("kSecTrustSettingsPolicy")
|
||||
var SecTrustSettingsPolicyString = StringToCFString("kSecTrustSettingsPolicyString")
|
||||
var SecPolicyOid = StringToCFString("SecPolicyOid")
|
||||
var SecPolicyAppleSSL = StringToCFString("1.2.840.113635.100.1.3") // defined by POLICYMACRO
|
||||
|
||||
var ErrNoTrustSettings = errors.New("no trust settings found")
|
||||
|
||||
const errSecNoTrustSettings = -25263
|
||||
|
||||
//go:cgo_import_dynamic x509_SecTrustSettingsCopyCertificates SecTrustSettingsCopyCertificates "/System/Library/Frameworks/Security.framework/Versions/A/Security"
|
||||
|
||||
func SecTrustSettingsCopyCertificates(domain SecTrustSettingsDomain) (certArray CFRef, err error) {
|
||||
ret := syscall(abi.FuncPCABI0(x509_SecTrustSettingsCopyCertificates_trampoline), uintptr(domain),
|
||||
uintptr(unsafe.Pointer(&certArray)), 0, 0, 0, 0)
|
||||
if int32(ret) == errSecNoTrustSettings {
|
||||
return 0, ErrNoTrustSettings
|
||||
} else if ret != 0 {
|
||||
return 0, OSStatus{"SecTrustSettingsCopyCertificates", int32(ret)}
|
||||
}
|
||||
return certArray, nil
|
||||
}
|
||||
func x509_SecTrustSettingsCopyCertificates_trampoline()
|
||||
|
||||
const errSecItemNotFound = -25300
|
||||
|
||||
//go:cgo_import_dynamic x509_SecTrustSettingsCopyTrustSettings SecTrustSettingsCopyTrustSettings "/System/Library/Frameworks/Security.framework/Versions/A/Security"
|
||||
|
||||
func SecTrustSettingsCopyTrustSettings(cert CFRef, domain SecTrustSettingsDomain) (trustSettings CFRef, err error) {
|
||||
ret := syscall(abi.FuncPCABI0(x509_SecTrustSettingsCopyTrustSettings_trampoline), uintptr(cert), uintptr(domain),
|
||||
uintptr(unsafe.Pointer(&trustSettings)), 0, 0, 0)
|
||||
if int32(ret) == errSecItemNotFound {
|
||||
return 0, ErrNoTrustSettings
|
||||
} else if ret != 0 {
|
||||
return 0, OSStatus{"SecTrustSettingsCopyTrustSettings", int32(ret)}
|
||||
}
|
||||
return trustSettings, nil
|
||||
}
|
||||
func x509_SecTrustSettingsCopyTrustSettings_trampoline()
|
||||
|
||||
//go:cgo_import_dynamic x509_SecTrustCreateWithCertificates SecTrustCreateWithCertificates "/System/Library/Frameworks/Security.framework/Versions/A/Security"
|
||||
|
||||
func SecTrustCreateWithCertificates(certs CFRef, policies CFRef) (CFRef, error) {
|
||||
|
|
@ -184,19 +105,6 @@ func SecTrustEvaluate(trustObj CFRef) (CFRef, error) {
|
|||
}
|
||||
func x509_SecTrustEvaluate_trampoline()
|
||||
|
||||
//go:cgo_import_dynamic x509_SecTrustGetResult SecTrustGetResult "/System/Library/Frameworks/Security.framework/Versions/A/Security"
|
||||
|
||||
func SecTrustGetResult(trustObj CFRef, result CFRef) (CFRef, CFRef, error) {
|
||||
var chain, info CFRef
|
||||
ret := syscall(abi.FuncPCABI0(x509_SecTrustGetResult_trampoline), uintptr(trustObj), uintptr(unsafe.Pointer(&result)),
|
||||
uintptr(unsafe.Pointer(&chain)), uintptr(unsafe.Pointer(&info)), 0, 0)
|
||||
if int32(ret) != 0 {
|
||||
return 0, 0, OSStatus{"SecTrustGetResult", int32(ret)}
|
||||
}
|
||||
return chain, info, nil
|
||||
}
|
||||
func x509_SecTrustGetResult_trampoline()
|
||||
|
||||
//go:cgo_import_dynamic x509_SecTrustEvaluateWithError SecTrustEvaluateWithError "/System/Library/Frameworks/Security.framework/Versions/A/Security"
|
||||
|
||||
func SecTrustEvaluateWithError(trustObj CFRef) (int, error) {
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@
|
|||
// The trampolines are ABIInternal as they are address-taken in
|
||||
// Go code.
|
||||
|
||||
TEXT ·x509_SecTrustSettingsCopyCertificates_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustSettingsCopyCertificates(SB)
|
||||
TEXT ·x509_SecTrustSettingsCopyTrustSettings_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustSettingsCopyTrustSettings(SB)
|
||||
TEXT ·x509_SecTrustCreateWithCertificates_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustCreateWithCertificates(SB)
|
||||
TEXT ·x509_SecCertificateCreateWithData_trampoline(SB),NOSPLIT,$0-0
|
||||
|
|
@ -23,8 +19,6 @@ TEXT ·x509_SecTrustSetVerifyDate_trampoline(SB),NOSPLIT,$0-0
|
|||
JMP x509_SecTrustSetVerifyDate(SB)
|
||||
TEXT ·x509_SecTrustEvaluate_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustEvaluate(SB)
|
||||
TEXT ·x509_SecTrustGetResult_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustGetResult(SB)
|
||||
TEXT ·x509_SecTrustEvaluateWithError_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP x509_SecTrustEvaluateWithError(SB)
|
||||
TEXT ·x509_SecTrustGetCertificateCount_trampoline(SB),NOSPLIT,$0-0
|
||||
|
|
|
|||
Loading…
Reference in New Issue