Comments (8)
I know features are passed to build.rs as environment variables, so maybe dalek could recursively build itself with the table off to generate the table. It might be less fragile if it wrapped through another (sub)crate.
It's probably easier to ship 30k and say 3k tables, a (sub)crate to generate tables for anyone who wants, and a feature to select among the two provided.
from curve25519-dalek.
@hdevalence was talking about hacking something up to this effect before v1.0.0… feel free to triage in if you're still planning to do that, @hdevalence
from curve25519-dalek.
Are you going to switch to a.. I guess it would be a 'finer' comb, e.g. what the goldilocks codebase uses, to reduce the table size?
from curve25519-dalek.
Yeah, Goldilocks is an example here. The idea would be to write a generic comb that would be specialised at compile-time with particular parameters and tables, so that the tables would be more flexible. One reason is that we were talking to someone who wanted to run -dalek
on some small ARM chip where code size is an issue; another is that it might be nice to have fast constant-time fixed-base multiscalar multiplication, where it could be good to have smaller tables so that all the tables can fit inside the L1$.
I'm not sure if this is important enough to do before 1.0.
from curve25519-dalek.
If the table size cannot be fixed, then a customtable
feature might suffice because then one could add dalek as a git submodule to the ARM crate, add a build script to the ARM crate that generates the table inside the dalek submodule, and uses [patch]
/[replace]
to point to the git submodule and force the customtable
feature on all dependencies.
In this way, your build script could depend on normal dalek since it'd run in a different crate, even if the source for that part of the build script lived inside dalek as a git submodule, but dalek would not do anything strange itself.
from curve25519-dalek.
Some prototype work on this is in the following feature branch: https://github.com/chain/curve25519-dalek/compare/feature/prune-constants...chain:feature/multistage-build
It's a bit hacky, but it works in the following way. The build.rs
file uses #[path=...]
overrides to include the dalek
source into the build.rs
crate (thanks to @withoutboats for pointing out this hack). The basepoint tables are cfg
-gated on a precomputed_tables
feature.
Because it's not possible to pass features to the build.rs
crate, but it is possible for build.rs
to control features in the main crate, the precomputed_tables
feature is disabled by default in Cargo.toml
, then re-enabled by build.rs
.
In the main compilation stage, the precomputed_tables
feature has been re-enabled by build.rs
, and the constants.rs
source pulls in the generated tables, which are then compiled as normal.
from curve25519-dalek.
(This doesn't touch the issue of variable-size tables at all, but that's a lot easier to do once there's a multi-stage build process).
from curve25519-dalek.
For now it's possible to build dalek
without the precomputed basepoint tables. Doing precomputation for multiscalar multiplication would be more general, so I'm going to close this ticket in favor of #125.
from curve25519-dalek.
Related Issues (20)
- Broken `-Zminimal-versions` build
- `Scalar::from_bits` regression HOT 5
- Backport old tags HOT 3
- curve25519-dalek: disable SIMD on UEFI targets
- curve25519-dalek-derive performs unsound hiding of unsafety
- crypto_box compatibility is broken in [email protected] HOT 1
- ed25519-dalek: SigningKey.to_scalar() docs are incorrect HOT 4
- SubgroupPoint doesn't implement Default/subtle traits
- `Scalar` gets copied when moved revealing the secret value. HOT 9
- Unable to introduce dependency ed25519-dalek with features `batch` and `digest` HOT 4
- relative performance of Mongomery and Edwards scalarmul HOT 7
- missing author info and license files for curve25519-dalek-derive HOT 9
- `Debug` implementation of `SigningKey` will print secret key material HOT 1
- Is the `ProjectiveNielsPoint` mapping relationship in the document written incorrectly?
- SIGILL / LLVM ERROR when compiling to a x86_64 target that lacks SSE2 instructions HOT 5
- Could not get curve25519-dalek to use the SIMD backend when using x25519-dalek HOT 3
- Elliptic curve discrete logarithm problem (decoding RistrettoPoints) HOT 5
- benchmark selection on the command line seems partially broken
- Ed25519: should compare and hash use uncompressed points? HOT 2
- Pointer width detection in `build.rs` may break for obscure platforms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curve25519-dalek.