-
Notifications
You must be signed in to change notification settings - Fork 477
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 target u32/u64 backend overrides #454
Add target u32/u64 backend overrides #454
Conversation
cda0fb8
to
3d10889
Compare
3d10889
to
70d9a4c
Compare
FWIW I just pushed up a PR to switch to |
thx - I'll just send you a .patch then or re-base here to #455 - my initial attempt here was overly naive I see / realise now 🤦♀️ |
731d2d2
to
8c4ec54
Compare
Ok this should not conflict with the backend selection PR now and made it more simple to put the bits lottery into lib.rs ? |
Really like this general direction. One nit from #455 was whether the |
8c4ec54
to
c75f9ce
Compare
@pinkforest I'm missing how these are "overrides"... it seems like they would be mandatory? |
It's in the lib.rs with global cfg_attr that sets it if it's not set - for some reason criterion doesn't set it ? unless I'm mistaken. |
c75f9ce
to
2f0ce08
Compare
5557755
to
287a2fa
Compare
Ok I moved the target default detection thing into via |
287a2fa
to
b42207c
Compare
Will be waiting direction on this and rename after if decided so 👍 |
I think But people will probably be pasting examples of the |
Problem with that may be the ergonomics - If there is dalek "family of crates" and and one wants to switch I mean if we have similar switch for other dalek crates then it might be feasible to just have dalek_* for some things - .. or at least for .. and also considering that backend stuff may be split into different crates in the future ? ... maybe both |
The "family of crates" is a good point. Many users will use |
build.rs
Outdated
@@ -0,0 +1,15 @@ | |||
//! This selects the dalek_bits either by default from target_pointer_width or explicitly set |
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.
Déjà vu 5742176 😅
commit 574217694e952ad5193f273a541c633ea32207c2
Date: Fri Oct 11 17:10:57 2019 -0700
Remove build.rs.
This was more useful at the time when we were determining, e.g., optimal lookup
table sizes and could regenerate them more easily, but it came at a massive
complexity cost. It also meant that we were unable to implement backend
autoselection. This commit removes the `build.rs` entirely. In the future, a
different `build.rs` could be added that auto-selects a backend, but it seems
like the current default-u64 setup has been working fine.
commit 4dc8073330f63fb23040f7aa7dd0159aac7a9923 (tag: 1.2.3)
git diff 4dc8073330f63fb23040f7aa7dd0159aac7a9923 574217694e952ad5193f273a541c633ea32207c2 build.rs
This looks great! I think we can safely just use If we want to add an umbrella cfg later, we can do that as a non-breaking change. The converse isn't true: if we make a separately low-level library then Are we good to merge? |
As suggested in 453 it is sometimes feasible to select the backend bits via an override. This change provides `cfg(curve25519_dalek_bits)` to override the used serial or fiat target backend.
b42207c
to
1551d02
Compare
👍 I've re-named it to |
Related before-PR-doc (rendered): #453 (comment)
Thou shall ask: #449 (comment)
Thou shall be giveth:
cfg
Test cfg matrix / expectation
All selected backends are mutually exclusive.
fiat_backend
Auto select
fiat_u32
/fiat_u64
based oncfg(target_pointer_width)
- defaultfiat_u32
on non-32/64 bitsserial (default)
Auto select
u32
/u64
based oncfg(target_pointer_width)
- defaultu32
on non-32/64 bitsfiat_backend w/
cfg(curve25519_dalek_bits = "32")
Selects
fiat_u32
regardless of target_pointer on fiat_backendfiat_backend w/
cfg(curve25519_dalek_bits = "64")
Selects
fiat_u64
regardless of target_pointerserial (default) w/
cfg(curve25519_dalek_bits = "32")
Selects
u32
(serial) regardless of target_pointerserial (default) w/
cfg(curve25519_dalek_bits = "64")
Selects
u64
(serial) regardless of target_pointer