Skip to content

Commit

Permalink
Merge pull request #201 from simlay/add-visionos-support
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski authored May 21, 2024
2 parents f27b7f3 + ce824b5 commit ea683f2
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 112 deletions.
10 changes: 5 additions & 5 deletions security-framework-sys/src/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core_foundation_sys::base::{CFAllocatorRef, CFTypeID, OSStatus};
use core_foundation_sys::data::CFDataRef;
#[cfg(target_os = "macos")]
use core_foundation_sys::dictionary::CFDictionaryRef;
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use core_foundation_sys::error::CFErrorRef;
use core_foundation_sys::string::CFStringRef;

Expand Down Expand Up @@ -55,9 +55,9 @@ extern "C" {
certificate: SecCertificateRef,
email_addresses: *mut CFArrayRef,
) -> OSStatus;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecCertificateCopyNormalizedIssuerSequence(certificate: SecCertificateRef) -> CFDataRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecCertificateCopyNormalizedSubjectSequence(certificate: SecCertificateRef)
-> CFDataRef;
#[cfg(target_os = "macos")]
Expand All @@ -67,9 +67,9 @@ extern "C" {
certificate: SecCertificateRef,
key: *mut SecKeyRef,
) -> OSStatus;
#[cfg(any(feature = "OSX_10_14", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_14", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecCertificateCopyKey(certificate: SecCertificateRef) -> SecKeyRef;
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecCertificateCopySerialNumberData(
certificate: SecCertificateRef,
error: *mut CFErrorRef,
Expand Down
8 changes: 4 additions & 4 deletions security-framework-sys/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ extern "C" {
pub static kSecAttrKeyClassSymmetric: CFStringRef;

pub static kSecUseKeychain: CFStringRef;
#[cfg(any(feature = "OSX_10_15", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_15", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub static kSecUseDataProtectionKeychain: CFStringRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub static kSecAttrTokenID: CFStringRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub static kSecAttrTokenIDSecureEnclave: CFStringRef;

pub static kSecAttrKeySizeInBits: CFStringRef;
Expand All @@ -62,7 +62,7 @@ extern "C" {
pub static kSecAttrKeyTypeRC2: CFStringRef;
#[cfg(target_os = "macos")]
pub static kSecAttrKeyTypeCAST: CFStringRef;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub static kSecAttrKeyTypeEC: CFStringRef;

pub static kSecAttrAccessGroup: CFStringRef;
Expand Down
34 changes: 17 additions & 17 deletions security-framework-sys/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ use core_foundation_sys::base::CFTypeID;
use core_foundation_sys::data::CFDataRef;
use core_foundation_sys::dictionary::CFDictionaryRef;
use core_foundation_sys::error::CFErrorRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use core_foundation_sys::string::CFStringRef;

use crate::base::SecKeyRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub type SecKeyAlgorithm = CFStringRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub type SecKeyOperationType = u32;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSecKeyOperationTypeSign: SecKeyOperationType = 0;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSecKeyOperationTypeVerify: SecKeyOperationType = 1;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSecKeyOperationTypeEncrypt: SecKeyOperationType = 2;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSecKeyOperationTypeDecrypt: SecKeyOperationType = 3;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSecKeyOperationTypeKeyExchange: SecKeyOperationType = 4;

extern "C" {
pub fn SecKeyGetTypeID() -> CFTypeID;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyCreateRandomKey(parameters: CFDictionaryRef, error: *mut CFErrorRef) -> SecKeyRef;

#[cfg(target_os = "macos")]
Expand All @@ -36,22 +36,22 @@ extern "C" {
error: *mut CFErrorRef,
) -> SecKeyRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyCopyExternalRepresentation(key: SecKeyRef, error: *mut CFErrorRef) -> CFDataRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyCopyAttributes(key: SecKeyRef) -> CFDictionaryRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyCopyPublicKey(key: SecKeyRef) -> SecKeyRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyCreateSignature(
key: SecKeyRef,
algorithm: SecKeyAlgorithm,
dataToSign: CFDataRef,
error: *mut CFErrorRef,
) -> CFDataRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyVerifySignature(
key: SecKeyRef,
algorithm: SecKeyAlgorithm,
Expand All @@ -60,15 +60,15 @@ extern "C" {
error: *mut CFErrorRef,
) -> core_foundation_sys::base::Boolean;

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecKeyIsAlgorithmSupported(
key: SecKeyRef,
operation: SecKeyOperationType,
algorithm: SecKeyAlgorithm,
) -> core_foundation_sys::base::Boolean;
}

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
macro_rules! names {
($($i:ident => $x:ident),*) => {
extern "C" {
Expand All @@ -91,7 +91,7 @@ macro_rules! names {
}
}

#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_12", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
names! {
ECIESEncryptionStandardX963SHA1AESGCM => kSecKeyAlgorithmECIESEncryptionStandardX963SHA1AESGCM,
ECIESEncryptionStandardX963SHA224AESGCM => kSecKeyAlgorithmECIESEncryptionStandardX963SHA224AESGCM,
Expand Down
4 changes: 2 additions & 2 deletions security-framework-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(bad_style)]

#[cfg_attr(
any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"),
any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"),
link(name = "Security", kind = "framework")
)]
extern "C" {}
Expand All @@ -12,7 +12,7 @@ pub mod access_control;
#[cfg(target_os = "macos")]
pub mod authorization;
pub mod base;
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub mod certificate;
#[cfg(target_os = "macos")]
pub mod certificate_oids;
Expand Down
8 changes: 4 additions & 4 deletions security-framework-sys/src/policy.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use core_foundation_sys::base::CFOptionFlags;
use core_foundation_sys::base::{Boolean, CFTypeID};
use core_foundation_sys::string::CFStringRef;

use crate::base::SecPolicyRef;

#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
mod revocation_flags {
use super::CFOptionFlags;

Expand All @@ -17,12 +17,12 @@ mod revocation_flags {
pub const kSecRevocationUseAnyAvailableMethod: CFOptionFlags = kSecRevocationOCSPMethod | kSecRevocationCRLMethod;
}

#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub use revocation_flags::*;

extern "C" {
pub fn SecPolicyCreateSSL(server: Boolean, hostname: CFStringRef) -> SecPolicyRef;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecPolicyCreateRevocation(revocationFlags: CFOptionFlags) -> SecPolicyRef;
pub fn SecPolicyGetTypeID() -> CFTypeID;
pub fn SecPolicyCreateBasicX509() -> SecPolicyRef;
Expand Down
10 changes: 5 additions & 5 deletions security-framework-sys/src/secure_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ pub type SSLSessionOption = c_int;
pub const kSSLSessionOptionBreakOnServerAuth: SSLSessionOption = 0;
pub const kSSLSessionOptionBreakOnCertRequested: SSLSessionOption = 1;
pub const kSSLSessionOptionBreakOnClientAuth: SSLSessionOption = 2;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSSLSessionOptionFalseStart: SSLSessionOption = 3;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub const kSSLSessionOptionSendOneByteRecord: SSLSessionOption = 4;
#[cfg(all(feature = "OSX_10_11", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))))]
#[cfg(all(feature = "OSX_10_11", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))))]
pub const kSSLSessionOptionAllowServerIdentityChange: SSLSessionOption = 5;
#[cfg(all(feature = "OSX_10_10", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))))]
#[cfg(all(feature = "OSX_10_10", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))))]
pub const kSSLSessionOptionFallback: SSLSessionOption = 6;
#[cfg(all(feature = "OSX_10_11", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))))]
#[cfg(all(feature = "OSX_10_11", not(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))))]
pub const kSSLSessionOptionBreakOnClientHello: SSLSessionOption = 7;

pub type SSLSessionState = c_int;
Expand Down
12 changes: 6 additions & 6 deletions security-framework-sys/src/trust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::base::SecKeyRef;
use core_foundation_sys::array::CFArrayRef;
use core_foundation_sys::base::{Boolean, CFIndex, CFTypeID, CFTypeRef, OSStatus};
use core_foundation_sys::date::CFDateRef;
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
use core_foundation_sys::error::CFErrorRef;

pub type SecTrustResultType = u32;
Expand Down Expand Up @@ -55,7 +55,7 @@ extern "C" {
#[deprecated(note = "deprecated by Apple")]
pub fn SecTrustEvaluate(trust: SecTrustRef, result: *mut SecTrustResultType) -> OSStatus;
// it should have been OSX_10_14, but due to back-compat it can't rely on the newer feature flag
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_13", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecTrustEvaluateWithError(trust: SecTrustRef, error: *mut CFErrorRef) -> bool;
pub fn SecTrustCreateWithCertificates(
certificates: CFTypeRef,
Expand All @@ -65,13 +65,13 @@ extern "C" {
pub fn SecTrustSetPolicies(trust: SecTrustRef, policies: CFTypeRef) -> OSStatus;
#[cfg(target_os = "macos")]
pub fn SecTrustSetOptions(trust: SecTrustRef, options: SecTrustOptionFlags) -> OSStatus;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecTrustGetNetworkFetchAllowed(trust: SecTrustRef, allowFetch: *mut Boolean) -> OSStatus;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecTrustSetNetworkFetchAllowed(trust: SecTrustRef, allowFetch: Boolean) -> OSStatus;
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_9", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecTrustSetOCSPResponse(trust: SecTrustRef, responseData: CFTypeRef) -> OSStatus;
#[cfg(any(feature = "OSX_10_14", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(any(feature = "OSX_10_14", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))]
pub fn SecTrustSetSignedCertificateTimestamps(
trust: SecTrustRef,
sctArray: CFArrayRef,
Expand Down
Loading

0 comments on commit ea683f2

Please sign in to comment.