Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers platform_util.h Source File

platform_util.h

Go to the documentation of this file.
00001 /**
00002  * \file platform_util.h
00003  *
00004  * \brief Common and shared functions used by multiple modules in the Mbed TLS
00005  *        library.
00006  */
00007 /*
00008  *  Copyright (C) 2018, Arm Limited, All Rights Reserved
00009  *  SPDX-License-Identifier: Apache-2.0
00010  *
00011  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00012  *  not use this file except in compliance with the License.
00013  *  You may obtain a copy of the License at
00014  *
00015  *  http://www.apache.org/licenses/LICENSE-2.0
00016  *
00017  *  Unless required by applicable law or agreed to in writing, software
00018  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00019  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020  *  See the License for the specific language governing permissions and
00021  *  limitations under the License.
00022  *
00023  *  This file is part of Mbed TLS (https://tls.mbed.org)
00024  */
00025 #ifndef MBEDTLS_PLATFORM_UTIL_H
00026 #define MBEDTLS_PLATFORM_UTIL_H
00027 
00028 #include <stddef.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 /**
00035  * \brief       Securely zeroize a buffer
00036  *
00037  *              The function is meant to wipe the data contained in a buffer so
00038  *              that it can no longer be recovered even if the program memory
00039  *              is later compromised. Call this function on sensitive data
00040  *              stored on the stack before returning from a function, and on
00041  *              sensitive data stored on the heap before freeing the heap
00042  *              object.
00043  *
00044  *              It is extremely difficult to guarantee that calls to
00045  *              mbedtls_platform_zeroize() are not removed by aggressive
00046  *              compiler optimizations in a portable way. For this reason, Mbed
00047  *              TLS provides the configuration option
00048  *              MBEDTLS_PLATFORM_ZEROIZE_ALT, which allows users to configure
00049  *              mbedtls_platform_zeroize() to use a suitable implementation for
00050  *              their platform and needs
00051  *
00052  * \param buf   Buffer to be zeroized
00053  * \param len   Length of the buffer in bytes
00054  *
00055  */
00056 void mbedtls_platform_zeroize( void *buf, size_t len );
00057 
00058 #ifdef __cplusplus
00059 }
00060 #endif
00061 
00062 #endif /* MBEDTLS_PLATFORM_UTIL_H */