Skip to content
0.2.0-dev Download ZIP
74 lines ·2.6 KB Raw
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 TLS.
9 *
10 * \note This file may not be included directly. Applications must
11 * include psa/crypto.h.
12 */
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
22extern "C" {
23#endif
24
25/* This function is not a TF-PSA-Crypto API and may be removed without notice.
26 *
27 * Dummy version of a function removed in
28 * https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/466
29 *
30 * The function needs to remain available during a transition period
31 * for the sake of the PSA simulator, which lives in Mbed TLS.
32 * Once TF-PSA-Crypto no longer needs the function,
33 * `tests/psa-client-server/psasim/src/psa_sim_crypto_server.c` will
34 * need to be updated to no longer need the function, and it will be
35 * possible to remove the corresponding RPC call altogether.
36 */
37int psa_can_do_hash(psa_algorithm_t hash_alg);
38
39/* This defition is required to provide compatibility with the PSA arch
40 * tests. Without it building the tests will fail. To remove it we would
41 * need to change the tests to remove all references to this symbol.
42 */
43#define PSA_KEY_TYPE_DES ((psa_key_type_t) 0x2301)
44
45/** The beta encoding of JPAKE algorithms, with no hash.
46 *
47 * This came from the beta version of the PSA Crypto PAKE 1.2 extension,
48 * which is what Mbed TLS 3.x implemented.
49 * Since TF-PSA-Crypto 1.0.0, we no longer support the beta version of
50 * specification, so this algorithm encoding is no longer supported in
51 * JPAKE cipher suites. Use #PSA_ALG_JPAKE instead.
52 *
53 * \note It is unspecified whether a key with #PSA_ALG_JPAKE_BETA
54 * in its policy may be used to perform a JPAKE operation.
55 */
56/* TF-PSA-Crypto 1.x still supports using persistent keys whose policy uses
57 * this legacy encoding. As of TF-PSA-Crypto 1.0.0, we also allow this
58 * algorithm encoding in the policy of newly created keys, because it makes
59 * our implementation simpler. This may change without notice. */
60#define PSA_ALG_JPAKE_BETA PSA_ALG_JPAKE_BASE
61
62#if !defined(MBEDTLS_DEPRECATED_REMOVED)
63/** Old non-standard name for #PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE.
64 * \deprecated Please use #PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE instead.
65 */
66#define PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE \
67 ((size_t) MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE))
68#endif
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* PSA_CRYPTO_COMPAT_H */