Our cryptographic data structures are munlocked and zeroed on drop, and mlocked on creation. In some calculations, however, we create temporary values from which secrets could be computed. Can we make sure none of this leaks, ideally without polluting the code with lots of explicit method calls for mlocking and zeroing, and without unreasonable overhead?
If I wrap a temporary value in SecretKey, it should be safe, right? Should we split that functionality out of SecretKey into a general Secret that mlocks and zeroes? We'd then have SecretKey(Secret(Fr)), but it would be less weird to use Secrets for local variables.
And we'd probably need something similar for Vecs.
Our cryptographic data structures are munlocked and zeroed on drop, and mlocked on creation. In some calculations, however, we create temporary values from which secrets could be computed. Can we make sure none of this leaks, ideally without polluting the code with lots of explicit method calls for mlocking and zeroing, and without unreasonable overhead?
If I wrap a temporary value in
SecretKey, it should be safe, right? Should we split that functionality out ofSecretKeyinto a generalSecretthat mlocks and zeroes? We'd then haveSecretKey(Secret(Fr)), but it would be less weird to useSecrets for local variables.And we'd probably need something similar for
Vecs.