summaryrefslogtreecommitdiff
path: root/src/lib/libssl
diff options
context:
space:
mode:
authormatthew <>2014-06-21 02:34:26 +0000
committermatthew <>2014-06-21 02:34:26 +0000
commit9c52c243dba540e16f6f2a3f88131dd7f668f419 (patch)
tree21ea73033a8fdb54b41e35989dd6fd2b13b11219 /src/lib/libssl
parent223031702ca3921f91dff6d1e79995298930a475 (diff)
downloadopenbsd-9c52c243dba540e16f6f2a3f88131dd7f668f419.tar.gz
openbsd-9c52c243dba540e16f6f2a3f88131dd7f668f419.tar.bz2
openbsd-9c52c243dba540e16f6f2a3f88131dd7f668f419.zip
Protect explicit_bzero() from link-time optimization
Modern compiler toolchains are capable of optimizing even across translation unit boundaries, so simply moving the memory clearing into a separate function is not guaranteed to clear memory. To avoid this, we take advantage of ELF weak symbol semantics, and insert a call to an empty, weakly named function. The semantics of calling this function aren't determinable until load time, so the compiler and linker need to keep the memset() call. There are still ways a toolchain might defeat this trick (e.g., optimistically expecting the weak symbol to not be overloaded, and only calling memset() if it is; promoting weak symbols to strong symbols at link-time when emitting a static binary because they won't be interposed; implementing load-time optimizations). But at least for the foreseeable future, these seem unlikely. ok deraadt
Diffstat (limited to 'src/lib/libssl')
0 files changed, 0 insertions, 0 deletions