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

Pre-calculating Parameters #42

Open
fjarri opened this issue Mar 16, 2021 · 1 comment
Open

Pre-calculating Parameters #42

fjarri opened this issue Mar 16, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@fjarri
Copy link
Contributor

fjarri commented Mar 16, 2021

Currently a Parameters object (basically, just the value of u) is created on the spot where it is needed, since it's always the same (see #3). Even though its calculation is pretty fast (we hit the point on the first try, and it takes ~8us for me on a laptop), it may still be significant if we ever target embedded environments.

We wouldn't want to hardcode the value; we need to show the process with which it is obtained.

Rust's requirements for static variables are restrictive, so we can't just make it static (a lot of functions in RustCrypto stack would have to be made const fn). Maybe they will relax them in the future.

An alternative is a build script, which will require extracting all the required machinery (since we cannot import the crate itself from the build script) and duplicating some parameter definitions.

@fjarri
Copy link
Contributor Author

fjarri commented Apr 13, 2021

Possible crates that can help with that: lazy_static, or static_init. Just need to make sure they don't increase the internal complexity too much (static_init seems to be using a separate thread to initialize the statics... which won't play very well with embedded environments).

@fjarri fjarri added the enhancement New feature or request label Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant