Mistake on this page?
Report an issue in GitHub or email us
TARGET_TFM/TARGET_TFM_V1_1/include/psa/crypto_compat.h
1 /**
2  * \file psa/crypto_compat.h
3  *
4  * \brief PSA cryptography module: Backward compatibility aliases
5  *
6  * This header declares alternative names for macro and functions.
7  * New application code should not use these names.
8  * These names may be removed in a future version of Mbed Crypto.
9  *
10  * \note This file may not be included directly. Applications must
11  * include psa/crypto.h.
12  */
13 /*
14  * Copyright (C) 2019-2020, ARM Limited, All Rights Reserved
15  * SPDX-License-Identifier: Apache-2.0
16  *
17  * Licensed under the Apache License, Version 2.0 (the "License"); you may
18  * not use this file except in compliance with the License.
19  * You may obtain a copy of the License at
20  *
21  * http://www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  *
29  * This file is part of mbed TLS (https://tls.mbed.org)
30  */
31 
32 #ifndef PSA_CRYPTO_COMPAT_H
33 #define PSA_CRYPTO_COMPAT_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
40 
41 /*
42  * Mechanism for declaring deprecated values
43  */
44 #if defined(MBEDTLS_DEPRECATED_WARNING) && !defined(MBEDTLS_PSA_DEPRECATED)
45 #define MBEDTLS_PSA_DEPRECATED __attribute__((deprecated))
46 #else
47 #define MBEDTLS_PSA_DEPRECATED
48 #endif
49 
50 typedef MBEDTLS_PSA_DEPRECATED size_t mbedtls_deprecated_size_t;
51 typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t;
52 typedef MBEDTLS_PSA_DEPRECATED psa_key_usage_t mbedtls_deprecated_psa_key_usage_t;
53 
54 #define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \
55  ( (mbedtls_deprecated_##type) ( value ) )
56 
57 /*
58  * Deprecated PSA Crypto error code definitions (PSA Crypto API <= 1.0 beta2)
59  */
60 #define PSA_ERROR_UNKNOWN_ERROR \
61  MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR )
62 #define PSA_ERROR_OCCUPIED_SLOT \
63  MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS )
64 #define PSA_ERROR_EMPTY_SLOT \
65  MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST )
66 #define PSA_ERROR_INSUFFICIENT_CAPACITY \
67  MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA )
68 #define PSA_ERROR_TAMPERING_DETECTED \
69  MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED )
70 
71 /*
72  * Deprecated PSA Crypto numerical encodings (PSA Crypto API <= 1.0 beta3)
73  */
74 #define PSA_KEY_USAGE_SIGN \
75  MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_SIGN_HASH )
76 #define PSA_KEY_USAGE_VERIFY \
77  MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_VERIFY_HASH )
78 
79 /*
80  * Deprecated PSA Crypto size calculation macros (PSA Crypto API <= 1.0 beta3)
81  */
82 #define PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE \
83  MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGNATURE_MAX_SIZE )
84 #define PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) \
85  MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) )
86 
87 /*
88  * Deprecated PSA Crypto function names (PSA Crypto API <= 1.0 beta3)
89  */
90 MBEDTLS_PSA_DEPRECATED psa_status_t psa_asymmetric_sign( psa_key_handle_t key,
91  psa_algorithm_t alg,
92  const uint8_t *hash,
93  size_t hash_length,
94  uint8_t *signature,
95  size_t signature_size,
96  size_t *signature_length );
97 
98 MBEDTLS_PSA_DEPRECATED psa_status_t psa_asymmetric_verify( psa_key_handle_t key,
99  psa_algorithm_t alg,
100  const uint8_t *hash,
101  size_t hash_length,
102  const uint8_t *signature,
103  size_t signature_length );
104 
105 #endif /* MBEDTLS_DEPRECATED_REMOVED */
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* PSA_CRYPTO_COMPAT_H */
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
int32_t psa_status_t
Function return status.
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.