mbed TLS v2.23.0
include
psa
crypto_platform.h
Go to the documentation of this file.
1
16
/*
17
* Copyright (C) 2018, ARM Limited, All Rights Reserved
18
* SPDX-License-Identifier: Apache-2.0
19
*
20
* Licensed under the Apache License, Version 2.0 (the "License"); you may
21
* not use this file except in compliance with the License.
22
* You may obtain a copy of the License at
23
*
24
* http://www.apache.org/licenses/LICENSE-2.0
25
*
26
* Unless required by applicable law or agreed to in writing, software
27
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
* See the License for the specific language governing permissions and
30
* limitations under the License.
31
*
32
* This file is part of mbed TLS (https://tls.mbed.org)
33
*/
34
35
#ifndef PSA_CRYPTO_PLATFORM_H
36
#define PSA_CRYPTO_PLATFORM_H
37
38
/* Include the Mbed TLS configuration file, the way Mbed TLS does it
39
* in each of its header files. */
40
#if !defined(MBEDTLS_CONFIG_FILE)
41
#include "
mbedtls/config.h
"
42
#else
43
#include MBEDTLS_CONFIG_FILE
44
#endif
45
46
/* PSA requires several types which C99 provides in stdint.h. */
47
#include <stdint.h>
48
49
/* Integral type representing a key handle. */
50
typedef
uint16_t
psa_key_handle_t
;
51
52
/* This implementation distinguishes *application key identifiers*, which
53
* are the key identifiers specified by the application, from
54
* *key file identifiers*, which are the key identifiers that the library
55
* sees internally. The two types can be different if there is a remote
56
* call layer between the application and the library which supports
57
* multiple client applications that do not have access to each others'
58
* keys. The point of having different types is that the key file
59
* identifier may encode not only the key identifier specified by the
60
* application, but also the the identity of the application.
61
*
62
* Note that this is an internal concept of the library and the remote
63
* call layer. The application itself never sees anything other than
64
* #psa_app_key_id_t with its standard definition.
65
*/
66
67
/* The application key identifier is always what the application sees as
68
* #psa_key_id_t. */
69
typedef
uint32_t
psa_app_key_id_t
;
70
71
#if defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER)
72
73
#if defined(PSA_CRYPTO_SECURE)
74
/* Building for the PSA Crypto service on a PSA platform. */
75
/* A key owner is a PSA partition identifier. */
76
typedef
int32_t psa_key_owner_id_t;
77
#endif
78
79
typedef
struct
80
{
81
uint32_t key_id;
82
psa_key_owner_id_t owner;
83
}
psa_key_file_id_t
;
84
#define PSA_KEY_FILE_GET_KEY_ID( file_id ) ( ( file_id ).key_id )
85
86
/* Since crypto.h is used as part of the PSA Cryptography API specification,
87
* it must use standard types for things like the argument of psa_open_key().
88
* If it wasn't for that constraint, psa_open_key() would take a
89
* `psa_key_file_id_t` argument. As a workaround, make `psa_key_id_t` an
90
* alias for `psa_key_file_id_t` when building for a multi-client service. */
91
typedef
psa_key_file_id_t
psa_key_id_t
;
92
#define PSA_KEY_ID_INIT {0, 0}
93
94
#else
/* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
95
96
/* By default, a key file identifier is just the application key identifier. */
97
typedef
psa_app_key_id_t
psa_key_file_id_t
;
98
#define PSA_KEY_FILE_GET_KEY_ID( id ) ( id )
99
100
#endif
/* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
101
102
#endif
/* PSA_CRYPTO_PLATFORM_H */
psa_key_file_id_t
psa_app_key_id_t psa_key_file_id_t
Definition:
crypto_platform.h:97
psa_key_id_t
uint32_t psa_key_id_t
Definition:
crypto_types.h:237
psa_app_key_id_t
uint32_t psa_app_key_id_t
Definition:
crypto_platform.h:69
config.h
Configuration options (set of defines)
psa_key_handle_t
uint16_t psa_key_handle_t
Definition:
crypto_platform.h:50
Generated on Sun Jul 19 2020 13:02:29 for mbed TLS v2.23.0 by
1.8.18