Skip to content

Commit

Permalink
Add apple tvos support
Browse files Browse the repository at this point in the history
  • Loading branch information
lcruz99 committed Oct 3, 2023
1 parent c4a6ec8 commit 302f0de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const LINUX_ABI: &[&str] = &[

/// Operating systems that have the same ABI as macOS on every architecture
/// mentioned in `ASM_TARGETS`.
const MACOS_ABI: &[&str] = &["ios", "macos"];
const MACOS_ABI: &[&str] = &["ios", "macos", "tvos"];

const WINDOWS: &str = "windows";

Expand Down
8 changes: 4 additions & 4 deletions src/ec/curve25519/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn x25519_public_from_private(
let private_key: &[u8; SCALAR_LEN] = private_key.bytes_less_safe().try_into()?;
let private_key = ops::MaskedScalar::from_bytes_masked(*private_key);

#[cfg(all(not(target_os = "ios"), target_arch = "arm"))]
#[cfg(all(not(target_os = "ios"), not(target_os = "tvos"), target_arch = "arm"))]
{
if cpu::arm::NEON.available(cpu_features) {
static MONTGOMERY_BASE_POINT: [u8; 32] = [
Expand Down Expand Up @@ -100,7 +100,7 @@ fn x25519_ecdh(
let peer_public_key: &[u8; PUBLIC_KEY_LEN] = peer_public_key.as_slice_less_safe().try_into()?;

#[cfg_attr(
not(all(not(target_os = "ios"), target_arch = "arm")),
not(all(not(target_os = "ios"), not(target_os = "tvos"), target_arch = "arm")),
allow(unused_variables)
)]
fn scalar_mult(
Expand All @@ -109,7 +109,7 @@ fn x25519_ecdh(
point: &ops::EncodedPoint,
cpu_features: cpu::Features,
) {
#[cfg(all(not(target_os = "ios"), target_arch = "arm"))]
#[cfg(all(not(target_os = "ios"), not(target_os = "tvos"), target_arch = "arm"))]
{
if cpu::arm::NEON.available(cpu_features) {
return x25519_neon(out, scalar, point);
Expand Down Expand Up @@ -144,7 +144,7 @@ fn x25519_ecdh(
Ok(())
}

#[cfg(all(not(target_os = "ios"), target_arch = "arm"))]
#[cfg(all(not(target_os = "ios"), not(target_os = "tvos"), target_arch = "arm"))]
fn x25519_neon(out: &mut ops::EncodedPoint, scalar: &ops::MaskedScalar, point: &ops::EncodedPoint) {
prefixed_extern! {
fn x25519_NEON(
Expand Down
1 change: 1 addition & 0 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ impl crate::sealed::Sealed for SystemRandom {}
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "tvos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
Expand Down

0 comments on commit 302f0de

Please sign in to comment.