blob: cb03fb0e45eb728660cc6957a747a560793cc726 [file] [log] [blame]
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +01001/**
2 * \file utils.h
3 *
4 * \brief mbed TLS utility functions
5 *
6 * Copyright (C) 2017, ARM Limited, All Rights Reserved
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 * not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 * This file is part of mbed TLS (https://tls.mbed.org)
22 */
23#ifndef MBEDTLS_UTILS_H
24#define MBEDTLS_UTILS_H
25
26#include <stddef.h>
27
28/**
29 * \brief Securely zeroize a buffer
30 *
31 * \param buf Buffer to be zeroized
32 * \param len Length of the buffer in bytes
33 *
34 * \note This implementation should never be optimized out by the
35 * compiler
Andres Amaya Garcia1e8ea5f2018-03-08 20:46:39 +000036 *
37 * \note It is extremely difficult to guarantee that calls to
38 * mbedtls_zeroize() are not removed by aggressive compiler
39 * optimizations in a portable way. For this reason, Mbed TLS
40 * provides the configuration option MBEDTLS_UTILS_ZEROIZE_ALT,
41 * which allows users to configure mbedtls_zeroize() to use a
42 * suitable implementation for their platform and needs
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +010043 */
44void mbedtls_zeroize( void *buf, size_t len );
45
46#endif /* MBEDTLS_UTILS_H */