Skip to content
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

Well known defaults for curve25519_dalek_bits #456

Open
pinkforest opened this issue Dec 8, 2022 · 5 comments
Open

Well known defaults for curve25519_dalek_bits #456

pinkforest opened this issue Dec 8, 2022 · 5 comments

Comments

@pinkforest
Copy link
Contributor

pinkforest commented Dec 8, 2022

Origin issue:

Our MVP became the "override" between [fiat_]u32 and [fiat_]u64 regardless of cfg(target_pointer_width)

We implemented the MVP here:

Where the default is based on cfg(target_pointer_width):

  • [fiat_]u32 on 32 bit targets
  • [fiat_]u64 on 64 bit targets
  • [fiat_]u32 on all other

@tarcieri raised to provide well known "target defaults" e.g. arm, wasm etc. : #449 (comment), #454 (comment)

This would be (https://doc.rust-lang.org/reference/conditional-compilation.html):

  • cfg(target_family = "wasm") -> [fiat_]u64
  • cfg(target_arch = "armv7") -> [fiat_]u64
  • ... ?

Could we perhaps discuss / gather a list proper for MVP for this and then can perhaps throw PR at this ?

pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
@pinkforest
Copy link
Contributor Author

pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
@rozbb
Copy link
Contributor

rozbb commented Dec 9, 2022

Related: we also need a README update to reflect the new backend selection stuff

pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
@pinkforest
Copy link
Contributor Author

Yeah doing that now 👍

pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
@pinkforest
Copy link
Contributor Author

pinkforest commented Dec 9, 2022

pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
As discussed in dalek-cryptography#456 this sets well known defaults for cfg(target_family = "wasm")
and cfg(target_arch = "arm") for 64 bit arithmetric via cfg(curve25519_dalek_bits = "64")
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 9, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 10, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
pinkforest added a commit to pinkforest/curve25519-dalek that referenced this issue Dec 10, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in dalek-cryptography#456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
rozbb pushed a commit that referenced this issue Dec 10, 2022
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.

This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.

As discussed in #456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")

If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
@jrose-signal
Copy link
Contributor

For the record we have re-tested 32-bit Android execution speed with the final 4.0 release and found the following results:

  • Moto X (2013) is faster with the u64 backend
  • Moto G4 (2016) is faster with the u64 backend
  • Pixel 6a (2022) is faster with the u64 backend
  • Zenfone 9 (2022) is faster with the u32 backend

So in conclusion, there's not going to be a perfect choice for all ARMv7 Android devices, but we've seen more success with the u64 backend than the u32 one, and we'll probably continue using it (it was the default in 3.x as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants