Mbed TLS v3.6.1
crypto_compat.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright The Mbed TLS Contributors
15  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
16  */
17 
18 #ifndef PSA_CRYPTO_COMPAT_H
19 #define PSA_CRYPTO_COMPAT_H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /*
26  * To support both openless APIs and psa_open_key() temporarily, define
27  * psa_key_handle_t to be equal to mbedtls_svc_key_id_t. Do not mark the
28  * type and its utility macros and functions deprecated yet. This will be done
29  * in a subsequent phase.
30  */
32 
33 #define PSA_KEY_HANDLE_INIT MBEDTLS_SVC_KEY_ID_INIT
34 
41 static inline int psa_key_handle_is_null(psa_key_handle_t handle)
42 {
43  return mbedtls_svc_key_id_is_null(handle);
44 }
45 
107  psa_key_handle_t *handle);
108 
148 
153 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
161 #define PSA_DH_FAMILY_CUSTOM \
162  ((psa_dh_family_t) MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(0x7e))
163 
181  psa_key_attributes_t *attributes,
182  psa_key_type_t type, const uint8_t *data, size_t data_length)
183 {
184  (void) data;
185  if (data_length != 0) {
187  }
188  psa_set_key_type(attributes, type);
189  return PSA_SUCCESS;
190 }
191 
207  const psa_key_attributes_t *attributes,
208  uint8_t *data, size_t data_size, size_t *data_length)
209 {
210  (void) attributes;
211  (void) data;
212  (void) data_size;
213  *data_length = 0;
214  return PSA_SUCCESS;
215 }
216 
220 #define PSA_KEY_DOMAIN_PARAMETERS_SIZE(key_type, key_bits) \
221  MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(1u)
222 #endif /* MBEDTLS_DEPRECATED_REMOVED */
223 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* PSA_CRYPTO_COMPAT_H */
mbedtls_svc_key_id_t psa_key_handle_t
Definition: crypto_compat.h:31
psa_status_t psa_open_key(mbedtls_svc_key_id_t key, psa_key_handle_t *handle)
psa_status_t psa_close_key(psa_key_handle_t handle)
static int psa_key_handle_is_null(psa_key_handle_t handle)
Definition: crypto_compat.h:41
static void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type)
static psa_status_t MBEDTLS_DEPRECATED psa_set_key_domain_parameters(psa_key_attributes_t *attributes, psa_key_type_t type, const uint8_t *data, size_t data_length)
Set domain parameters for a key.
static psa_status_t MBEDTLS_DEPRECATED psa_get_key_domain_parameters(const psa_key_attributes_t *attributes, uint8_t *data, size_t data_size, size_t *data_length)
Get domain parameters for a key.
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:78
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:59
#define PSA_ERROR_NOT_SUPPORTED
Definition: crypto_values.h:73
#define PSA_SUCCESS
Definition: crypto_values.h:57
static int mbedtls_svc_key_id_is_null(mbedtls_svc_key_id_t key)
psa_key_id_t mbedtls_svc_key_id_t
Definition: crypto_types.h:292
#define MBEDTLS_DEPRECATED
Definition: platform_util.h:37