| 1 |
.\"============================================================================= |
| 2 |
.\" Header |
| 3 |
.\" |
| 4 |
.\" Copyright (c) 2018-2024 Michael Baeuerle |
| 5 |
.\" |
| 6 |
.\" All rights reserved. |
| 7 |
.\" |
| 8 |
.\" Permission is hereby granted, free of charge, to any person obtaining |
| 9 |
.\" a copy of this software and associated documentation files (the |
| 10 |
.\" "Software"), to deal in the Software without restriction, including |
| 11 |
.\" without limitation the rights to use, copy, modify, merge, publish, |
| 12 |
.\" distribute, and/or sell copies of the Software, and to permit persons |
| 13 |
.\" to whom the Software is furnished to do so, provided that the above |
| 14 |
.\" copyright notice(s) and this permission notice appear in all copies of |
| 15 |
.\" the Software and that both the above copyright notice(s) and this |
| 16 |
.\" permission notice appear in supporting documentation. |
| 17 |
.\" |
| 18 |
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 |
.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 |
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
| 21 |
.\" OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 22 |
.\" HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY |
| 23 |
.\" SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER |
| 24 |
.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 25 |
.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 26 |
.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 27 |
.\" |
| 28 |
.\" Except as contained in this notice, the name of a copyright holder |
| 29 |
.\" shall not be used in advertising or otherwise to promote the sale, use |
| 30 |
.\" or other dealings in this Software without prior written authorization |
| 31 |
.\" of the copyright holder. |
| 32 |
.\" |
| 33 |
.\" SPDX-License-Identifier: ICU |
| 34 |
.\" |
| 35 |
.\" |
| 36 |
.TH $NAME 3 $DATE Unix "$NAME $VERSION manual" |
| 37 |
.\" |
| 38 |
.\" |
| 39 |
.\"============================================================================= |
| 40 |
.\" NAME section |
| 41 |
.\" |
| 42 |
.SH NAME |
| 43 |
cl_clear_secret - Overwrite secret data in memory with $NAME |
| 44 |
.\" |
| 45 |
.\" |
| 46 |
.\"============================================================================= |
| 47 |
.\" SYNOPSIS section |
| 48 |
.\" |
| 49 |
.SH SYNOPSIS |
| 50 |
.nf |
| 51 |
.B #include <libcanlock-3/canlock.h> |
| 52 |
.sp |
| 53 |
.BI "int cl_clear_secret(void *" sec ", size_t " sec_size , |
| 54 |
.BI " size_t " buf_size ); |
| 55 |
.\" |
| 56 |
.\" |
| 57 |
.\"============================================================================= |
| 58 |
.\" DESCRIPTION section |
| 59 |
.\" |
| 60 |
.SH DESCRIPTION |
| 61 |
The |
| 62 |
.BR cl_clear_secret () |
| 63 |
function tries to overwrite |
| 64 |
.I sec_size |
| 65 |
bytes of memory starting at the address specified by the |
| 66 |
.I sec |
| 67 |
parameter. |
| 68 |
.sp |
| 69 |
The size |
| 70 |
.I buf_size |
| 71 |
must be set to the size of the whole buffer. |
| 72 |
.sp |
| 73 |
If the operating system provides |
| 74 |
.BR memset_s (), |
| 75 |
it is called with both length values. Otherwise nonportable functions like |
| 76 |
.BR explicit_memset () |
| 77 |
are used if available. |
| 78 |
.br |
| 79 |
If neither |
| 80 |
.BR memset_s () |
| 81 |
nor a nonportable replacement is available, a call to |
| 82 |
.BR memset () |
| 83 |
is used instead, but the compiler maybe optimize this attempt to NOP. |
| 84 |
A positive value is returned as warning. |
| 85 |
.\" |
| 86 |
.\" |
| 87 |
.\"============================================================================= |
| 88 |
.\" RETURN VALUE section |
| 89 |
.\" |
| 90 |
.SH RETURN VALUE |
| 91 |
Upon successful completion zero is returned. |
| 92 |
.br |
| 93 |
Negative values indicate an error. |
| 94 |
.br |
| 95 |
Positive values indicate a warning. |
| 96 |
.sp |
| 97 |
The value -1 is returned if the parameter |
| 98 |
.I sec |
| 99 |
is NULL or if |
| 100 |
.I sec_size |
| 101 |
is greater than |
| 102 |
.IR buf_size . |
| 103 |
.sp |
| 104 |
The value 1 indicates missing support for explicit memory access from the |
| 105 |
operating system. |
| 106 |
.\" |
| 107 |
.\" |
| 108 |
.\"============================================================================= |
| 109 |
.\" AUTHORS section |
| 110 |
.\" |
| 111 |
.SH AUTHORS |
| 112 |
Michael Baeuerle |
| 113 |
.\" |
| 114 |
.\" |
| 115 |
.\"============================================================================= |
| 116 |
.\" REPORTING BUGS section |
| 117 |
.\" |
| 118 |
.SH REPORTING BUGS |
| 119 |
Report bugs to <mailto:$BUGREPORT>. |
| 120 |
.\" |
| 121 |
.\" |
| 122 |
.\"============================================================================= |
| 123 |
.\" STANDARDS section |
| 124 |
.\" |
| 125 |
.SH STANDARDS |
| 126 |
.B $NAME |
| 127 |
tries to comply with the following standards: |
| 128 |
.PP |
| 129 |
RFC 5537, RFC 6234, RFC 8315 |
| 130 |
.\" |
| 131 |
.\" |
| 132 |
.\"============================================================================= |
| 133 |
.\" SEE ALSO section |
| 134 |
.\" |
| 135 |
.SH SEE ALSO |
| 136 |
.BR cl_get_key (3), |
| 137 |
.BR cl_get_lock (3), |
| 138 |
.BR cl_split (3), |
| 139 |
.BR cl_verify (3), |
| 140 |
.BR cl_verify_multi (3), |
| 141 |
.BR canlock (1), |
| 142 |
.BR memset (3), |
| 143 |
.BR memset_s (3) |
| 144 |
.\" |
| 145 |
.\" |
| 146 |
.\" EOF |