blob: 7eb2b68bf501b911e0f3485fdaffa475d7e3a657 [file] [log] [blame]
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +01001/**
2 * \file utils.h
3 *
Andres Amaya Garcia757cd722018-03-08 21:25:25 +00004 * \brief Mbed TLS utility functions
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +01005 *
Andres Amaya Garcia757cd722018-03-08 21:25:25 +00006 * Copyright (C) 2018, Arm Limited, All Rights Reserved
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +01007 * 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 *
Andres Amaya Garcia757cd722018-03-08 21:25:25 +000021 * This file is part of Mbed TLS (https://tls.mbed.org)
Andres Amaya Garcia614d9c02017-10-24 21:27:43 +010022 */
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 */