3 ms·
Don't do this. Security. explicit_bzero() won't be optimized away.
by errcorrectcode 5y ago
Don't do this. Security. explicit_bzero() won't be optimized away.
- rurban 5y agoI do it because nobody else implemented a secure memset. What they call secure is just avoiding that the compiler ignores it. A secure memset also cleans the caches with a memory barrier, so that meltdown cannot read it. explicit_bzero and it's numerous variants are not only insecure, but also slow. (byte wise!) Only safelibc has a secure memset_s. https://github.com/rurban/safeclib/blob/master/tests/perf_memset_s.c https://github.com/rurban/safeclib/blob/master/tests/perf_me...