Add boxed Montgomery zeroizing support#708
Conversation
|
This seems like a potential footgun in that if someone does zeroize |
This is a good point, but in theory applies to any use of a zeroizable type in a reference-counted wrapper, no? |
|
Sure, but in this case the footgun seems pretty easy to stumble upon accidentally. Are there actual practical use cases for heap-allocated secret moduli this change is motivated by? |
|
It could be relevant for use cases like the Paillier-related case referenced by @fjarri. While that case was specific to That being said, if the footgun isn't worth it, sticking to at least zeroizing the value of |
I imagine they're the same cases as for the stack-allocated ones, since the boxed and the stack form are supposed to be interchangeable. In my case, I need to do some operations in the RNS with moduli Edit: I suppose all of it could be done entirely with the modulus |
|
Note: I'm potentially okay with adding it, but...
I'm not sure how they can be in this case, namely they'll need different zeroization patterns:
I don't think there's going to be a way for generic code to be able to leverage it. |
They only need different zeroization patterns because of an optimization that is invisible to the user. From the outside perspective, there is no expectation of them being zeroized differently. That said, I don't know exactly how to resolve this while keeping the |
A flag to zeroize the params on drop might make sense for If you're looking for a way to make them consistent, I'd worry adding drop glue to |
|
For now, would it make the most sense to remove |
37a7724 to
6b45929
Compare
6b45929 to
2155f6b
Compare
As a follow-up to #706, this PR (mostly) adds boxed Montgomery
Zeroizesupport. Specifically, it zeroizes the value forBoxedMontgomeryForm, but leaves the parameters alone since they're wrapped in anArc. This caveat is carefully documented.