-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Enable psa-crypto-api feature
This patch enables psa-crypto-api feature Signed-off-by: Matthew Dalzell <matthew.dalzell@arm.com> Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com> Change-Id: I2f60a50241189cef74d9f6b4bef1bdd915cd29bf
- Loading branch information
1 parent
5404bf9
commit bd21dda
Showing
5 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright (c) 2023 Arm Limited | ||
*/ | ||
|
||
#ifndef MCUBOOT_MBEDTLS_CONFIG_ADD_PSA_CRYPTO_H | ||
#define MCUBOOT_MBEDTLS_CONFIG_ADD_PSA_CRYPTO_H | ||
|
||
#include "mbedtls/build_info.h" | ||
|
||
/* Enable PSA Crypto Core without support for the permanent storage | ||
* Don't define MBEDTLS_PSA_CRYPTO_STORAGE_C to make sure that support | ||
* for permanent keys is not enabled, as it is not usually required during boot | ||
*/ | ||
#define MBEDTLS_PSA_CRYPTO_C | ||
#define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG | ||
|
||
#if defined(MCUBOOT_ENCRYPT_RSA) || defined(MCUBOOT_SIGN_RSA) | ||
#define MBEDTLS_PK_C | ||
#define MBEDTLS_ASN1_PARSE_C | ||
#define MBEDTLS_CTR_DRBG_C | ||
#define MBEDTLS_CIPHER_C | ||
#define MBEDTLS_ENTROPY_C | ||
#define MBEDTLS_PK_PARSE_C | ||
#define MBEDTLS_PK_WRITE_C | ||
#endif /* defined(MCUBOOT_ENCRYPT_RSA) */ | ||
|
||
#if defined(MCUBOOT_ENCRYPT_EC256) || defined(MCUBOOT_ENCRYPT_X25519) | ||
#define MBEDTLS_CIPHER_MODE_CTR | ||
#define MBEDTLS_PLATFORM_FREE_MACRO free | ||
#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc | ||
#define MBEDTLS_AES_C | ||
#endif /* defined(MCUBOOT_ENCRYPT_RSA) */ | ||
|
||
#if !defined(MCUBOOT_ENCRYPT_X25519) | ||
#define MBEDTLS_PSA_BUILTIN_CIPHER 1 | ||
#endif | ||
|
||
#if defined(MCUBOOT_ENCRYPT_KW) | ||
#define MBEDTLS_PSA_CRYPTO_CONFIG | ||
#define MBEDTLS_POLY1305_C | ||
#endif /* MCUBOOT_ENCRYPT_KW */ | ||
|
||
#if MBEDTLS_VERSION_NUMBER == 0x03000000 | ||
/* This PSA define is available only with more recent versions of 3.x */ | ||
#define PSA_KEY_ID_NULL ((psa_key_id_t)0) // not overly happy with this being here | ||
#endif /* MBEDTLS_VERSION_NUMBER == 0x03000000 */ | ||
|
||
#endif /* MCUBOOT_MBEDTLS_CONFIG_ADD_PSA_CRYPTO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright (c) 2023 Arm Limited | ||
*/ | ||
|
||
/* This file, and the methods within are required when PSA Crypto API is enabled | ||
* (--features psa-crypto-api), but the selected combination of features does | ||
* not rely on any PSA Crypto APIs, and will not be adding any of them to the build. | ||
*/ | ||
|
||
#include <bootutil/bootutil_log.h> | ||
|
||
int psa_crypto_init() | ||
{ | ||
BOOT_LOG_SIM("psa_crypto_init() is being stubbed.\n"); | ||
return 0; | ||
} | ||
|
||
void mbedtls_test_enable_insecure_external_rng(){ | ||
BOOT_LOG_SIM("mbedtls_test_enable_insecure_external_rng() is being stubbed.\n"); | ||
} |