diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2015-09-15 13:41:59 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2015-10-20 11:52:44 -0500 |
commit | 9b291aa4649f2230d48a12c9089e526ef2182abf (patch) | |
tree | 9033aaffbe687fc2e95ac22e7c994e4c1e857cf3 /lib/libc/string/bzero.3 | |
parent | 695f7c561490cfa30431266c02d4194ea59ef443 (diff) | |
download | FreeBSD-src-9b291aa4649f2230d48a12c9089e526ef2182abf.zip FreeBSD-src-9b291aa4649f2230d48a12c9089e526ef2182abf.tar.gz |
MFC r272673:
Add explicit_bzero(3) and its kernel counterpart.
Obtained from: OpenBSD
MFC after: 2 weeks
TAG: IPSEC-HEAD
Issue: #4841
Diffstat (limited to 'lib/libc/string/bzero.3')
-rw-r--r-- | lib/libc/string/bzero.3 | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/libc/string/bzero.3 b/lib/libc/string/bzero.3 index 029644a..ea572be 100644 --- a/lib/libc/string/bzero.3 +++ b/lib/libc/string/bzero.3 @@ -35,7 +35,8 @@ .Dt BZERO 3 .Os .Sh NAME -.Nm bzero +.Nm bzero , +.Nm explicit_bzero .Nd write zeroes to a byte string .Sh LIBRARY .Lb libc @@ -43,6 +44,8 @@ .In strings.h .Ft void .Fn bzero "void *b" "size_t len" +.Ft void +.Fn explicit_bzero "void *b" "size_t len" .Sh DESCRIPTION The .Fn bzero @@ -56,6 +59,12 @@ If is zero, .Fn bzero does nothing. +.Pp +The +.Fn explicit_bzero +variant behaves the same, but will not be removed by a compiler's dead store +optimization pass, making it useful for clearing sensitive memory such as a +password. .Sh SEE ALSO .Xr memset 3 , .Xr swab 3 @@ -72,3 +81,10 @@ before it was moved to for .St -p1003.1-2001 compliance. +.Pp +The +.Fn explicit_bzero +function first appeared in +.Ox 5.5 +and +.Fx 11.0 . |