aperezdc / signify

OpenBSD tool to sign and verify signatures on files. Portable version.
ISC License
272 stars 16 forks source link

Fix explict_bzero.c to do what it's supposed to do. #11

Closed piusbird closed 7 years ago

piusbird commented 7 years ago

The point of explcit_bzero is that it doesn't get optimized out by the compilers dead store optimization. In cryptographer applications dead store is counterproductive because it leaves key material in memory. OpenBSD implemented explict_bzero to stop this happening but just using the file from src/libc, will not do the job because they also implemented a compiler hook. Without the compiler hook this results in a stright call to memset, which dead store may optimize away. This patch implements it in a way that is portable.