-
Notifications
You must be signed in to change notification settings - Fork 156
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
Csprng rework #254
Csprng rework #254
Conversation
b22a01d
to
1293596
Compare
54a7391
to
3ef48df
Compare
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.
Haven't looked at generators and counter yet, some general questions for my understanding :)
Edit: btw sorry if there is some overlap with some explanations you provided but I started writing part of the comments before we talked about this PR!
7172dd1
to
df4c15e
Compare
df4c15e
to
75fd849
Compare
Thanks for your thorough reviews @agnesLeroy, @IceTDrinker ! I made the changes you requested ! |
4a0f82a
to
fa4b4d9
Compare
fa4b4d9
to
8c1d140
Compare
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.
It's a bit hard to tell if it's ok with the force push, but it seems you adressed all I saw, thanks !
452eb1d
to
2d19e32
Compare
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.
Hello! We went through the PR this morning with Damien, here come some first comments about it! :) He's going to continue reading it on his side. :)
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.
btw would it be worth it to update the aes crate as aes_soft is marked as deprecated? The only bother for the new crate is that it does not seem easy to get the software variant enabled :|
@IceTDrinker Thanks for reminding us of that, I forgot that you mentioned it a few weeks ago. I see an |
probably not, it's big enough as is IMO :) was just that I thought about it again, I don't know if the config flag is easy to use in the build system (vs. features IIRC) which is a bit of a shame really... |
Yes, I got mixed up, I read |
2d19e32
to
31d7c49
Compare
31d7c49
to
df7470c
Compare
BREAKING_CHANGES: + `try_fork` and `par_try_fork` now return a result. + `remaining_bytes` now returns a `ByteCount`.
BREAKING_CHANGE: this commit completely breaks the previous API
df7470c
to
2c0e93d
Compare
@IceTDrinker : I asked the question on RustCrypto/block-ciphers#316 . |
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.
Very good upgrade! there are some spaces in middle of documentation probably because of the formatting. also misused of the verb yield. we should avoid it and use output of produce instead. i added many comments about that but i left some of them. please could you double check all of them?
It could also be useful to re implement the drop (cf @agnesLeroy) to set to zero all the prng values.
pub struct AesCtrGenerator<BlockCipher: AesBlockCipher> { | ||
// The block cipher used in the background | ||
pub(crate) block_cipher: BlockCipher, | ||
// The state corresponding to the latest yielded byte. |
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.
is it the counter? the next randomness will be obtained from: this state+1?
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.
Yes !
Hello @damienligier , Thank you for this review ! I tried to address most points in the follow-up PR on zama-ai/concrete-core#8 . I integrated most of your remarks, and closed the related conversations here. The few remaining ones, I left open in case you want more informations / take actions. Related to your remark on re-implementing the Drop trait, you raise a very valid point, and I would love to see this done ! That being said, it is tricky to do properly, as we have to use volatile memory operations and compiler fences to ensure the compiler does not get rid / reorder the clean-up code in a wrong way. I would prefer to add that in a future PR, focused on this matter, as this one is already pretty big, what do you think ? I close this PR so that we can leave the floor for the libs team here, but feel free to answer in the conversation 😉 Best, Alex. |
Resolves:
zama-ai/concrete-core-internal#111
zama-ai/concrete-core-internal#112
zama-ai/concrete_internal#346
Description
When forked, the children of the parent generator sometimes get an incorrect bound whose byte_ctr is higher than 127 (which should not be the case).
Checklist
(Use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)
aws_test
to the PR to launch the tests on AWS)