diff options
Diffstat (limited to 'src/lib/libc/string/bzero.3')
-rw-r--r-- | src/lib/libc/string/bzero.3 | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/lib/libc/string/bzero.3 b/src/lib/libc/string/bzero.3 index 4f0141e051..3e21c4241f 100644 --- a/src/lib/libc/string/bzero.3 +++ b/src/lib/libc/string/bzero.3 | |||
@@ -11,11 +11,7 @@ | |||
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. All advertising materials mentioning features or use of this software | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
15 | .\" must display the following acknowledgement: | ||
16 | .\" This product includes software developed by the University of | ||
17 | .\" California, Berkeley and its contributors. | ||
18 | .\" 4. Neither the name of the University nor the names of its contributors | ||
19 | .\" may be used to endorse or promote products derived from this software | 15 | .\" may be used to endorse or promote products derived from this software |
20 | .\" without specific prior written permission. | 16 | .\" without specific prior written permission. |
21 | .\" | 17 | .\" |
@@ -31,24 +27,25 @@ | |||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
33 | .\" | 29 | .\" |
34 | .\" from: @(#)bzero.3 5.3 (Berkeley) 4/19/91 | 30 | .\" $OpenBSD: bzero.3,v 1.11 2014/01/22 22:21:25 jmc Exp $ |
35 | .\" $Id: bzero.3,v 1.1.1.1 1995/10/18 08:42:21 deraadt Exp $ | ||
36 | .\" | 31 | .\" |
37 | .Dd April 19, 1991 | 32 | .Dd $Mdocdate: January 22 2014 $ |
38 | .Dt BZERO 3 | 33 | .Dt BZERO 3 |
39 | .Os BSD 4.3 | 34 | .Os |
40 | .Sh NAME | 35 | .Sh NAME |
41 | .Nm bzero | 36 | .Nm bzero , |
37 | .Nm explicit_bzero | ||
42 | .Nd write zeroes to a byte string | 38 | .Nd write zeroes to a byte string |
43 | .Sh SYNOPSIS | 39 | .Sh SYNOPSIS |
44 | .Fd #include <string.h> | 40 | .In string.h |
45 | .Ft void | 41 | .Ft void |
46 | .Fn bzero "void *b" "size_t len" | 42 | .Fn bzero "void *b" "size_t len" |
43 | .Ft void | ||
44 | .Fn explicit_bzero "void *b" "size_t len" | ||
47 | .Sh DESCRIPTION | 45 | .Sh DESCRIPTION |
48 | The | 46 | The |
49 | .Fn bzero | 47 | .Fn bzero |
50 | function | 48 | function writes |
51 | writes | ||
52 | .Fa len | 49 | .Fa len |
53 | zero bytes to the string | 50 | zero bytes to the string |
54 | .Fa b . | 51 | .Fa b . |
@@ -57,12 +54,21 @@ If | |||
57 | is zero, | 54 | is zero, |
58 | .Fn bzero | 55 | .Fn bzero |
59 | does nothing. | 56 | does nothing. |
57 | .Pp | ||
58 | The | ||
59 | .Fn explicit_bzero | ||
60 | variant behaves the same, but will not be removed by a compiler's dead store | ||
61 | optimization pass, making it useful for clearing sensitive memory such as a | ||
62 | password. | ||
60 | .Sh SEE ALSO | 63 | .Sh SEE ALSO |
61 | .Xr memset 3 , | 64 | .Xr memset 3 , |
62 | .Xr swab 3 | 65 | .Xr swab 3 |
63 | .Sh HISTORY | 66 | .Sh HISTORY |
64 | A | 67 | The |
65 | .Fn bzero | 68 | .Fn bzero |
66 | function | 69 | function first appeared in |
67 | appeared in | 70 | .Bx 4.2 . |
68 | .Bx 4.3 . | 71 | The |
72 | .Fn explicit_bzero | ||
73 | function first appeared in | ||
74 | .Ox 5.5 . | ||