Mistake on this page?
Report an issue in GitHub or email us
crypto_platform_spe.h
1 /**
2  * \file psa/crypto_platform_spe.h
3  *
4  * \brief PSA cryptography module: Mbed TLS platfom definitions
5  */
6 /*
7  * Copyright (C) 2018, ARM Limited, All Rights Reserved
8  * SPDX-License-Identifier: Apache-2.0
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * This file is part of mbed TLS (https://tls.mbed.org)
23  */
24 
25 #ifndef PSA_CRYPTO_SPE_PLATFORM_H
26 #define PSA_CRYPTO_SPE_PLATFORM_H
27 
28 /* Include the Mbed TLS configuration file, the way Mbed TLS does it
29  * in each of its header files. */
30 #if !defined(MBEDTLS_CONFIG_FILE)
31 #include "../mbedtls/config.h"
32 #else
33 #include MBEDTLS_CONFIG_FILE
34 #endif
35 
36 /** \defgroup PSA Crypto APIs
37 * @{
38 */
39 
40 /** \brief psa_s_function_t enum defines for all the available functions in PSA Crypto. */
41 typedef enum psa_sec_function_s {
42  PSA_CRYPTO_INVALID,
43  PSA_CRYPTO_INIT,
44  PSA_IMPORT_KEY,
45  PSA_ALLOCATE_KEY,
46  PSA_CREATE_KEY,
47  PSA_OPEN_KEY,
48  PSA_CLOSE_KEY,
49  PSA_DESTROY_KEY,
50  PSA_GET_KEY_INFORMATION,
51  PSA_EXPORT_KEY,
52  PSA_EXPORT_PUBLIC_KEY,
53  PSA_SET_KEY_POLICY,
54  PSA_GET_KEY_POLICY,
55  PSA_GET_KEY_LIFETIME,
56  PSA_HASH_SETUP,
57  PSA_HASH_UPDATE,
58  PSA_HASH_FINISH,
59  PSA_HASH_VERIFY,
60  PSA_HASH_ABORT,
61  PSA_HASH_CLONE_BEGIN,
62  PSA_HASH_CLONE_END,
63  PSA_MAC_SIGN_SETUP,
64  PSA_MAC_VERIFY_SETUP,
65  PSA_MAC_UPDATE,
66  PSA_MAC_SIGN_FINISH,
67  PSA_MAC_VERIFY_FINISH,
68  PSA_MAC_ABORT,
69  PSA_CIPHER_ENCRYPT_SETUP,
70  PSA_CIPHER_DECRYPT_SETUP,
71  PSA_CIPHER_GENERATE_IV,
72  PSA_CIPHER_SET_IV,
73  PSA_CIPHER_UPDATE,
74  PSA_CIPHER_FINISH,
75  PSA_CIPHER_ABORT,
76  PSA_AEAD_ENCRYPT,
77  PSA_AEAD_DECRYPT,
78  PSA_ASYMMETRIC_SIGN,
79  PSA_ASYMMETRIC_VERIFY,
80  PSA_ASYMMETRIC_ENCRYPT,
81  PSA_ASYMMETRIC_DECRYPT,
82  PSA_GENERATE_RANDOM,
83  PSA_GENERATE_KEY,
84  PSA_GET_GENERATOR_CAPACITY,
85  PSA_GENERATOR_READ,
86  PSA_GENERATOR_IMPORT_KEY,
87  PSA_GENERATOR_ABORT,
88  PSA_KEY_DERIVATION,
89  PSA_KEY_AGREEMENT
91 
92 /**@}*/
93 
94 /** \defgroup PSA Crypto structures for IPC
95 * @{
96 */
97 
98 /** psa_crypto_ipc_s struct used for some of the
99  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
100  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
101  * pack them together.
102  */
103 typedef struct psa_crypto_ipc_s {
104  psa_sec_function_t func;
105  psa_key_handle_t handle;
106  psa_algorithm_t alg;
108 
109 /** psa_crypto_derivation_ipc_s struct used for some of the
110  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
111  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
112  * pack them together.
113  */
115  psa_sec_function_t func;
116  psa_key_handle_t handle;
117  psa_algorithm_t alg;
118  size_t capacity;
120 
121 /** psa_key_mng_ipc_s struct used for some of the
122  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
123  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
124  * pack them together.
125  */
126 typedef struct psa_key_mng_ipc_s {
127  psa_key_handle_t handle;
128  psa_key_lifetime_t lifetime;
129  psa_key_type_t type;
130  psa_sec_function_t func;
132 
133 /** psa_crypto_ipc_aead_s struct used for AEAD integrated
134  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t and extra arguments
135  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
136  * pack them together.
137  */
138 // Max length supported for nonce is 16 bytes.
139 #define PSA_AEAD_MAX_NONCE_SIZE 16
140 typedef struct psa_crypto_ipc_aead_s {
141  psa_sec_function_t func;
142  psa_key_handle_t handle;
143  psa_algorithm_t alg;
144  uint16_t nonce_size;
145  size_t additional_data_length;
146  size_t input_length;
147  uint8_t nonce[PSA_AEAD_MAX_NONCE_SIZE];
149 
150 /** psa_crypto_ipc_asymmetric_s struct used for asymmetric
151  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
152  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
153  * pack them together.
154  */
156  psa_sec_function_t func;
157  psa_key_handle_t handle;
158  psa_algorithm_t alg;
159  size_t input_length;
160  size_t salt_length;
162 
163 /**@}*/
164 
165 #endif /* PSA_CRYPTO_SPE_PLATFORM_H */
struct psa_crypto_derivation_ipc_s psa_crypto_derivation_ipc_t
psa_crypto_derivation_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t an...
psa_sec_function_s
psa_s_function_t enum defines for all the available functions in PSA Crypto.
#define PSA_AEAD_MAX_NONCE_SIZE
psa_crypto_ipc_aead_s struct used for AEAD integrated PSA Crypto APIs that need psa_key_handle_t and ...
psa_crypto_ipc_asymmetric_s struct used for asymmetric PSA Crypto APIs that need psa_key_handle_t and...
psa_crypto_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t and psa_algor...
struct psa_key_mng_ipc_s psa_key_mng_ipc_t
psa_key_mng_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t and psa_algo...
struct psa_crypto_ipc_asymmetric_s psa_crypto_ipc_asymmetric_t
psa_crypto_ipc_asymmetric_s struct used for asymmetric PSA Crypto APIs that need psa_key_handle_t and...
psa_crypto_derivation_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t an...
enum psa_sec_function_s psa_sec_function_t
psa_s_function_t enum defines for all the available functions in PSA Crypto.
struct psa_crypto_ipc_s psa_crypto_ipc_t
psa_crypto_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t and psa_algor...
psa_key_mng_ipc_s struct used for some of the PSA Crypto APIs that need psa_key_handle_t and psa_algo...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.