From 6e33dbe9fd05087f243c2dedd24261ee2ca6baa3 Mon Sep 17 00:00:00 2001 From: John Durkop Date: Thu, 17 Sep 2020 21:15:13 -0700 Subject: [PATCH] Created infrastructure for MBEDTLS_PSA_CRYPTO_CONFIG In order to prepare for PSA cryptographic mechanism for conditional inclusion of various modules, there needs to be some updates to the mbedtls configuration to enable that feature to work. This initial set of changes just lays the ground work and future changes will implement the functional features. Signed-off-by: John Durkop --- include/mbedtls/config.h | 18 +++++++++++++++++ include/mbedtls/config_psa.h | 39 ++++++++++++++++++++++++++++++++++++ include/psa/crypto_config.h | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 include/mbedtls/config_psa.h create mode 100644 include/psa/crypto_config.h diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index b77b34b6b..cb84c865d 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -2019,6 +2019,15 @@ */ //#define MBEDTLS_USE_PSA_CRYPTO +/** + * \def MBEDTLS_PSA_CRYPTO_CONFIG + * + * This setting should be used to allow for conditional inclusion of PSA features. + * + * Uncomment this to enable use of PSA Crypto configuration settings. + */ +//#define MBEDTLS_PSA_CRYPTO_CONFIG + /** * \def MBEDTLS_VERSION_FEATURES * @@ -3811,6 +3820,15 @@ #include MBEDTLS_USER_CONFIG_FILE #endif +/** + * \name SECTION: PSA Crypto settings + * + */ +#if defined(MBEDTLS_PSA_CRYPTO_CONFIG) +#include "mbedtls/config_psa.h" +#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ + + #include "mbedtls/check_config.h" #endif /* MBEDTLS_CONFIG_H */ diff --git a/include/mbedtls/config_psa.h b/include/mbedtls/config_psa.h new file mode 100644 index 000000000..dde12b82c --- /dev/null +++ b/include/mbedtls/config_psa.h @@ -0,0 +1,39 @@ +/** + * \file mbedtls/config_psa.h + * \brief PSA crypto configuration options (set of defines) + * + * This set of compile-time options may be used to enable + * or disable PSA crypto features selectively. This will aid + * in reducing the size of the library by removing unused code. + */ +/* + * 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 + +#include "psa/crypto_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* MBEDTLS_CONFIG_PSA_H */ diff --git a/include/psa/crypto_config.h b/include/psa/crypto_config.h new file mode 100644 index 000000000..fa83f9a11 --- /dev/null +++ b/include/psa/crypto_config.h @@ -0,0 +1,37 @@ +/** + * \file psa/crypto_config.h + * \brief PSA crypto configuration options (set of defines) + * + * This set of compile-time options may be used to enable + * or disable PSA crypto features selectively. This will aid + * in reducing the size of the library by removing unused code. + */ +/* + * 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 PSA_CRYPTO_CONFIG_H +#define PSA_CRYPTO_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PSA_CRYPTO_CONFIG_H */