18
18
#include " Efr32OpaqueKeypair.h"
19
19
#include " em_device.h"
20
20
#include < psa/crypto.h>
21
+ #include < sl_psa_crypto.h>
21
22
22
23
#include < lib/core/CHIPSafeCasts.h>
23
24
#include < lib/support/CHIPMem.h>
@@ -47,14 +48,6 @@ namespace Internal {
47
48
static_assert ((kEFR32OpaqueKeyIdPersistentMax - kEFR32OpaqueKeyIdPersistentMin ) < PSA_KEY_ID_FOR_MATTER_SIZE,
48
49
" Not enough PSA range to store all allowed opaque key IDs" );
49
50
50
- #if defined(SEMAILBOX_PRESENT) && (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT)
51
- #define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_SE_OPAQUE
52
- #elif defined(CRYPTOACC_PRESENT) && defined(SEPUF_PRESENT) && defined(SL_TRUSTZONE_NONSECURE)
53
- #define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_CRYPTOACC_OPAQUE
54
- #else
55
- #define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_LOCAL_STORAGE
56
- #endif
57
-
58
51
static void _log_PSA_error (psa_status_t status)
59
52
{
60
53
if (status != PSA_SUCCESS)
@@ -190,7 +183,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey
190
183
if (opaque_id == kEFR32OpaqueKeyIdVolatile )
191
184
{
192
185
psa_set_key_lifetime (
193
- &attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (PSA_KEY_LIFETIME_VOLATILE, PSA_CRYPTO_LOCATION_FOR_DEVICE));
186
+ &attr,
187
+ PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (PSA_KEY_LIFETIME_VOLATILE, sl_psa_get_most_secure_key_location ()));
194
188
}
195
189
else
196
190
{
@@ -210,7 +204,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey
210
204
211
205
psa_set_key_id (&attr, key_id);
212
206
psa_set_key_lifetime (
213
- &attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (PSA_KEY_LIFETIME_PERSISTENT, PSA_CRYPTO_LOCATION_FOR_DEVICE));
207
+ &attr,
208
+ PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (PSA_KEY_LIFETIME_PERSISTENT, sl_psa_get_most_secure_key_location ()));
214
209
}
215
210
216
211
switch (usage)
0 commit comments