]>
Commit | Line | Data |
---|---|---|
1 | /** | |
2 | * \file platform_util.h | |
3 | * | |
4 | * \brief Common and shared functions used by multiple modules in the Mbed TLS | |
5 | * library. | |
6 | */ | |
7 | /* | |
8 | * Copyright (C) 2018, Arm Limited, All Rights Reserved | |
9 | * SPDX-License-Identifier: GPL-2.0 | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License along | |
22 | * with this program; if not, write to the Free Software Foundation, Inc., | |
23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
24 | * | |
25 | * This file is part of Mbed TLS (https://tls.mbed.org) | |
26 | */ | |
27 | #ifndef MBEDTLS_PLATFORM_UTIL_H | |
28 | #define MBEDTLS_PLATFORM_UTIL_H | |
29 | ||
30 | #include <stddef.h> | |
31 | ||
32 | #ifdef __cplusplus | |
33 | extern "C" { | |
34 | #endif | |
35 | ||
36 | /** | |
37 | * \brief Securely zeroize a buffer | |
38 | * | |
39 | * The function is meant to wipe the data contained in a buffer so | |
40 | * that it can no longer be recovered even if the program memory | |
41 | * is later compromised. Call this function on sensitive data | |
42 | * stored on the stack before returning from a function, and on | |
43 | * sensitive data stored on the heap before freeing the heap | |
44 | * object. | |
45 | * | |
46 | * It is extremely difficult to guarantee that calls to | |
47 | * mbedtls_platform_zeroize() are not removed by aggressive | |
48 | * compiler optimizations in a portable way. For this reason, Mbed | |
49 | * TLS provides the configuration option | |
50 | * MBEDTLS_PLATFORM_ZEROIZE_ALT, which allows users to configure | |
51 | * mbedtls_platform_zeroize() to use a suitable implementation for | |
52 | * their platform and needs | |
53 | * | |
54 | * \param buf Buffer to be zeroized | |
55 | * \param len Length of the buffer in bytes | |
56 | * | |
57 | */ | |
58 | void mbedtls_platform_zeroize( void *buf, size_t len ); | |
59 | ||
60 | #ifdef __cplusplus | |
61 | } | |
62 | #endif | |
63 | ||
64 | #endif /* MBEDTLS_PLATFORM_UTIL_H */ |