Mbed OS Reference
Loading...
Searching...
No Matches
platform_alt.h
1/*
2 * platform_alt.h
3 *
4 * Copyright (C) 2018, Arm Limited, All Rights Reserved
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21#ifndef __PLATFORM_ALT__
22#define __PLATFORM_ALT__
23#include "platform_mbed.h"
24#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
25#include "crypto_device_platform.h"
26/**
27 * \brief The platform context structure.
28 *
29 * \note This structure may be used to assist platform-specific
30 * setup or teardown operations.
31 */
32typedef struct {
33 crypto_platform_ctx platform_impl_ctx; /* A context holding all the platform specific context for cryptography. Should be defined in crypto_platform.h */
34 int reference_count;
35}
37
38
39/**
40 * \brief This function performs any platform initialization operations,
41 * needed for setting up cryptographic modules.
42 *
43 * \param ctx The platform specific context.
44 *
45 * \return \c 0 on success.
46 *
47 * \note This function is intended to allow platform-specific initialization for Mbed TLS,
48 * and is called before initializing the Mbed TLS functions. Its
49 * implementation is platform-specific, and its implementation MUST be provided.
50 *
51 */
52int crypto_platform_setup( crypto_platform_ctx *unused_ctx );
53
54/**
55 * \brief This function performs any platform teardown operations, to disable cryptographic operations.
56 *
57 * \param ctx The platform specific context.
58 *
59 * \note This function is intended to free any resource used Mbed TLS by the platform.
60 * Its implementation is platform-specific,and its implementation MUST be provided.
61 *
62 */
63void crypto_platform_terminate( crypto_platform_ctx *unused_ctx );
64#endif
65#endif /* __PLATFORM_ALT__ */
66