1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef ISC_SAFE_H
13 #define ISC_SAFE_H 1
14 
15 /*! \file isc/safe.h */
16 
17 #include <isc/lang.h>
18 
19 ISC_LANG_BEGINDECLS
20 
21 int
22 isc_safe_memequal(const void *, const void *, size_t);
23 
24 /*%<
25  * Returns true iff. two blocks of memory are equal, otherwise
26  * false.
27  *
28  */
29 
30 void
31 isc_safe_memwipe(void *, size_t);
32 
33 /*%<
34  * Clear the memory of length `len` pointed to by `ptr`.
35  *
36  * Some crypto code calls memset() on stack allocated buffers just
37  * before return so that they are wiped. Such memset() calls can be
38  * optimized away by the compiler. We provide this external non-inline C
39  * function to perform the memset operation so that the compiler cannot
40  * infer about what the function does and optimize the call away.
41  */
42 
43 ISC_LANG_ENDDECLS
44 
45 #endif /* ISC_SAFE_H */
46