Re:A 100LOC C impl of memset, that is faster than glibc's
by errcorrectcode on Friday November 12, 2021 @09:16AM
(#29199423)
Don't do this. Security. explicit_bzero() won't be optimized away.
[ Parent
| on HN ]
Re:A 100LOC C impl of memset, that is faster than glibc's
by rurban on Sunday November 14, 2021 @02:37AM
(#29215934)
I 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_me...