-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for watchOS. #1914
Add support for watchOS. #1914
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can tell, this file would require the additional OS checks that weren't necessary for tvOS as watchOS does support 32-bit ARM. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like BoringSSL is disabling all assembly support for 32-bit Apple targets, so I think we should do the same, and add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the PR author but that seems reasonable. There's no NEON available so the optimizations available on ARMv7k are more limited. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like a reasonable suggestion to me 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See PR #1919. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,11 @@ 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( | ||
target_arch = "arm", | ||
not(target_os = "ios"), | ||
not(target_os = "watchos") | ||
))] | ||
{ | ||
if cpu::arm::NEON.available(cpu_features) { | ||
static MONTGOMERY_BASE_POINT: [u8; 32] = [ | ||
|
@@ -109,7 +113,11 @@ fn x25519_ecdh( | |
point: &ops::EncodedPoint, | ||
#[allow(unused_variables)] cpu_features: cpu::Features, | ||
) { | ||
#[cfg(all(not(target_os = "ios"), target_arch = "arm"))] | ||
#[cfg(all( | ||
target_arch = "arm", | ||
not(target_os = "ios"), | ||
not(target_os = "watchos") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably needs more info in #1919 first, and to avoid derailing, but then this gate isn't fully correct. The two 64-bit ARM Apple Watch targets have NEON. |
||
))] | ||
{ | ||
if cpu::arm::NEON.available(cpu_features) { | ||
return x25519_neon(out, scalar, point); | ||
|
@@ -158,7 +166,11 @@ fn x25519_ecdh( | |
Ok(()) | ||
} | ||
|
||
#[cfg(all(not(target_os = "ios"), target_arch = "arm"))] | ||
#[cfg(all( | ||
target_arch = "arm", | ||
not(target_os = "ios"), | ||
not(target_os = "watchos") | ||
))] | ||
fn x25519_neon(out: &mut ops::EncodedPoint, scalar: &ops::MaskedScalar, point: &ops::EncodedPoint) { | ||
prefixed_extern! { | ||
fn x25519_NEON( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is precise enough. More discussion about this in #1832.