jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
secmem.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Gothel Software e.K.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 */
24
25#ifndef JAU_SECMEM_HPP_
26#define JAU_SECMEM_HPP_
27
28#include <jau/cpp_lang_util.hpp>
29#include <cstring>
30
31namespace jau {
32
33 /** @defgroup SecMem Secure Memory
34 * Secure Memory utilities
35 *
36 * @{
37 */
38
39 /**
40 * Wrapper to ::explicit_bzero(), ::bzero() or ::memset(), whichever is available in that order.
41 *
42 * Implementation shall not be optimized away for security reasons.
43 */
44 void zero_bytes_sec(void *s, size_t n) noexcept __attribute__((nonnull (1))) __attrdecl_no_optimize__;
45
46 /**@}*/
47
48} // namespace jau
49
50#endif /* JAU_SECMEM_HPP_ */
#define __attrdecl_no_optimize__
void zero_bytes_sec(void *s, size_t n) noexcept __attrdecl_no_optimize__
Wrapper to ::explicit_bzero(), ::bzero() or ::memset(), whichever is available in that order.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Definition backtrace.hpp:32