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_GET_KEY_ATTRIBUTES,
44  PSA_OPEN_KEY,
45  PSA_CLOSE_KEY,
46  PSA_IMPORT_KEY,
47  PSA_DESTROY_KEY,
48  PSA_EXPORT_KEY,
49  PSA_EXPORT_PUBLIC_KEY,
50  PSA_COPY_KEY,
51  PSA_HASH_COMPUTE,
52  PSA_HASH_COMPARE,
53  PSA_HASH_SETUP,
54  PSA_HASH_UPDATE,
55  PSA_HASH_FINISH,
56  PSA_HASH_VERIFY,
57  PSA_HASH_ABORT,
58  PSA_HASH_CLONE,
59  PSA_HASH_CLONE_BEGIN,
60  PSA_HASH_CLONE_END,
61  PSA_MAC_COMPUTE,
62  PSA_MAC_VERIFY,
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,
70  PSA_CIPHER_DECRYPT,
71  PSA_CIPHER_ENCRYPT_SETUP,
72  PSA_CIPHER_DECRYPT_SETUP,
73  PSA_CIPHER_GENERATE_IV,
74  PSA_CIPHER_SET_IV,
75  PSA_CIPHER_UPDATE,
76  PSA_CIPHER_FINISH,
77  PSA_CIPHER_ABORT,
78  PSA_AEAD_ENCRYPT,
79  PSA_AEAD_DECRYPT,
80  PSA_AEAD_ENCRYPT_SETUP,
81  PSA_AEAD_DECRYPT_SETUP,
82  PSA_AEAD_GENERATE_NONCE,
83  PSA_AEAD_SET_NONCE,
84  PSA_AEAD_SET_LENGTHS,
85  PSA_AEAD_UPDATE_AD,
86  PSA_AEAD_UPDATE,
87  PSA_AEAD_FINISH,
88  PSA_AEAD_VERIFY,
89  PSA_AEAD_ABORT,
90  PSA_ASYMMETRIC_SIGN,
91  PSA_ASYMMETRIC_VERIFY,
92  PSA_ASYMMETRIC_ENCRYPT,
93  PSA_ASYMMETRIC_DECRYPT,
94  PSA_KEY_DERIVATION_SETUP,
95  PSA_KEY_DERIVATION_GET_CAPACITY,
96  PSA_KEY_DERIVATION_SET_CAPACITY,
97  PSA_KEY_DERIVATION_INPUT_BYTES,
98  PSA_KEY_DERIVATION_INPUT_KEY,
99  PSA_KEY_DERIVATION_KEY_AGREEMENT,
100  PSA_KEY_DERIVATION_OUTPUT_BYTES,
101  PSA_KEY_DERIVATION_OUTPUT_KEY,
102  PSA_KEY_DERIVATION_ABORT,
103  PSA_RAW_KEY_AGREEMENT,
104  PSA_GENERATE_RANDOM,
105  PSA_GENERATE_KEY,
107 
108 /**@}*/
109 
110 /** \defgroup PSA Crypto structures for IPC
111 * @{
112 */
113 
114 /** psa_crypto_ipc_s struct used for some of the
115  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
116  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
117  * pack them together.
118  */
119 typedef struct psa_crypto_ipc_s {
120  psa_sec_function_t func;
121  psa_key_handle_t handle;
122  psa_algorithm_t alg;
124 
125 /** psa_crypto_derivation_ipc_s struct used for some of the
126  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
127  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
128  * pack them together.
129  */
131  psa_sec_function_t func;
132  psa_key_handle_t handle;
133  psa_algorithm_t alg;
134  size_t capacity;
136 
137 /** psa_key_mng_ipc_s struct used for some of the
138  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
139  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
140  * pack them together.
141  */
142 typedef struct psa_key_mng_ipc_s {
143  psa_key_handle_t handle;
144  psa_sec_function_t func;
146 
147 /** psa_crypto_ipc_aead_s struct used for AEAD integrated
148  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t and extra arguments
149  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
150  * pack them together.
151  */
152 // Max length supported for nonce is 16 bytes.
153 #define PSA_AEAD_MAX_NONCE_SIZE 16
154 typedef struct psa_crypto_ipc_aead_s {
155  psa_sec_function_t func;
156  psa_key_handle_t handle;
157  psa_algorithm_t alg;
158  uint16_t nonce_size;
159  size_t additional_data_length;
160  size_t input_length;
161  uint8_t nonce[PSA_AEAD_MAX_NONCE_SIZE];
163 
164 /** psa_crypto_ipc_asymmetric_s struct used for asymmetric
165  * PSA Crypto APIs that need psa_key_handle_t and psa_algorithm_t arguments
166  * and in order to use the existing infrastructure of the SPM-IPC we provide a struct to
167  * pack them together.
168  */
170  psa_sec_function_t func;
171  psa_key_handle_t handle;
172  psa_algorithm_t alg;
173  size_t input_length;
174  size_t salt_length;
176 
177 /**@}*/
178 
179 #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.