Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
crypto_platform.h
00001 /** 00002 * \file psa/crypto_platform.h 00003 * 00004 * \brief PSA cryptography module: Mbed TLS platform definitions 00005 * 00006 * \note This file may not be included directly. Applications must 00007 * include psa/crypto.h. 00008 * 00009 * This file contains platform-dependent type definitions. 00010 * 00011 * In implementations with isolation between the application and the 00012 * cryptography module, implementers should take care to ensure that 00013 * the definitions that are exposed to applications match what the 00014 * module implements. 00015 */ 00016 /* 00017 * Copyright (C) 2018, ARM Limited, All Rights Reserved 00018 * SPDX-License-Identifier: Apache-2.0 00019 * 00020 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00021 * not use this file except in compliance with the License. 00022 * You may obtain a copy of the License at 00023 * 00024 * http://www.apache.org/licenses/LICENSE-2.0 00025 * 00026 * Unless required by applicable law or agreed to in writing, software 00027 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00028 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00029 * See the License for the specific language governing permissions and 00030 * limitations under the License. 00031 * 00032 * This file is part of mbed TLS (https://tls.mbed.org) 00033 */ 00034 00035 #ifndef PSA_CRYPTO_PLATFORM_H 00036 #define PSA_CRYPTO_PLATFORM_H 00037 00038 /* Include the Mbed TLS configuration file, the way Mbed TLS does it 00039 * in each of its header files. */ 00040 #if !defined(MBEDTLS_CONFIG_FILE) 00041 #include "mbedtls/config.h" 00042 #else 00043 #include MBEDTLS_CONFIG_FILE 00044 #endif 00045 00046 /* PSA requires several types which C99 provides in stdint.h. */ 00047 #include <stdint.h> 00048 00049 /* Integral type representing a key handle. */ 00050 typedef uint16_t psa_key_handle_t; 00051 00052 /* This implementation distinguishes *application key identifiers*, which 00053 * are the key identifiers specified by the application, from 00054 * *key file identifiers*, which are the key identifiers that the library 00055 * sees internally. The two types can be different if there is a remote 00056 * call layer between the application and the library which supports 00057 * multiple client applications that do not have access to each others' 00058 * keys. The point of having different types is that the key file 00059 * identifier may encode not only the key identifier specified by the 00060 * application, but also the the identity of the application. 00061 * 00062 * Note that this is an internal concept of the library and the remote 00063 * call layer. The application itself never sees anything other than 00064 * #psa_app_key_id_t with its standard definition. 00065 */ 00066 00067 /* The application key identifier is always what the application sees as 00068 * #psa_key_id_t. */ 00069 typedef uint32_t psa_app_key_id_t; 00070 00071 #if defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER) 00072 00073 #if defined(PSA_CRYPTO_SECURE) 00074 /* Building for the PSA Crypto service on a PSA platform. */ 00075 /* A key owner is a PSA partition identifier. */ 00076 typedef int32_t psa_key_owner_id_t; 00077 #endif 00078 00079 typedef struct 00080 { 00081 uint32_t key_id; 00082 psa_key_owner_id_t owner; 00083 } psa_key_file_id_t; 00084 #define PSA_KEY_FILE_GET_KEY_ID( file_id ) ( ( file_id ).key_id ) 00085 00086 /* Since crypto.h is used as part of the PSA Cryptography API specification, 00087 * it must use standard types for things like the argument of psa_open_key(). 00088 * If it wasn't for that constraint, psa_open_key() would take a 00089 * `psa_key_file_id_t` argument. As a workaround, make `psa_key_id_t` an 00090 * alias for `psa_key_file_id_t` when building for a multi-client service. */ 00091 typedef psa_key_file_id_t psa_key_id_t; 00092 #define PSA_KEY_ID_INIT {0, 0} 00093 00094 #else /* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */ 00095 00096 /* By default, a key file identifier is just the application key identifier. */ 00097 typedef psa_app_key_id_t psa_key_file_id_t; 00098 #define PSA_KEY_FILE_GET_KEY_ID( id ) ( id ) 00099 00100 #endif /* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */ 00101 00102 #endif /* PSA_CRYPTO_PLATFORM_H */
Generated on Tue Jul 12 2022 13:54:14 by
