As noted in this comment it's unclear whether it's worth to explicitly zeroize temporaries stored on the stack. It's hard to do reliably and it prevents various optimizations (e.g. keeping the temporaries in registers) since zeroization is considered as a side effect by the compiler.
We have 3 options:
- Explicitly erase some temporaries on the case-by-case basis (e.g. large temporary buffers).
- Do not erase temporaries explicitly (it still may happen implicitly via
Drop impls) and recommend to use zeroize::zeroize_stack in user code.
- Do not erase temporaries explicitly, but use
zeroize::zeroize_stack in libraries using case-by-case judgment.
As noted in this comment it's unclear whether it's worth to explicitly zeroize temporaries stored on the stack. It's hard to do reliably and it prevents various optimizations (e.g. keeping the temporaries in registers) since zeroization is considered as a side effect by the compiler.
We have 3 options:
Dropimpls) and recommend to usezeroize::zeroize_stackin user code.zeroize::zeroize_stackin libraries using case-by-case judgment.