bzero.3 (d1d015864103b253b3fcb2f72a0da5b0cfeb31b6) bzero.3 (78b59024b537e0993c0272fe57b8d23da5eaf0ce)
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 21 unchanged lines hidden (view full) ---

30.\"
31.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93
32.\" $FreeBSD$
33.\"
34.Dd June 4, 1993
35.Dt BZERO 3
36.Os
37.Sh NAME
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 21 unchanged lines hidden (view full) ---

30.\"
31.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93
32.\" $FreeBSD$
33.\"
34.Dd June 4, 1993
35.Dt BZERO 3
36.Os
37.Sh NAME
38.Nm bzero
38.Nm bzero ,
39.Nm explicit_bzero
39.Nd write zeroes to a byte string
40.Sh LIBRARY
41.Lb libc
42.Sh SYNOPSIS
43.In strings.h
44.Ft void
45.Fn bzero "void *b" "size_t len"
40.Nd write zeroes to a byte string
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In strings.h
45.Ft void
46.Fn bzero "void *b" "size_t len"
47.Ft void
48.Fn explicit_bzero "void *b" "size_t len"
46.Sh DESCRIPTION
47The
48.Fn bzero
49function
50writes
51.Fa len
52zero bytes to the string
53.Fa b .
54If
55.Fa len
56is zero,
57.Fn bzero
58does nothing.
49.Sh DESCRIPTION
50The
51.Fn bzero
52function
53writes
54.Fa len
55zero bytes to the string
56.Fa b .
57If
58.Fa len
59is zero,
60.Fn bzero
61does nothing.
62.Pp
63The
64.Fn explicit_bzero
65variant behaves the same, but will not be removed by a compiler's dead store
66optimization pass, making it useful for clearing sensitive memory such as a
67password.
59.Sh SEE ALSO
60.Xr memset 3 ,
61.Xr swab 3
62.Sh HISTORY
63A
64.Fn bzero
65function
66appeared in
67.Bx 4.3 .
68Its prototype existed previously in
69.In string.h
70before it was moved to
71.In strings.h
72for
73.St -p1003.1-2001
74compliance.
68.Sh SEE ALSO
69.Xr memset 3 ,
70.Xr swab 3
71.Sh HISTORY
72A
73.Fn bzero
74function
75appeared in
76.Bx 4.3 .
77Its prototype existed previously in
78.In string.h
79before it was moved to
80.In strings.h
81for
82.St -p1003.1-2001
83compliance.
84.Pp
85The
86.Fn explicit_bzero
87function first appeared in
88.Ox 5.5
89and
90.Fx 11.0 .