4 ms·
It's not good enough to make the type non-Clone (and therefore, non-Copy)?
by tomjakubowski 8y ago
It's not good enough to make the type non-Clone (and therefore, non-Copy)?
- ncmncm 8y agoVery, very far from good enough. I.e., the first step down a long and lonely road. Crypto Implementation Is Hard. Especially when you need it to be secret. It is lots easier if you don't care.
- tomjakubowski 8y agoYeah. I guess that I just don't see what Pin provides that non-Copy/Clone does, when it comes to preventing the zeroed data from leaking elsewhere. In other words, why is a zeroing Drop of a type more secure if it uses Pin too?
- jake_the_third 8y agoNope. Not at all. Afaict, Rust memcopys moved objects if they're larger than some size when passed as function arguments. Also take into account implicit copies such as those left laying around when a vector outgrows it's heap segment.
- masklinn 8y agoNo. Both copies and moves are simple memcpy at the machine-level[0], the only difference is whether the compiler will let you keep using the source afterwards. [0] though I guess the compiler might be smart enough to implicitly pass big-enough values by pointer instead