summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl/osclientcerts/src/bindings_macos.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /security/manager/ssl/osclientcerts/src/bindings_macos.rs
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'security/manager/ssl/osclientcerts/src/bindings_macos.rs')
-rw-r--r--security/manager/ssl/osclientcerts/src/bindings_macos.rs79
1 files changed, 79 insertions, 0 deletions
diff --git a/security/manager/ssl/osclientcerts/src/bindings_macos.rs b/security/manager/ssl/osclientcerts/src/bindings_macos.rs
new file mode 100644
index 0000000000..7294bbb555
--- /dev/null
+++ b/security/manager/ssl/osclientcerts/src/bindings_macos.rs
@@ -0,0 +1,79 @@
+/* -*- Mode: rust; rust-indent-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This was originally generated by rust-bindgen at build time. Later in
+// development it became clear that using bindgen for this library as part of
+// mozilla-central would be difficult (if not impossible). So, this was
+// converted to a static file and unused declarations were removed. Also,
+// intermediate types added by rust-bindgen were removed for clarity.
+
+pub type OSStatus = i32;
+pub const errSecSuccess: OSStatus = 0;
+pub const errSecItemNotFound: OSStatus = -25300;
+
+pub type SecKeyAlgorithm = CFStringRef;
+
+extern "C" {
+ // Available starting macOS 10.3
+ pub fn SecCertificateGetTypeID() -> CFTypeID;
+ pub fn SecTrustCreateWithCertificates(
+ certificates: SecCertificateRef,
+ policies: SecPolicyRef,
+ trust: *mut SecTrustRef,
+ ) -> OSStatus;
+ pub fn SecIdentityGetTypeID() -> CFTypeID;
+ pub fn SecIdentityCopyCertificate(
+ identityRef: SecIdentityRef,
+ certificateRef: *mut SecCertificateRef,
+ ) -> OSStatus;
+ pub fn SecIdentityCopyPrivateKey(
+ identityRef: SecIdentityRef,
+ privateKeyRef: *mut SecKeyRef,
+ ) -> OSStatus;
+ pub fn SecKeyGetTypeID() -> CFTypeID;
+ pub fn SecPolicyGetTypeID() -> CFTypeID;
+ pub fn SecTrustGetTypeID() -> CFTypeID;
+
+ // Available starting macOS 10.6
+ pub fn SecCertificateCopyData(certificate: SecCertificateRef) -> CFDataRef;
+ pub fn SecCertificateCopySubjectSummary(certificate: SecCertificateRef) -> CFStringRef;
+ pub fn SecItemCopyMatching(query: CFDictionaryRef, result: *mut CFTypeRef) -> OSStatus;
+ pub fn SecPolicyCreateSSL(server: bool, hostname: CFStringRef) -> SecPolicyRef;
+ pub static kSecClass: CFStringRef;
+ pub static kSecAttrKeyType: CFStringRef;
+ pub static kSecAttrKeySizeInBits: CFStringRef;
+ pub static kSecMatchLimit: CFStringRef;
+ pub static kSecMatchLimitAll: CFStringRef;
+ pub static kSecReturnRef: CFStringRef;
+
+ // Available starting macOS 10.7
+ pub fn SecTrustGetCertificateAtIndex(trust: SecTrustRef, ix: CFIndex) -> SecCertificateRef;
+ pub fn SecTrustGetCertificateCount(trust: SecTrustRef) -> CFIndex;
+ pub static kSecClassIdentity: CFStringRef;
+ pub static kSecAttrKeyTypeRSA: CFStringRef;
+
+ // Available starting macOS 10.9
+ pub fn SecTrustSetNetworkFetchAllowed(trust: SecTrustRef, allowFetch: Boolean) -> OSStatus;
+
+ // Available starting macOS 10.12
+ pub fn SecKeyCreateSignature(
+ key: SecKeyRef,
+ algorithm: SecKeyAlgorithm,
+ data: CFDataRef,
+ err: *mut CFErrorRef,
+ ) -> CFDataRef;
+ pub fn SecKeyCopyAttributes(key: SecKeyRef) -> CFDictionaryRef;
+ pub fn SecKeyCopyExternalRepresentation(key: SecKeyRef, err: *mut CFErrorRef) -> CFDataRef;
+ pub static kSecKeyAlgorithmECDSASignatureDigestX962SHA1: CFStringRef;
+ pub static kSecKeyAlgorithmECDSASignatureDigestX962SHA256: CFStringRef;
+ pub static kSecKeyAlgorithmECDSASignatureDigestX962SHA384: CFStringRef;
+ pub static kSecKeyAlgorithmECDSASignatureDigestX962SHA512: CFStringRef;
+ pub static kSecKeyAlgorithmRSASignatureDigestPKCS1v15Raw: CFStringRef;
+ pub static kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA256: CFStringRef;
+ pub static kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA384: CFStringRef;
+ pub static kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA512: CFStringRef;
+ pub static kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA1: CFStringRef;
+ pub static kSecAttrKeyTypeECSECPrimeRandom: CFStringRef;
+}