Crypto: Upgrade Mbed TLS to 2.25
Set the MBEDCRYPTO_VERSION to 2.25.0.
First three patches in existing v2.24 already applied in v2.25
and hence removed.
Replaced MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER with
MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER in all configuration and
source as updated in v2.25 library.
Update all headers of psa/include as per mbedtls-v2.25 excluding
changes required to hide some implementation.
Update id field in the client_key_attributes structure to
psa_key_id_t.
Update Copyright year to 2021!
Removed patch 006 as not required in MbedTLS v2.25.0.
Update references of handle to key as per MbedTLS api changes.
Increase NUM_HANDLES to 32 to accommodate crypto api tests.
Added corresponding tfm implementation of psa_purge_key().
Signed-off-by: Maulik Patel <maulik.patel@arm.com>
Change-Id: I6a532da96735cf32996250c4a8733a8654c1f44e
diff --git a/interface/include/psa/crypto_struct.h b/interface/include/psa/crypto_struct.h
index ac08987..e0ceb2f 100644
--- a/interface/include/psa/crypto_struct.h
+++ b/interface/include/psa/crypto_struct.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -126,11 +126,19 @@
}
static inline void psa_set_key_id(psa_key_attributes_t *attributes,
- psa_key_id_t id)
+ psa_key_id_t key)
{
- attributes->id = id;
- if( attributes->lifetime == PSA_KEY_LIFETIME_VOLATILE )
- attributes->lifetime = PSA_KEY_LIFETIME_PERSISTENT;
+ psa_key_lifetime_t lifetime = attributes->lifetime;
+
+ attributes->id = key;
+
+ if( PSA_KEY_LIFETIME_IS_VOLATILE(lifetime))
+ {
+ attributes->lifetime =
+ PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
+ PSA_KEY_LIFETIME_PERSISTENT,
+ PSA_KEY_LIFETIME_GET_LOCATION(lifetime));
+ }
}
static inline psa_key_id_t psa_get_key_id(
@@ -143,7 +151,7 @@
psa_key_lifetime_t lifetime)
{
attributes->lifetime = lifetime;
- if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
+ if(PSA_KEY_LIFETIME_IS_VOLATILE(lifetime))
{
attributes->id = 0;
}