Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers platform_alt.h Source File

platform_alt.h

00001 /*
00002   *  platform_alt.h
00003   *
00004   *  Copyright (C) 2018, Arm Limited, All Rights Reserved
00005   *  SPDX-License-Identifier: Apache-2.0
00006   *
00007   *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00008   *  not use this file except in compliance with the License.
00009   *  You may obtain a copy of the License at
00010   *
00011   *  http://www.apache.org/licenses/LICENSE-2.0
00012   *
00013   *  Unless required by applicable law or agreed to in writing, software
00014   *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00015   *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   *  See the License for the specific language governing permissions and
00017   *  limitations under the License.
00018   *
00019   */
00020 
00021 #ifndef __PLATFORM_ALT__
00022 #define __PLATFORM_ALT__
00023 #include "platform_mbed.h"
00024 #if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
00025 #include "crypto_device_platform.h"
00026 /**
00027  * \brief   The platform context structure.
00028  *
00029  * \note    This structure may be used to assist platform-specific
00030  *          setup or teardown operations.
00031  */
00032 typedef struct {
00033     crypto_platform_ctx platform_impl_ctx; /* A context holding all the platform specific context for cryptography. Should be defined in crypto_platform.h */
00034     int reference_count;
00035 }
00036 mbedtls_platform_context;
00037 
00038 
00039 /**
00040  * \brief   This function performs any platform initialization operations,
00041  *          needed for setting up cryptographic modules.
00042  *
00043  * \param   ctx     The platform specific context.
00044  *
00045  * \return          \c 0 on success.
00046  *
00047  * \note    This function is intended to allow platform-specific initialization for Mbed TLS,
00048  *          and is called before initializing the Mbed TLS functions. Its
00049  *          implementation is platform-specific, and its implementation MUST be provided.
00050  *
00051  */
00052 int crypto_platform_setup( crypto_platform_ctx *unused_ctx );
00053 
00054 /**
00055  * \brief   This function performs any  platform teardown operations, to disable cryptographic operations.
00056  *
00057  * \param   ctx     The platform specific context.
00058  *
00059  * \note    This function is intended to free any resource used Mbed TLS by the platform.
00060  *          Its implementation is platform-specific,and its implementation MUST be provided.
00061  *
00062  */
00063 void crypto_platform_terminate( crypto_platform_ctx *unused_ctx );
00064 #endif
00065 #endif /* __PLATFORM_ALT__ */
00066