Skip to content

Commit 1976cd6

Browse files
committed
Fix conditional compilation
1 parent 816c796 commit 1976cd6

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

security-framework-sys/src/access_control.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ mod access_control_flags {
88
use super::CFOptionFlags;
99

1010
pub const kSecAccessControlUserPresence: CFOptionFlags = 1 << 0;
11+
#[cfg(feature = "OSX_10_13")]
1112
pub const kSecAccessControlBiometryAny: CFOptionFlags = 1 << 1;
13+
#[cfg(feature = "OSX_10_13")]
1214
pub const kSecAccessControlBiometryCurrentSet: CFOptionFlags = 1 << 3;
1315
pub const kSecAccessControlDevicePasscode: CFOptionFlags = 1 << 4;
16+
#[cfg(feature = "OSX_10_15")]
1417
pub const kSecAccessControlWatch: CFOptionFlags = 1 << 5;
1518
pub const kSecAccessControlOr: CFOptionFlags = 1 << 14;
1619
pub const kSecAccessControlAnd: CFOptionFlags = 1 << 15;

security-framework/src/certificate.rs

+6
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ impl SecCertificate {
149149
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
150150
#[must_use]
151151
fn pk_to_der(&self, public_key: key::SecKey) -> Option<Vec<u8>> {
152+
use security_framework_sys::item::kSecAttrKeyType;
153+
use security_framework_sys::item::kSecAttrKeySizeInBits;
154+
152155
let public_key_attributes = public_key.attributes();
153156
let public_key_type = public_key_attributes
154157
.find(unsafe { kSecAttrKeyType }.cast::<std::os::raw::c_void>())?;
@@ -200,6 +203,9 @@ impl SecCertificate {
200203

201204
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
202205
fn get_asn1_header_bytes(pkt: CFString, ksz: u32) -> Option<&'static [u8]> {
206+
use security_framework_sys::item::kSecAttrKeyTypeRSA;
207+
use security_framework_sys::item::kSecAttrKeyTypeECSECPrimeRandom;
208+
203209
if pkt == unsafe { CFString::wrap_under_get_rule(kSecAttrKeyTypeRSA) } && ksz == 2048 {
204210
return Some(&RSA_2048_ASN1_HEADER);
205211
}

security-framework/src/passwords_options.rs

+3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ bitflags::bitflags! {
2020
pub struct AccessControlOptions: CFOptionFlags {
2121
/** Constraint to access an item with either biometry or passcode. */
2222
const USER_PRESENCE = kSecAccessControlUserPresence;
23+
#[cfg(feature = "OSX_10_13")]
2324
/** Constraint to access an item with Touch ID for any enrolled fingers, or Face ID. */
2425
const BIOMETRY_ANY = kSecAccessControlBiometryAny;
26+
#[cfg(feature = "OSX_10_13")]
2527
/** Constraint to access an item with Touch ID for currently enrolled fingers, or from Face ID with the currently enrolled user. */
2628
const BIOMETRY_CURRENT_SET = kSecAccessControlBiometryCurrentSet;
2729
/** Constraint to access an item with a passcode. */
2830
const DEVICE_PASSCODE = kSecAccessControlDevicePasscode;
31+
#[cfg(feature = "OSX_10_15")]
2932
/** Constraint to access an item with a watch. */
3033
const WATCH = kSecAccessControlWatch;
3134
/** Indicates that at least one constraint must be satisfied. */

0 commit comments

Comments
 (0)