Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PSA Crypto APIs in Mbed TLS on Non-Secure side #91

Merged

Conversation

AhmedIsmail02
Copy link
Contributor

Description

This PR enables using PSA Crypto APIs in Mbed TLS running on Non-Secure side, the following changes were done:

  • MBEDTLS_PSA_CRYPTO macro is defined in aws_mbedtls_config.h header file to indicate that PSA Crypto APIs should be used.
  • MBEDTLS_PSA_CRYPTO_C macro shall be defined in aws_mbedtls_config.h header file to indicate that PSA Crypto APIs implementation is to be provided by Mbed TLS.
  • MBEDTLS_PSA_CRYPTO_CLIENT macro shall be defined in aws_mbedtls_config.h header file to indicate that PSA Crypto APIs implementation is to be provided by TF-M.
  • tfm-ns-interface library is linked to Mbed TLS library in case of using TF-M as the PSA Crypto APIs implementation to expose TF-M's PSA Crypto APIs interfaces for Mbed TLS library.
  • CRYPTO_IOVEC_BUFFER_SIZE is changed from 5120 to 20000 as the PSA Crypto APIs require larger buffer size for communication between secure and non-secure spaces.
  • A new Mbed TLS patch is added to fix guard protection for functions/ headers.
  • All platforms' stack sizes were increased from 0x1000 to 0x2000 as in case of using ARMClang toolchain, a stack overflow was noticed after applying the previous changes.
  • Internal CI is using TF-M as the PSA Crypto APIs implementation for merge requests., along with nightlies except for iot-vsocket-psa-crypto-mbedtls-test nightly test.
  • When using Mbed TLS on the non-secure side as PSA crypto implementation, the device and provision keys are defined as volatile since we currently don't have support for file system.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

urutva and others added 9 commits September 20, 2024 16:17
To enable using PSA Crypto APIs in Mbed TLS running on
Non-Secure side, the following changes were done:

* `MBEDTLS_PSA_CRYPTO` macro is defined in `aws_mbedtls_config.h`
header file to indicate that PSA Crypto APIs should be used.

* `tfm-ns-interface` library is linked to mbedtls library
to make TF-M's PSA Crypto APIs interfaces available for mbedtls
library.

* `CRYPTO_IOVEC_BUFFER_SIZE` is changed from 5120 to 20000 as the
PSA Crypto APIs require larger buffer size for communication between
secure and non-secure spaces.

* A new Mbed TLS patch is added to fix guard protection for functions/
headers, the patch is to be added upstream.

* All platforms' stack sizes were increased from `0x1000` to `0x2000`
as in case of using ARMClang toolchain, a stack overflow was noticed
after applying the previous changes.

Signed-off-by: Devaraj Ranganna <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
A new configuration option is added to control which
library (TF-M/MBED TLS) is providing the PSA Crypto APIs
implementation.

Signed-off-by: Ahmed Ismail <[email protected]>
-g3 compiler options can be used in generating
provisioning AXF file without any issues.

Signed-off-by: Ahmed Ismail <[email protected]>
FRI supports PSA crypto implementation either using TF-M on the secure
side or using Mbed TLS on the non-secure side. When using Mbed TLS on
the non-secure side as PSA crypto implementation, the device and
provision keys are defined as volatile since we currently don't have
support for file system.

In addition, when using Mbed TLS on the non-secure side as PSA crypto
implementation, `MBEDTLS_PKCS1_V21` (support for PKCS#1 v2.1 encoding)
is enabled for OTA image validation to work.

Signed-off-by: Devaraj Ranganna <[email protected]>
FRI supports PSA crypto implementation either using TF-M on the secure
side or using Mbed TLS on the non-secure side. When using Mbed TLS on
the non-secure side as PSA crypto implementation, the device and
provision keys are defined as volatile since we currently don't have
support for file system.

Signed-off-by: Devaraj Ranganna <[email protected]>
A new configuration option is added to control which
library (TF-M/MBED TLS) is providing the PSA Crypto APIs
implementation.

In addition, enable using PSA crypto APIs in Mbed TLS running on
Non-Secure side.

Signed-off-by: Devaraj Ranganna <[email protected]>
A new configuration option is added to control which
library (TF-M/MBED TLS) is providing the PSA Crypto APIs
implementation.

In addition, enable using PSA crypto APIs in Mbed TLS running on
Non-Secure side.

Signed-off-by: Devaraj Ranganna <[email protected]>
Top level README.md along with applications' documents
are updated to illustrate how the new PSA Crypto APIs
implementation configuration option can be used, and
mention the available configurations for the new option.

Signed-off-by: Ahmed Ismail <[email protected]>
@AhmedIsmail02 AhmedIsmail02 requested a review from a team as a code owner September 24, 2024 10:25
@aggarg aggarg merged commit 0d54d03 into FreeRTOS:main Sep 25, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants