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

[nrf noup] Add support for statically allocated storage slots #20

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

frkv
Copy link
Contributor

@frkv frkv commented Feb 3, 2025

-This [nrf noup] will be removed on the update of oberon-psa-crypto
to v1.3.4 or later.
-This updates the Mbed TLS version to v3.6.2 with patches for
statically allocated storage which is put in place to make it possible
to avoid dependency on heap for constrained devices.
-This commit is narrowed down to only add this feature while not
taking in other changes from oberon-psa-crypto v1.3.4.
-Note this also include addition of MBEDTLS_PSA_KEY_STORE_DYNAMIC
which is the counterpar to statically generated key slots

-Minor fix: Fixing a minor issue with platform_util.c around
MBEDTLS_HAVE_TIME_DATA && !MBEDTLS_PLATFORM_GMTIME_R_ALT

Ref: NCSDK-30210

frkv and others added 23 commits August 22, 2024 14:36
-Remove legacy header files from oberon-psa-crypto that are duplicates
 of files from standard Mbed TLS distribution (modules/crypto/

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-This removes the redefinition of the define
 PSA_VENDOR_ECC_MAX_CURVE_BITS which we allow to
 be set in our configuration file from nrf security.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
The core doesn't include some brainpool key
sizes, this change adds these bit sizes:
160
192
224
256
320

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
We don't use the file in our system, we use the
generated headers (nrf-config.h and nrf-config-user.h)
from nrf_security.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
The PSA driver for CryptoCell uses the PSA crypto driver
wrapper calls for the hash operation.

The Oberon context size therefore needs to be static.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
Turn the repo into a Zephyr module so we can use the
ZEPHYR_bla_bla_MODULE_DIR CMake variable.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
-This updates the build_info.h to match with Mbed TLS v3.6.1 distribution
 and is done to ensure that legacy support and TLS/DTLS and X.509 support

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Patch to enable more key types for KDF.

Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Add checks for the key attributes, key sizes and a zero check
for ecc keys for importing keys.

Also a attribute check for psa_generate_key.

This was [nrf fromlist] and is now [nrf noup]

Upstream PR:oberon-psa-crypto-nrf/pull/15 (closed)

Ref: NCSDK-24820

Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
The psa_crypto_storage_store retuns DATA_INVALID for
all the error codes coming from psa_its_set.
This causes some issues for our testing infanstructure
since it doesn't follow the PSA spec recomendation
for return codes.

This was a [nrf fromlist] but it has become a [nrf noup]

Upstream PR: pull/14 (Closed)

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Run crypto and TF-M tests on sdk-nrf downstream

Signed-off-by: Stephen Kingston <stephen.kingston@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Opens the full range of vendor keys to be used via builtin key
mechanism.

Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Adds the capability of import and destroying persistent keys
that are "builtin" i.e. handled fully by PSA driver implementation.

Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
In line 568 of this file we use this function when either of
these two defines are set:
defined(PSA_NEED_OBERON_TLS12_PRF) ||
defined(PSA_NEED_OBERON_TLS12_PSK_TO_MS)

Add these two defines here as well to avoid a missing
function warning that we are getting.

Upstream PR: oberon-psa-crypto-nrf/pull/16

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Patch to make server and client attributes compatible.
Oberon will support this in the future.

Reworked from commit 5bfe42c
Reworded due to psa_core_key_attributes_t being removed in Mbed TLS 3.6.0

The psa_core_key_attributes_t declaration is now integrated into
psa_key_attributes_s and the macro PSA_CORE_KEY_ATTRIBUTES_INIT
has been replaced with PSA_KEY_ATTRIBUTES_INIT.

Signed-off-by: Vidar Lillebø <vidar.lillebo@nordicsemi.no>
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-This simplifies PSA crypto operation struct initialization to
 better tailor to the SSF use-case. This simplifies the initializers
 to only be empty brackets, assuming zero-initialized structs
 without the added complexities of writing every sub-type out.
 This is done to prevent compilation warnings for PSA crypto builds.

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-This comes from a change in Mbed TLS 3.6.0 where the attributes
 type has changed (was wrapped type before)

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-This is a [nrf noup] as we are using MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
 more actively then Oberon PSA core. This commit ensures we are only
 enabling mbedtls_psa_crypto_configure_entropy_sources when
 entropy/rng is not enabled by external sources

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Zephyr has a global list of include directories that is applicable for
all modules unless specifically excluded by using "targets", and using a
generic named header can cause issues if there are duplicate headers
files and depending on the inclusion order.

So, rename the header with module prefix to avoid naming collision.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
RFC8032 mentions the length of a key for ed448 and ed448ph to be 57 bytes (456 bits).

Using 448 bits as a max length creates a buffer overflow warning when building with ED448 enabled.
-This [nrf noup] will be removed on the update of oberon-psa-crypto
 to v1.3.4 or later.
-This updates the Mbed TLS version to v3.6.2 with patches for
 statically allocated storage which is put in place to make it possible
 to avoid dependency on heap for constrained devices.
-This commit is narrowed down to only add this feature while not
 taking in other changes from oberon-psa-crypto v1.3.4.
-Note this also include addition of MBEDTLS_PSA_KEY_STORE_DYNAMIC
 which is the counterpar to statically generated key slots

-Minor fix: Fixing a minor issue with platform_util.c around
 MBEDTLS_HAVE_TIME_DATA && !MBEDTLS_PLATFORM_GMTIME_R_ALT

Ref: NCSDK-30210

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-Adding MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
-Adding PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE
-Adding PSA_CIPHER_MAX_KEY_LENGTH
-This is out of sync with Mbed TLS v3.6.2 (with patches), which
 is essentially the content of the coming v3.6.3 version
-This [nrf noup] can be removed once oberon-psa-crypto post v1.3.4
 is integrated in sdk-oberon-psa-crypto

Ref: NCSDK-30210

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
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.

8 participants