2020-09-18 06:15:13 +02:00
|
|
|
/**
|
|
|
|
|
* \file mbedtls/config_psa.h
|
|
|
|
|
* \brief PSA crypto configuration options (set of defines)
|
|
|
|
|
*
|
2020-10-13 06:36:22 +02:00
|
|
|
* This set of compile-time options takes settings defined in
|
2021-05-28 09:42:25 +02:00
|
|
|
* include/mbedtls/mbedtls_config.h and include/psa/crypto_config.h and uses
|
2020-10-13 06:36:22 +02:00
|
|
|
* those definitions to define symbols used in the library code.
|
|
|
|
|
*
|
|
|
|
|
* Users and integrators should not edit this file, please edit
|
2022-12-04 18:19:59 +01:00
|
|
|
* include/mbedtls/mbedtls_config.h for MBEDTLS_XXX settings or
|
2020-10-13 06:36:22 +02:00
|
|
|
* include/psa/crypto_config.h for PSA_WANT_XXX settings.
|
2020-09-18 06:15:13 +02:00
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
* Copyright The Mbed TLS Contributors
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MBEDTLS_CONFIG_PSA_H
|
|
|
|
|
#define MBEDTLS_CONFIG_PSA_H
|
|
|
|
|
|
2023-06-06 14:32:58 +02:00
|
|
|
#include "psa/crypto_legacy.h"
|
|
|
|
|
|
2021-04-19 22:24:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* De facto synonyms */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_ECDSA_ANY) && !defined(PSA_WANT_ALG_ECDSA)
|
|
|
|
|
#define PSA_WANT_ALG_ECDSA PSA_WANT_ALG_ECDSA_ANY
|
|
|
|
|
#elif !defined(PSA_WANT_ALG_ECDSA_ANY) && defined(PSA_WANT_ALG_ECDSA)
|
|
|
|
|
#define PSA_WANT_ALG_ECDSA_ANY PSA_WANT_ALG_ECDSA
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-03-15 16:40:59 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CCM_STAR_NO_TAG) && !defined(PSA_WANT_ALG_CCM)
|
|
|
|
|
#define PSA_WANT_ALG_CCM PSA_WANT_ALG_CCM_STAR_NO_TAG
|
|
|
|
|
#elif !defined(PSA_WANT_ALG_CCM_STAR_NO_TAG) && defined(PSA_WANT_ALG_CCM)
|
|
|
|
|
#define PSA_WANT_ALG_CCM_STAR_NO_TAG PSA_WANT_ALG_CCM
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-19 22:24:23 +02:00
|
|
|
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
|
|
|
|
#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW
|
|
|
|
|
#elif !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
|
|
|
|
#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW PSA_WANT_ALG_RSA_PKCS1V15_SIGN
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-10-04 18:33:56 +02:00
|
|
|
#if defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && !defined(PSA_WANT_ALG_RSA_PSS)
|
|
|
|
|
#define PSA_WANT_ALG_RSA_PSS PSA_WANT_ALG_RSA_PSS_ANY_SALT
|
|
|
|
|
#elif !defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && defined(PSA_WANT_ALG_RSA_PSS)
|
|
|
|
|
#define PSA_WANT_ALG_RSA_PSS_ANY_SALT PSA_WANT_ALG_RSA_PSS
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-19 22:24:23 +02:00
|
|
|
|
2023-03-14 18:01:23 +01:00
|
|
|
/****************************************************************/
|
|
|
|
|
/* Hashes that are built in are also enabled in PSA.
|
|
|
|
|
* This simplifies dependency declarations especially
|
|
|
|
|
* for modules that obey MBEDTLS_USE_PSA_CRYPTO. */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_MD5_C)
|
|
|
|
|
#define PSA_WANT_ALG_MD5 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_RIPEMD160_C)
|
|
|
|
|
#define PSA_WANT_ALG_RIPEMD160 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA1_C)
|
|
|
|
|
#define PSA_WANT_ALG_SHA_1 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA224_C)
|
|
|
|
|
#define PSA_WANT_ALG_SHA_224 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA256_C)
|
|
|
|
|
#define PSA_WANT_ALG_SHA_256 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA384_C)
|
|
|
|
|
#define PSA_WANT_ALG_SHA_384 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA512_C)
|
|
|
|
|
#define PSA_WANT_ALG_SHA_512 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-19 22:24:23 +02:00
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* Require built-in implementations based on PSA requirements */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2020-09-24 13:30:10 +02:00
|
|
|
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
|
2020-09-21 08:09:17 +02:00
|
|
|
|
2020-10-14 04:58:20 +02:00
|
|
|
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
|
2020-09-21 08:09:17 +02:00
|
|
|
#define MBEDTLS_ECDSA_DETERMINISTIC
|
2020-10-26 17:39:05 +01:00
|
|
|
#define MBEDTLS_ECDSA_C
|
2020-10-23 10:22:58 +02:00
|
|
|
#define MBEDTLS_HMAC_DRBG_C
|
|
|
|
|
#define MBEDTLS_MD_C
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA */
|
2020-10-13 06:36:22 +02:00
|
|
|
#endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */
|
2020-09-24 13:30:10 +02:00
|
|
|
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#if defined(PSA_WANT_ALG_ECDH)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#define MBEDTLS_ECDH_C
|
|
|
|
|
#define MBEDTLS_ECP_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
2020-10-29 04:09:55 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDH */
|
|
|
|
|
#endif /* PSA_WANT_ALG_ECDH */
|
|
|
|
|
|
2020-11-17 07:08:34 +01:00
|
|
|
#if defined(PSA_WANT_ALG_ECDSA)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#define MBEDTLS_ECDSA_C
|
2021-04-28 18:28:46 +02:00
|
|
|
#define MBEDTLS_ECP_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_ASN1_PARSE_C
|
|
|
|
|
#define MBEDTLS_ASN1_WRITE_C
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDSA */
|
|
|
|
|
#endif /* PSA_WANT_ALG_ECDSA */
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
|
2022-12-01 14:22:34 +01:00
|
|
|
#if defined(PSA_WANT_ALG_FFDH)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_FFDH)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_FFDH 1
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_FFDH */
|
|
|
|
|
#endif /* PSA_WANT_ALG_FFDH */
|
|
|
|
|
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#if defined(PSA_WANT_ALG_HKDF)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
|
2020-10-29 04:09:55 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */
|
|
|
|
|
#endif /* PSA_WANT_ALG_HKDF */
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
|
2022-06-03 14:05:07 +02:00
|
|
|
#if defined(PSA_WANT_ALG_HKDF_EXTRACT)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT */
|
|
|
|
|
#endif /* PSA_WANT_ALG_HKDF_EXTRACT */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_HKDF_EXPAND)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXPAND 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND */
|
|
|
|
|
#endif /* PSA_WANT_ALG_HKDF_EXPAND */
|
|
|
|
|
|
2020-11-17 07:08:34 +01:00
|
|
|
#if defined(PSA_WANT_ALG_HMAC)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HMAC */
|
|
|
|
|
#endif /* PSA_WANT_ALG_HMAC */
|
|
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#if defined(PSA_WANT_ALG_MD5) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
|
|
|
|
|
#define MBEDTLS_MD5_C
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-06-10 08:58:32 +02:00
|
|
|
#if defined(PSA_WANT_ALG_JPAKE)
|
2023-02-27 13:00:57 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
|
2022-05-25 11:28:22 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_PAKE 1
|
2022-06-10 08:58:32 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_JPAKE 1
|
2022-06-15 11:21:33 +02:00
|
|
|
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
2022-05-25 11:28:22 +02:00
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_ECP_C
|
|
|
|
|
#define MBEDTLS_ECJPAKE_C
|
2023-02-27 13:00:57 +01:00
|
|
|
#endif /* MBEDTLS_PSA_ACCEL_ALG_JPAKE */
|
2022-06-10 08:58:32 +02:00
|
|
|
#endif /* PSA_WANT_ALG_JPAKE */
|
2022-05-25 11:28:22 +02:00
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#if defined(PSA_WANT_ALG_RIPEMD160) && !defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
|
|
|
|
|
#define MBEDTLS_RIPEMD160_C
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-11-04 21:28:15 +01:00
|
|
|
#if defined(PSA_WANT_ALG_RSA_OAEP)
|
2020-11-01 06:06:54 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
|
2020-11-01 06:06:54 +01:00
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_OID_C
|
2020-11-04 21:28:15 +01:00
|
|
|
#define MBEDTLS_PKCS1_V21
|
2020-11-01 06:06:54 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP */
|
2020-11-04 21:28:15 +01:00
|
|
|
#endif /* PSA_WANT_ALG_RSA_OAEP */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT)
|
2020-11-01 06:06:54 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
|
2020-11-01 06:06:54 +01:00
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_OID_C
|
|
|
|
|
#define MBEDTLS_PKCS1_V15
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT */
|
2020-11-04 21:28:15 +01:00
|
|
|
#endif /* PSA_WANT_ALG_RSA_PKCS1V15_CRYPT */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
2020-11-01 06:06:54 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
|
2020-11-01 06:06:54 +01:00
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_OID_C
|
|
|
|
|
#define MBEDTLS_PKCS1_V15
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN */
|
2020-11-04 21:28:15 +01:00
|
|
|
#endif /* PSA_WANT_ALG_RSA_PKCS1V15_SIGN */
|
2020-11-01 06:06:54 +01:00
|
|
|
|
2020-11-17 07:08:34 +01:00
|
|
|
#if defined(PSA_WANT_ALG_RSA_PSS)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_OID_C
|
|
|
|
|
#define MBEDTLS_PKCS1_V21
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PSS */
|
|
|
|
|
#endif /* PSA_WANT_ALG_RSA_PSS */
|
|
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#if defined(PSA_WANT_ALG_SHA_1) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
|
|
|
|
|
#define MBEDTLS_SHA1_C
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_SHA_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
|
2021-04-19 16:46:28 +02:00
|
|
|
#define MBEDTLS_SHA224_C
|
2020-12-01 06:06:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_SHA_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
|
|
|
|
|
#define MBEDTLS_SHA256_C
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_SHA_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
|
2021-04-06 14:28:22 +02:00
|
|
|
#define MBEDTLS_SHA384_C
|
2020-12-01 06:06:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_SHA_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
|
|
|
|
|
#define MBEDTLS_SHA512_C
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-05-03 08:12:29 +02:00
|
|
|
#if defined(PSA_WANT_ALG_PBKDF2_HMAC)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_HMAC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC 1
|
2023-07-27 17:33:06 +02:00
|
|
|
#define PSA_HAVE_SOFT_PBKDF2_HMAC
|
2023-05-03 15:06:35 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
|
2023-05-03 08:12:29 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
2023-05-03 15:06:35 +02:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HMAC */
|
2023-05-03 08:12:29 +02:00
|
|
|
#endif /* !MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC */
|
|
|
|
|
#endif /* PSA_WANT_ALG_PBKDF2_HMAC */
|
|
|
|
|
|
2020-11-17 07:08:34 +01:00
|
|
|
#if defined(PSA_WANT_ALG_TLS12_PRF)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF */
|
|
|
|
|
#endif /* PSA_WANT_ALG_TLS12_PRF */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS */
|
|
|
|
|
#endif /* PSA_WANT_ALG_TLS12_PSK_TO_MS */
|
|
|
|
|
|
2022-07-29 16:00:16 +02:00
|
|
|
#if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_ECJPAKE_TO_PMS 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS */
|
|
|
|
|
#endif /* PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS */
|
|
|
|
|
|
2023-05-26 13:37:26 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT */
|
2022-12-01 14:22:34 +01:00
|
|
|
|
2023-05-26 13:37:26 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT */
|
2020-11-17 07:08:34 +01:00
|
|
|
|
2023-05-26 13:37:26 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE */
|
|
|
|
|
|
2023-06-15 11:53:08 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
2023-06-13 12:34:12 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC */
|
2023-05-26 13:37:26 +02:00
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT */
|
2022-12-15 13:22:11 +01:00
|
|
|
|
2023-05-26 13:37:26 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
|
2020-11-01 06:06:54 +01:00
|
|
|
#define MBEDTLS_GENPRIME
|
2023-05-26 13:37:26 +02:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE */
|
|
|
|
|
|
2023-06-15 11:53:08 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
2023-06-13 12:34:12 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC */
|
2023-05-26 13:37:26 +02:00
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
2023-05-26 13:37:26 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE */
|
|
|
|
|
|
2023-06-15 11:53:08 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
2023-06-13 12:34:12 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC */
|
2023-06-13 12:34:12 +02:00
|
|
|
|
2023-05-26 13:37:26 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
|
|
|
|
|
#define MBEDTLS_ECP_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY 1
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY */
|
2020-11-04 21:28:15 +01:00
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
|
2020-11-01 06:06:54 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#define MBEDTLS_RSA_C
|
|
|
|
|
#define MBEDTLS_BIGNUM_C
|
|
|
|
|
#define MBEDTLS_OID_C
|
2020-11-17 07:08:34 +01:00
|
|
|
#define MBEDTLS_PK_PARSE_C
|
|
|
|
|
#define MBEDTLS_PK_WRITE_C
|
|
|
|
|
#define MBEDTLS_PK_C
|
2021-04-28 18:28:46 +02:00
|
|
|
#define MBEDTLS_ASN1_PARSE_C
|
|
|
|
|
#define MBEDTLS_ASN1_WRITE_C
|
2020-11-01 06:06:54 +01:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY */
|
2020-11-04 21:28:15 +01:00
|
|
|
#endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY */
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
|
2021-02-08 23:44:52 +01:00
|
|
|
/* If any of the block modes are requested that don't have an
|
|
|
|
|
* associated HW assist, define PSA_HAVE_SOFT_BLOCK_MODE for checking
|
|
|
|
|
* in the block cipher key types. */
|
|
|
|
|
#if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \
|
2021-02-17 11:46:50 +01:00
|
|
|
(defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \
|
2021-02-08 23:44:52 +01:00
|
|
|
(defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \
|
|
|
|
|
defined(PSA_WANT_ALG_ECB_NO_PADDING) || \
|
|
|
|
|
(defined(PSA_WANT_ALG_CBC_NO_PADDING) && \
|
2023-01-11 14:50:10 +01:00
|
|
|
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
|
2021-02-08 23:44:52 +01:00
|
|
|
(defined(PSA_WANT_ALG_CBC_PKCS7) && \
|
2023-01-11 14:50:10 +01:00
|
|
|
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)) || \
|
2021-03-25 09:25:38 +01:00
|
|
|
(defined(PSA_WANT_ALG_CMAC) && !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC))
|
2021-02-08 23:44:52 +01:00
|
|
|
#define PSA_HAVE_SOFT_BLOCK_MODE 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-25 09:25:38 +01:00
|
|
|
#if (defined(PSA_WANT_ALG_GCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_GCM)) || \
|
|
|
|
|
(defined(PSA_WANT_ALG_CCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_CCM))
|
|
|
|
|
#define PSA_HAVE_SOFT_BLOCK_AEAD 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-07-28 10:01:58 +02:00
|
|
|
#if defined(PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_AES_CMAC_PRF_128 1
|
|
|
|
|
#define PSA_HAVE_SOFT_PBKDF2_CMAC
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128 */
|
|
|
|
|
#endif /* PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 */
|
|
|
|
|
|
2021-01-05 20:03:25 +01:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_AES)
|
2021-02-09 23:56:22 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
|
|
|
|
#define PSA_HAVE_SOFT_KEY_TYPE_AES 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_AES */
|
|
|
|
|
#if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
2021-03-25 09:25:38 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
|
2023-07-28 10:01:58 +02:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_AEAD) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_PBKDF2_CMAC)
|
2021-01-21 17:48:57 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
|
2021-01-05 20:03:25 +01:00
|
|
|
#define MBEDTLS_AES_C
|
2021-02-09 23:56:22 +01:00
|
|
|
#endif /* PSA_HAVE_SOFT_KEY_TYPE_AES || PSA_HAVE_SOFT_BLOCK_MODE */
|
2021-01-05 20:03:25 +01:00
|
|
|
#endif /* PSA_WANT_KEY_TYPE_AES */
|
|
|
|
|
|
2021-10-08 15:48:16 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ARIA)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
|
|
|
|
|
#define PSA_HAVE_SOFT_KEY_TYPE_ARIA 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA */
|
|
|
|
|
#if defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_AEAD)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1
|
|
|
|
|
#define MBEDTLS_ARIA_C
|
|
|
|
|
#endif /* PSA_HAVE_SOFT_KEY_TYPE_ARIA || PSA_HAVE_SOFT_BLOCK_MODE */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_ARIA */
|
|
|
|
|
|
2021-01-05 20:03:25 +01:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
|
2021-02-09 23:56:22 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
|
|
|
|
|
#define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA */
|
|
|
|
|
#if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \
|
2021-03-25 09:25:38 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_AEAD)
|
2021-01-21 17:48:57 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
|
2021-01-05 20:03:25 +01:00
|
|
|
#define MBEDTLS_CAMELLIA_C
|
2021-02-09 23:56:22 +01:00
|
|
|
#endif /* PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA || PSA_HAVE_SOFT_BLOCK_MODE */
|
2021-01-05 20:03:25 +01:00
|
|
|
#endif /* PSA_WANT_KEY_TYPE_CAMELLIA */
|
|
|
|
|
|
2021-01-15 20:04:09 +01:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DES)
|
2021-02-09 23:56:22 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES)
|
|
|
|
|
#define PSA_HAVE_SOFT_KEY_TYPE_DES 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DES */
|
|
|
|
|
#if defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
|
2021-02-08 23:44:52 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
2021-01-21 17:48:57 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
|
2021-01-15 20:04:09 +01:00
|
|
|
#define MBEDTLS_DES_C
|
2021-02-09 23:56:22 +01:00
|
|
|
#endif /*PSA_HAVE_SOFT_KEY_TYPE_DES || PSA_HAVE_SOFT_BLOCK_MODE */
|
2021-01-15 20:04:09 +01:00
|
|
|
#endif /* PSA_WANT_KEY_TYPE_DES */
|
|
|
|
|
|
2021-02-09 00:31:46 +01:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
|
|
|
|
|
#define MBEDTLS_CHACHA20_C
|
|
|
|
|
#endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 */
|
|
|
|
|
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
|
|
|
|
|
|
2021-02-09 23:59:41 +01:00
|
|
|
/* If any of the software block ciphers are selected, define
|
|
|
|
|
* PSA_HAVE_SOFT_BLOCK_CIPHER, which can be used in any of these
|
|
|
|
|
* situations. */
|
|
|
|
|
#if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
2021-10-08 15:48:16 +02:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
2021-02-09 23:59:41 +01:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
|
|
|
|
#define PSA_HAVE_SOFT_BLOCK_CIPHER 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-01-15 20:04:47 +01:00
|
|
|
#if defined(PSA_WANT_ALG_STREAM_CIPHER)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#endif /* PSA_WANT_ALG_STREAM_CIPHER */
|
|
|
|
|
|
2021-03-25 15:32:32 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CBC_MAC)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_MAC)
|
|
|
|
|
#error "CBC-MAC is not yet supported via the PSA API in Mbed TLS."
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_MAC 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CBC_MAC */
|
|
|
|
|
#endif /* PSA_WANT_ALG_CBC_MAC */
|
|
|
|
|
|
2021-03-25 09:25:38 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CMAC)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \
|
2023-07-28 10:01:58 +02:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_PBKDF2_CMAC)
|
2021-03-25 09:25:38 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
|
|
|
|
|
#define MBEDTLS_CMAC_C
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CMAC */
|
|
|
|
|
#endif /* PSA_WANT_ALG_CMAC */
|
|
|
|
|
|
2023-07-27 17:33:06 +02:00
|
|
|
#if defined(PSA_HAVE_SOFT_PBKDF2_HMAC) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_PBKDF2_CMAC)
|
|
|
|
|
#define PSA_HAVE_SOFT_PBKDF2 1
|
|
|
|
|
#endif /* PSA_HAVE_SOFT_PBKDF2_HMAC || PSA_HAVE_SOFT_PBKDF2_CMAC */
|
2021-03-25 09:25:38 +01:00
|
|
|
|
2021-01-15 20:04:47 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CTR)
|
2021-02-05 20:47:08 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \
|
2021-02-09 23:59:41 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define MBEDTLS_CIPHER_MODE_CTR
|
2021-02-05 20:47:08 +01:00
|
|
|
#endif
|
2021-01-15 20:04:47 +01:00
|
|
|
#endif /* PSA_WANT_ALG_CTR */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_CFB)
|
2021-02-05 20:47:08 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CFB) || \
|
2021-02-09 23:59:41 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define MBEDTLS_CIPHER_MODE_CFB
|
2021-02-05 20:47:08 +01:00
|
|
|
#endif
|
2021-01-15 20:04:47 +01:00
|
|
|
#endif /* PSA_WANT_ALG_CFB */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_OFB)
|
2021-02-05 20:47:08 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_OFB) || \
|
2021-02-09 23:59:41 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define MBEDTLS_CIPHER_MODE_OFB
|
2021-02-05 20:47:08 +01:00
|
|
|
#endif
|
2021-01-15 20:04:47 +01:00
|
|
|
#endif /* PSA_WANT_ALG_OFB */
|
|
|
|
|
|
2022-03-17 11:09:23 +01:00
|
|
|
#if defined(PSA_WANT_ALG_ECB_NO_PADDING) && \
|
|
|
|
|
!defined(MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING)
|
2021-02-11 18:55:48 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#endif
|
|
|
|
|
|
2021-01-26 19:50:36 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CBC_NO_PADDING)
|
2021-02-05 20:47:08 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) || \
|
2021-02-10 00:23:34 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
2021-02-11 18:53:23 +01:00
|
|
|
#define MBEDTLS_CIPHER_MODE_CBC
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
|
2021-02-05 20:47:08 +01:00
|
|
|
#endif
|
2021-01-26 19:50:36 +01:00
|
|
|
#endif /* PSA_WANT_ALG_CBC_NO_PADDING */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_CBC_PKCS7)
|
2021-02-05 20:47:08 +01:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) || \
|
2021-02-10 00:23:34 +01:00
|
|
|
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
2021-02-11 18:53:23 +01:00
|
|
|
#define MBEDTLS_CIPHER_MODE_CBC
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
|
2021-02-10 00:23:34 +01:00
|
|
|
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
2021-02-05 20:47:08 +01:00
|
|
|
#endif
|
2021-01-26 19:50:36 +01:00
|
|
|
#endif /* PSA_WANT_ALG_CBC_PKCS7 */
|
|
|
|
|
|
2021-03-25 09:25:38 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CCM)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
2021-10-08 15:48:16 +02:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
2021-03-25 09:25:38 +01:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
|
2022-03-15 16:40:59 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG 1
|
2021-03-25 09:25:38 +01:00
|
|
|
#define MBEDTLS_CCM_C
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* PSA_WANT_ALG_CCM */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ALG_GCM)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_GCM) || \
|
|
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
2021-10-08 15:48:16 +02:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
|
2021-03-25 09:25:38 +01:00
|
|
|
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
|
|
|
|
|
#define MBEDTLS_GCM_C
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* PSA_WANT_ALG_GCM */
|
|
|
|
|
|
2021-02-09 00:47:35 +01:00
|
|
|
#if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
|
2021-04-28 18:28:46 +02:00
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
|
2021-02-09 00:47:35 +01:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
|
|
|
|
#define MBEDTLS_CHACHAPOLY_C
|
2022-06-17 06:50:32 +02:00
|
|
|
#define MBEDTLS_CHACHA20_C
|
|
|
|
|
#define MBEDTLS_POLY1305_C
|
2021-02-10 00:24:11 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
|
2021-02-09 00:47:35 +01:00
|
|
|
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
|
2021-04-28 18:28:46 +02:00
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 */
|
2021-02-09 00:47:35 +01:00
|
|
|
#endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */
|
|
|
|
|
|
2021-03-15 22:53:57 +01:00
|
|
|
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256)
|
|
|
|
|
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384)
|
|
|
|
|
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512)
|
|
|
|
|
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_MONTGOMERY_255)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)
|
|
|
|
|
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_MONTGOMERY_255 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_MONTGOMERY_448)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
|
|
|
|
|
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_MONTGOMERY_448 */
|
|
|
|
|
|
2021-02-20 05:05:52 +01:00
|
|
|
#if defined(PSA_WANT_ECC_SECP_R1_192)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)
|
|
|
|
|
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_R1_192 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_R1_224)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)
|
|
|
|
|
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_R1_224 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_R1_256)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)
|
|
|
|
|
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_R1_256 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_R1_384)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)
|
|
|
|
|
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_R1_384 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_R1_521)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)
|
|
|
|
|
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_R1_521 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_K1_192)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)
|
2021-02-19 22:08:00 +01:00
|
|
|
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_K1_192 */
|
2021-02-19 22:08:00 +01:00
|
|
|
|
2021-02-20 05:05:52 +01:00
|
|
|
#if defined(PSA_WANT_ECC_SECP_K1_224)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)
|
2021-03-25 15:09:47 +01:00
|
|
|
/*
|
|
|
|
|
* SECP224K1 is buggy via the PSA API in Mbed TLS
|
2022-03-31 15:07:01 +02:00
|
|
|
* (https://github.com/Mbed-TLS/mbedtls/issues/3541).
|
2021-03-25 15:09:47 +01:00
|
|
|
*/
|
|
|
|
|
#error "SECP224K1 is buggy via the PSA API in Mbed TLS."
|
2021-02-19 22:08:00 +01:00
|
|
|
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_K1_224 */
|
|
|
|
|
|
|
|
|
|
#if defined(PSA_WANT_ECC_SECP_K1_256)
|
|
|
|
|
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256)
|
2021-03-10 21:14:48 +01:00
|
|
|
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
|
|
|
|
|
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 */
|
|
|
|
|
#endif /* PSA_WANT_ECC_SECP_K1_256 */
|
|
|
|
|
|
2021-04-19 22:24:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* Infer PSA requirements from Mbed TLS capabilities */
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2020-09-30 07:07:04 +02:00
|
|
|
#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
* is not defined
|
|
|
|
|
*/
|
2020-11-25 00:07:04 +01:00
|
|
|
|
2021-03-18 13:40:31 +01:00
|
|
|
#if defined(MBEDTLS_CCM_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
|
2022-03-15 16:40:59 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG 1
|
2021-03-18 13:40:31 +01:00
|
|
|
#define PSA_WANT_ALG_CCM 1
|
2022-03-15 16:40:59 +01:00
|
|
|
#define PSA_WANT_ALG_CCM_STAR_NO_TAG 1
|
2021-03-18 13:40:31 +01:00
|
|
|
#endif /* MBEDTLS_CCM_C */
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_CMAC_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
|
|
|
|
|
#define PSA_WANT_ALG_CMAC 1
|
|
|
|
|
#endif /* MBEDTLS_CMAC_C */
|
|
|
|
|
|
2020-11-17 07:08:34 +01:00
|
|
|
#if defined(MBEDTLS_ECDH_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_ECDH 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* MBEDTLS_ECDH_C */
|
|
|
|
|
|
2020-10-13 06:36:22 +02:00
|
|
|
#if defined(MBEDTLS_ECDSA_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_ECDSA 1
|
2021-04-19 22:24:23 +02:00
|
|
|
#define PSA_WANT_ALG_ECDSA_ANY 1
|
2020-09-30 07:07:04 +02:00
|
|
|
|
2020-10-26 23:25:23 +01:00
|
|
|
// Only add in DETERMINISTIC support if ECDSA is also enabled
|
2020-10-13 06:36:22 +02:00
|
|
|
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1
|
2020-09-30 07:07:04 +02:00
|
|
|
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
|
|
|
|
|
|
2020-10-26 23:25:23 +01:00
|
|
|
#endif /* MBEDTLS_ECDSA_C */
|
|
|
|
|
|
2020-10-29 04:09:55 +01:00
|
|
|
#if defined(MBEDTLS_ECP_C)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-05-26 13:47:09 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
|
2023-06-30 10:09:36 +02:00
|
|
|
/* Normally we wouldn't enable this because it's not implemented in ecp.c,
|
|
|
|
|
* but since it used to be available any time ECP_C was enabled, let's enable
|
|
|
|
|
* it anyway for the sake of backwards compatibility */
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
2023-06-06 14:17:15 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
|
2023-06-30 10:09:36 +02:00
|
|
|
/* See comment for PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE above. */
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
|
2020-10-29 04:09:55 +01:00
|
|
|
#endif /* MBEDTLS_ECP_C */
|
|
|
|
|
|
2023-05-04 09:14:08 +02:00
|
|
|
#if defined(MBEDTLS_DHM_C)
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
2023-05-26 13:47:09 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
|
2023-05-04 09:14:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY 1
|
|
|
|
|
#define PSA_WANT_ALG_FFDH 1
|
|
|
|
|
#define PSA_WANT_DH_FAMILY_RFC7919 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_FFDH 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
2023-05-26 13:47:09 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
|
2023-05-04 09:14:08 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY 1
|
|
|
|
|
#endif /* MBEDTLS_DHM_C */
|
|
|
|
|
|
2021-03-18 13:40:31 +01:00
|
|
|
#if defined(MBEDTLS_GCM_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
|
|
|
|
|
#define PSA_WANT_ALG_GCM 1
|
|
|
|
|
#endif /* MBEDTLS_GCM_C */
|
|
|
|
|
|
2022-06-27 13:34:50 +02:00
|
|
|
/* Enable PSA HKDF algorithm if mbedtls HKDF is supported.
|
|
|
|
|
* PSA HKDF EXTRACT and PSA HKDF EXPAND have minimal cost when
|
|
|
|
|
* PSA HKDF is enabled, so enable both algorithms together
|
|
|
|
|
* with PSA HKDF. */
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#if defined(MBEDTLS_HKDF_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_HMAC 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_HKDF 1
|
2022-06-21 09:58:51 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT 1
|
|
|
|
|
#define PSA_WANT_ALG_HKDF_EXTRACT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXPAND 1
|
|
|
|
|
#define PSA_WANT_ALG_HKDF_EXPAND 1
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#endif /* MBEDTLS_HKDF_C */
|
|
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_HMAC 1
|
2021-01-12 00:00:15 +01:00
|
|
|
#define PSA_WANT_KEY_TYPE_HMAC
|
2022-08-31 20:59:31 +02:00
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_MD_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_TLS12_PRF 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
|
2020-11-17 07:08:34 +01:00
|
|
|
#endif /* MBEDTLS_MD_C */
|
|
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#if defined(MBEDTLS_MD5_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
|
|
|
|
|
#define PSA_WANT_ALG_MD5 1
|
2022-05-25 11:28:22 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECJPAKE_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_PAKE 1
|
2022-06-10 08:58:32 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_JPAKE 1
|
|
|
|
|
#define PSA_WANT_ALG_JPAKE 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_RIPEMD160_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
|
|
|
|
|
#define PSA_WANT_ALG_RIPEMD160 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-10-29 04:09:55 +01:00
|
|
|
#if defined(MBEDTLS_RSA_C)
|
2020-11-01 06:06:54 +01:00
|
|
|
#if defined(MBEDTLS_PKCS1_V15)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
|
2021-04-19 22:24:23 +02:00
|
|
|
#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 1
|
2021-08-10 12:26:15 +02:00
|
|
|
#endif /* MBEDTLS_PKCS1_V15 */
|
2020-11-01 06:06:54 +01:00
|
|
|
#if defined(MBEDTLS_PKCS1_V21)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_RSA_OAEP 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_ALG_RSA_PSS 1
|
2020-11-01 06:06:54 +01:00
|
|
|
#endif /* MBEDTLS_PKCS1_V21 */
|
2023-07-11 16:30:24 +02:00
|
|
|
#if defined(MBEDTLS_GENPRIME)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
|
|
|
|
|
#endif /* MBEDTLS_GENPRIME */
|
2023-06-15 11:53:08 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
2023-05-26 13:47:09 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
2023-06-15 11:53:08 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
2023-05-26 13:47:09 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
|
2020-11-25 00:07:18 +01:00
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
|
Phase 2 support for MBEDTLS_PSA_CRYPTO_CONFIG
This phase adds in support for the following features being
added to the list of features that can be configured in the
include/psa/crypto_config.h header file using the PSA_WANT_ALG_xxx
macros: ECDH, HMAC, HKDF, and RSA. These changes include changes to
the PSA crypto library to use the appropriate new guards that
will allow the feature to be compiled in or out either using
new PSA_WANT_ALG_xxx or the previous MBEDTLS_xxx macros.
For HKDF and HMAC, most of the PSA library code did not have a
specific matching MBEDTLS_xxx macro for that feature, but was instead
using the generic dependent MBEDTLS_MD_C macro. The ECDH and RSA
features more closely aligned with a direct replacement with a similar
macro.
The new tests for RSA, HMAC, and HKDF would normally unset additional
dependent macros, but when attempting to implement that level of
testing it required removal of too many core features like MD_C, PK_C,
ECP_C and other low level features. This may point to additional phases of
work to complete the transition of these features to the new model.
Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
2020-10-30 05:37:36 +01:00
|
|
|
#endif /* MBEDTLS_RSA_C */
|
|
|
|
|
|
2020-12-01 06:06:05 +01:00
|
|
|
#if defined(MBEDTLS_SHA1_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
|
|
|
|
|
#define PSA_WANT_ALG_SHA_1 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-19 16:46:28 +02:00
|
|
|
#if defined(MBEDTLS_SHA224_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
|
2021-01-12 00:00:53 +01:00
|
|
|
#define PSA_WANT_ALG_SHA_224 1
|
2021-04-19 16:46:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA256_C)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
|
2020-12-01 06:06:05 +01:00
|
|
|
#define PSA_WANT_ALG_SHA_256 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-06 14:28:22 +02:00
|
|
|
#if defined(MBEDTLS_SHA384_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
|
|
|
|
|
#define PSA_WANT_ALG_SHA_384 1
|
|
|
|
|
#endif
|
2021-04-06 14:28:22 +02:00
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_SHA512_C)
|
2020-12-01 06:06:05 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
|
|
|
|
|
#define PSA_WANT_ALG_SHA_512 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-01-05 20:03:25 +01:00
|
|
|
#if defined(MBEDTLS_AES_C)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_AES 1
|
2021-01-26 19:44:15 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
|
2021-01-05 20:03:25 +01:00
|
|
|
#endif
|
|
|
|
|
|
2021-10-08 15:48:16 +02:00
|
|
|
#if defined(MBEDTLS_ARIA_C)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_ARIA 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-01-05 20:03:25 +01:00
|
|
|
#if defined(MBEDTLS_CAMELLIA_C)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_CAMELLIA 1
|
2021-01-26 19:44:15 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
|
2021-01-05 20:03:25 +01:00
|
|
|
#endif
|
|
|
|
|
|
2021-01-15 20:04:09 +01:00
|
|
|
#if defined(MBEDTLS_DES_C)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DES 1
|
2021-01-26 19:44:15 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
|
2021-01-15 20:04:09 +01:00
|
|
|
#endif
|
|
|
|
|
|
2022-09-14 16:02:30 +02:00
|
|
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_ECJPAKE_TO_PMS 1
|
|
|
|
|
#define PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-02-09 00:31:46 +01:00
|
|
|
#if defined(MBEDTLS_CHACHA20_C)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_CHACHA20 1
|
|
|
|
|
#define PSA_WANT_ALG_STREAM_CIPHER 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
|
2021-02-09 00:47:35 +01:00
|
|
|
#if defined(MBEDTLS_CHACHAPOLY_C)
|
|
|
|
|
#define PSA_WANT_ALG_CHACHA20_POLY1305 1
|
2021-02-10 00:24:11 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
|
2021-02-09 00:47:35 +01:00
|
|
|
#endif
|
2021-02-09 00:31:46 +01:00
|
|
|
#endif
|
|
|
|
|
|
2021-01-15 20:04:47 +01:00
|
|
|
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
2021-02-10 00:10:29 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_CBC_NO_PADDING 1
|
|
|
|
|
#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_CBC_PKCS7 1
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) || \
|
2021-10-08 15:48:16 +02:00
|
|
|
defined(MBEDTLS_ARIA_C) || defined(MBEDTLS_CAMELLIA_C)
|
2021-02-10 00:10:29 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_ECB_NO_PADDING 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_CFB 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_CTR 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_CIPHER_MODE_OFB)
|
2021-01-26 19:50:36 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
|
2021-01-15 20:04:47 +01:00
|
|
|
#define PSA_WANT_ALG_OFB 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-15 22:53:57 +01:00
|
|
|
#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
|
|
|
|
|
#define PSA_WANT_ECC_BRAINPOOL_P_R1_256
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
|
|
|
|
|
#define PSA_WANT_ECC_BRAINPOOL_P_R1_384
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
|
|
|
|
|
#define PSA_WANT_ECC_BRAINPOOL_P_R1_512
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
|
|
|
|
|
#define PSA_WANT_ECC_MONTGOMERY_255
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-06-08 08:10:10 +02:00
|
|
|
#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
|
2021-03-15 22:53:57 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
|
|
|
|
|
#define PSA_WANT_ECC_MONTGOMERY_448
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-02-19 22:08:00 +01:00
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_R1_192
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_R1_224
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_R1_256
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_R1_384
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_R1_521
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_K1_192
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
2022-03-31 15:07:01 +02:00
|
|
|
/* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
|
2021-03-23 12:06:45 +01:00
|
|
|
#if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_K1_224
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
2021-03-10 21:14:48 +01:00
|
|
|
#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
|
2021-02-20 05:05:52 +01:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
|
|
|
|
|
#define PSA_WANT_ECC_SECP_K1_256
|
2021-02-19 22:08:00 +01:00
|
|
|
#endif
|
|
|
|
|
|
2020-09-24 13:30:10 +02:00
|
|
|
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
|
2020-09-21 08:09:17 +02:00
|
|
|
|
2023-05-10 15:40:05 +02:00
|
|
|
#if defined(PSA_WANT_ALG_JPAKE)
|
|
|
|
|
#define PSA_WANT_ALG_SOME_PAKE 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-06-21 10:06:19 +02:00
|
|
|
/* Even though KEY_PAIR symbols' feature several level of support (BASIC, IMPORT,
|
|
|
|
|
* EXPORT, GENERATE, DERIVE) we're not planning to have support only for BASIC
|
|
|
|
|
* without IMPORT/EXPORT since these last 2 features are strongly used in tests.
|
2023-06-27 16:58:52 +02:00
|
|
|
* In general it is allowed to include more feature than what is strictly
|
|
|
|
|
* requested.
|
|
|
|
|
* As a consequence IMPORT and EXPORT features will be automatically enabled
|
|
|
|
|
* as soon as the BASIC one is. */
|
2023-06-21 10:06:19 +02:00
|
|
|
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
2023-06-27 16:58:52 +02:00
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
2023-06-21 10:06:19 +02:00
|
|
|
#endif
|
|
|
|
|
|
2023-06-27 16:58:52 +02:00
|
|
|
/* See description above */
|
2023-06-21 10:06:19 +02:00
|
|
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
2023-06-27 16:58:52 +02:00
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
2023-05-26 13:46:13 +02:00
|
|
|
#endif
|
|
|
|
|
|
2023-07-10 16:21:00 +02:00
|
|
|
/* See description above */
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* See description above */
|
|
|
|
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-07-10 15:34:41 +02:00
|
|
|
/* See description above */
|
|
|
|
|
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* See description above */
|
|
|
|
|
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
|
|
|
|
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
2023-05-26 13:46:13 +02:00
|
|
|
#endif
|
|
|
|
|
|
2021-02-16 14:06:50 +01:00
|
|
|
/* These features are always enabled. */
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_DERIVE 1
|
2022-12-15 23:25:17 +01:00
|
|
|
#define PSA_WANT_KEY_TYPE_PASSWORD 1
|
|
|
|
|
#define PSA_WANT_KEY_TYPE_PASSWORD_HASH 1
|
2021-02-16 14:06:50 +01:00
|
|
|
#define PSA_WANT_KEY_TYPE_RAW_DATA 1
|
|
|
|
|
|
2020-09-18 06:15:13 +02:00
|
|
|
#endif /* MBEDTLS_CONFIG_PSA_H */
|