sfackler / rust-openssl

OpenSSL bindings for Rust
1.38k stars 742 forks source link

add argon2id support for ossl 3.2+ #2290

Closed reaperhulk closed 4 weeks ago

reaperhulk commented 4 weeks ago

In argon2 there is a concept of parallelism (called lanes). Generally you'd want to have at least as many threads as you have lanes since otherwise you are trading advantage to an attacker, but OpenSSL maintains a global thread limit (as well as allowing building with no-threads). So to use threads in this you must both set the global thread limit to greater than 1 and then also pass a thread count to the underlying EVP_KDF_derive function.

For this PR we simply always set threads to 1, and follow-ups will expose the global thread limit APIs and then make use of potential parallelism.