summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/bzero.3
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-10-09 15:35:28 +0000
committermelifaro <melifaro@FreeBSD.org>2014-10-09 15:35:28 +0000
commitd23efba7dd470e247cbcacf9ec6cf642d02d5b8c (patch)
tree6d2822f6a5ff6c5c487b859a557d076b53b03c46 /lib/libc/string/bzero.3
parentcab1d703b61e2216f130c6d1a23ca70b2b322386 (diff)
parentc47600c4ec062b8225ac1d48197a2a1de778760d (diff)
downloadFreeBSD-src-d23efba7dd470e247cbcacf9ec6cf642d02d5b8c.zip
FreeBSD-src-d23efba7dd470e247cbcacf9ec6cf642d02d5b8c.tar.gz
Sync to HEAD@r272825.
Diffstat (limited to 'lib/libc/string/bzero.3')
-rw-r--r--lib/libc/string/bzero.320
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/libc/string/bzero.3 b/lib/libc/string/bzero.3
index 029644a..5af1bcf 100644
--- a/lib/libc/string/bzero.3
+++ b/lib/libc/string/bzero.3
@@ -31,11 +31,12 @@
.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd October 6, 2014
.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 .
OpenPOWER on IntegriCloud