Re:TrueCrypt Security Assessment [pdf]
by 30thElement on Monday April 14, 2014 @11:48AM
(#7586858)
They should do it only in situations where it doesn't change the program behavior. I use memset frequently in C just to be safe, but if it's written to later on before it's ever read from, the compiler can optimize that away. I'm guessing their recommendation here is if you did something like
For most programs that last memset is unnecessary (and may even be unnecessary according to the standard, but it's probably implementation defined, not undefined behavior) and it makes sense for the compiler to optimize it away. But for crypto purposes you have to be afraid of someone being able to read plain_text later, so the memset is important
[ Parent
| on HN ]
Re:TrueCrypt Security Assessment [pdf]
by Marat_Dukhan on Monday April 14, 2014 @08:38PM
(#7589711)
I checked 3 compilers: icc 14, gcc 4.8, and clang 3.3. Clang is the only one which optimized the memset away.
Re:TrueCrypt Security Assessment [pdf]
by lawnchair_larry on Monday April 14, 2014 @09:46PM
(#7589890)
Did you enable optimization? I know first hand that GCC will optimize something similar out in many cases.
Re:TrueCrypt Security Assessment [pdf]
by Marat_Dukhan on Tuesday April 15, 2014 @06:30AM
(#7591126)
Yes, I compiled with -O3.
Not a windows user so I can't check but given that it is the kernel driver the compiler we would be concerned about is the MS visual c++ compiler.
Re:TrueCrypt Security Assessment [pdf]
by Marat_Dukhan on Tuesday April 15, 2014 @06:33AM
(#7591130)
Visual C++ 2013 doesn't remove memset either.