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

feat(crypto)!: make engine and rng shared #5

Closed
wants to merge 2 commits into from

Conversation

jdygert-spok
Copy link
Contributor

No description provided.

@@ -1056,7 +1056,7 @@ hmac_impl!(HmacSha384, "HMAC-SHA384", Sha384);
hmac_impl!(HmacSha512, "HMAC-SHA512", Sha512);

/// A `HMAC_DRBG`-based CSPRNG.
pub struct HmacDrbg(br_hmac_drbg_context);
pub struct HmacDrbg(spin::Mutex<br_hmac_drbg_context>);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add a mutex here.

@elagergren-spideroak
Copy link
Member

I haven't thought about it much or looked at the PR in much depth, but I think it lgtm.

@aranya-project aranya-project deleted a comment from ericlagergren Jan 7, 2025
@elagergren-spideroak
Copy link
Member

fyi #34

@jdygert-spok
Copy link
Contributor Author

fyi #34

Yeah that'll be fun to resolve :)

Any thoughts on having mutexes on some rngs?

@elagergren-spideroak
Copy link
Member

fyi #34

Yeah that'll be fun to resolve :)

Any thoughts on having mutexes on some rngs?

It's fine. We only need a mutex for user space CSPRNGs, which we only use when absolutely forced to (FIPS or the trng feature). User space CSPRNGs should hopefully be fast enough to not suffer (much) contention. And in a multi-threaded environment we should be using thread-local CSPRNGs anyway.

@elagergren-spideroak
Copy link
Member

#47

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

Successfully merging this pull request may close these issues.

2 participants