Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 1 | From 2982172aba752f612b4e473626f787155087ddb5 Mon Sep 17 00:00:00 2001 |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 2 | From: Raef Coles <raef.coles@arm.com> |
| 3 | Date: Tue, 19 Jul 2022 11:12:30 +0100 |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 4 | Subject: [PATCH 4/6] Add TF-M builtin key driver |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 5 | |
| 6 | Signed-off-by: Raef Coles <raef.coles@arm.com> |
| 7 | --- |
| 8 | library/psa_crypto.c | 11 +++- |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 9 | library/psa_crypto_driver_wrappers.c | 91 +++++++++++++++++++++++++++- |
| 10 | 2 files changed, 100 insertions(+), 2 deletions(-) |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 11 | |
| 12 | diff --git a/library/psa_crypto.c b/library/psa_crypto.c |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 13 | index cb5791fc..43c8b9e6 100644 |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 14 | --- a/library/psa_crypto.c |
| 15 | +++ b/library/psa_crypto.c |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 16 | @@ -82,6 +82,11 @@ |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 17 | #include "mbedtls/sha256.h" |
| 18 | #include "mbedtls/sha512.h" |
| 19 | |
| 20 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 21 | +#include "tfm_crypto_defs.h" |
| 22 | +#include "tfm_builtin_key_loader.h" |
| 23 | +#endif /* PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER */ |
| 24 | + |
| 25 | #define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( *( array ) ) ) |
| 26 | |
| 27 | #if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF) || \ |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 28 | @@ -947,7 +952,11 @@ static psa_status_t psa_get_and_lock_transparent_key_slot_with_policy( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 29 | if( status != PSA_SUCCESS ) |
| 30 | return( status ); |
| 31 | |
| 32 | - if( psa_key_lifetime_is_external( (*p_slot)->attr.lifetime ) ) |
| 33 | + if( psa_key_lifetime_is_external( (*p_slot)->attr.lifetime ) |
| 34 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 35 | + && PSA_KEY_LIFETIME_GET_LOCATION((*p_slot)->attr.lifetime) != TFM_BUILTIN_KEY_LOADER_KEY_LOCATION |
| 36 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 37 | + ) |
| 38 | { |
| 39 | psa_unlock_key_slot( *p_slot ); |
| 40 | *p_slot = NULL; |
| 41 | diff --git a/library/psa_crypto_driver_wrappers.c b/library/psa_crypto_driver_wrappers.c |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 42 | index e822eef0..08427604 100644 |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 43 | --- a/library/psa_crypto_driver_wrappers.c |
| 44 | +++ b/library/psa_crypto_driver_wrappers.c |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 45 | @@ -58,6 +58,18 @@ |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 46 | #include "cc3xx.h" |
| 47 | #endif /* PSA_CRYPTO_DRIVER_CC3XX */ |
| 48 | |
| 49 | +/* Include TF-M builtin key driver */ |
| 50 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 51 | +#ifndef PSA_CRYPTO_DRIVER_PRESENT |
| 52 | +#define PSA_CRYPTO_DRIVER_PRESENT |
| 53 | +#endif |
| 54 | +#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT |
| 55 | +#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT |
| 56 | +#endif |
| 57 | +#include "tfm_crypto_defs.h" |
| 58 | +#include "tfm_builtin_key_loader.h" |
| 59 | +#endif /* PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER */ |
| 60 | + |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 61 | #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS */ |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 62 | /* END-driver headers */ |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 63 | |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 64 | @@ -71,6 +83,9 @@ |
| 65 | #if defined(PSA_CRYPTO_DRIVER_CC3XX) |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 66 | #define PSA_CRYPTO_CC3XX_DRIVER_ID (4) |
| 67 | #endif /* PSA_CRYPTO_DRIVER_CC3XX */ |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 68 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 69 | +#define PSA_CRYPTO_TFM_BUILTIN_KEY_LOADER_DRIVER_ID (5) |
| 70 | +#endif /* PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER */ |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 71 | |
| 72 | /* END-driver id */ |
| 73 | |
| 74 | @@ -155,6 +170,9 @@ psa_status_t psa_driver_wrapper_sign_message( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 75 | switch( location ) |
| 76 | { |
| 77 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 78 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 79 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 80 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 81 | /* Key is stored in the slot in export representation, so |
| 82 | * cycle through all known transparent accelerators */ |
| 83 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 84 | @@ -243,6 +261,9 @@ psa_status_t psa_driver_wrapper_verify_message( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 85 | switch( location ) |
| 86 | { |
| 87 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 88 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 89 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 90 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 91 | /* Key is stored in the slot in export representation, so |
| 92 | * cycle through all known transparent accelerators */ |
| 93 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 94 | @@ -342,6 +363,9 @@ psa_status_t psa_driver_wrapper_sign_hash( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 95 | switch( location ) |
| 96 | { |
| 97 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 98 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 99 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 100 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 101 | /* Key is stored in the slot in export representation, so |
| 102 | * cycle through all known transparent accelerators */ |
| 103 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 104 | @@ -438,6 +462,9 @@ psa_status_t psa_driver_wrapper_verify_hash( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 105 | switch( location ) |
| 106 | { |
| 107 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 108 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 109 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 110 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 111 | /* Key is stored in the slot in export representation, so |
| 112 | * cycle through all known transparent accelerators */ |
| 113 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 114 | @@ -582,7 +609,11 @@ psa_status_t psa_driver_wrapper_get_key_buffer_size( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 115 | return( ( *key_buffer_size != 0 ) ? |
| 116 | PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED ); |
| 117 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
| 118 | - |
| 119 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 120 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 121 | + return tfm_builtin_key_loader_get_key_buffer_size(psa_get_key_id(attributes), |
| 122 | + key_buffer_size); |
| 123 | +#endif /* PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER */ |
| 124 | default: |
| 125 | (void)key_type; |
| 126 | (void)key_bits; |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 127 | @@ -622,6 +653,9 @@ psa_status_t psa_driver_wrapper_generate_key( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 128 | switch( location ) |
| 129 | { |
| 130 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 131 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 132 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 133 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 134 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
| 135 | /* Transparent drivers are limited to generating asymmetric keys */ |
| 136 | if( PSA_KEY_TYPE_IS_ASYMMETRIC( attributes->core.type ) ) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 137 | @@ -714,6 +748,9 @@ psa_status_t psa_driver_wrapper_import_key( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 138 | switch( location ) |
| 139 | { |
| 140 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 141 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 142 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 143 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 144 | /* Key is stored in the slot in export representation, so |
| 145 | * cycle through all known transparent accelerators */ |
| 146 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 147 | @@ -800,6 +837,9 @@ psa_status_t psa_driver_wrapper_export_key( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 148 | switch( location ) |
| 149 | { |
| 150 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 151 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 152 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 153 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 154 | return( psa_export_key_internal( attributes, |
| 155 | key_buffer, |
| 156 | key_buffer_size, |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 157 | @@ -865,6 +905,9 @@ psa_status_t psa_driver_wrapper_export_public_key( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 158 | switch( location ) |
| 159 | { |
| 160 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 161 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 162 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 163 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 164 | /* Key is stored in the slot in export representation, so |
| 165 | * cycle through all known transparent accelerators */ |
| 166 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 167 | @@ -950,6 +993,13 @@ psa_status_t psa_driver_wrapper_get_builtin_key( |
| 168 | |
| 169 | |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 170 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
| 171 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 172 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 173 | + return( tfm_builtin_key_loader_get_key_buffer( |
| 174 | + slot_number, |
| 175 | + attributes, |
| 176 | + key_buffer, key_buffer_size, key_buffer_length ) ); |
| 177 | +#endif /* PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER */ |
| 178 | default: |
| 179 | (void) slot_number; |
| 180 | (void) key_buffer; |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 181 | @@ -1035,6 +1085,9 @@ psa_status_t psa_driver_wrapper_cipher_encrypt( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 182 | switch( location ) |
| 183 | { |
| 184 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 185 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 186 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 187 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 188 | /* Key is stored in the slot in export representation, so |
| 189 | * cycle through all known transparent accelerators */ |
| 190 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 191 | @@ -1139,6 +1192,9 @@ psa_status_t psa_driver_wrapper_cipher_decrypt( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 192 | switch( location ) |
| 193 | { |
| 194 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 195 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 196 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 197 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 198 | /* Key is stored in the slot in export representation, so |
| 199 | * cycle through all known transparent accelerators */ |
| 200 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 201 | @@ -1228,6 +1284,9 @@ psa_status_t psa_driver_wrapper_cipher_encrypt_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 202 | switch( location ) |
| 203 | { |
| 204 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 205 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 206 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 207 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 208 | /* Key is stored in the slot in export representation, so |
| 209 | * cycle through all known transparent accelerators */ |
| 210 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 211 | @@ -1311,6 +1370,9 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 212 | switch( location ) |
| 213 | { |
| 214 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 215 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 216 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 217 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 218 | /* Key is stored in the slot in export representation, so |
| 219 | * cycle through all known transparent accelerators */ |
| 220 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 221 | @@ -1794,6 +1856,9 @@ psa_status_t psa_driver_wrapper_aead_encrypt( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 222 | switch( location ) |
| 223 | { |
| 224 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 225 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 226 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 227 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 228 | /* Key is stored in the slot in export representation, so |
| 229 | * cycle through all known transparent accelerators */ |
| 230 | |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 231 | @@ -1857,6 +1922,9 @@ psa_status_t psa_driver_wrapper_aead_decrypt( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 232 | switch( location ) |
| 233 | { |
| 234 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 235 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 236 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 237 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 238 | /* Key is stored in the slot in export representation, so |
| 239 | * cycle through all known transparent accelerators */ |
| 240 | |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 241 | @@ -1917,6 +1985,9 @@ psa_status_t psa_driver_wrapper_aead_encrypt_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 242 | switch( location ) |
| 243 | { |
| 244 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 245 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 246 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 247 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 248 | /* Key is stored in the slot in export representation, so |
| 249 | * cycle through all known transparent accelerators */ |
| 250 | |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 251 | @@ -1974,6 +2045,9 @@ psa_status_t psa_driver_wrapper_aead_decrypt_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 252 | switch( location ) |
| 253 | { |
| 254 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 255 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 256 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 257 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 258 | /* Key is stored in the slot in export representation, so |
| 259 | * cycle through all known transparent accelerators */ |
| 260 | |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 261 | @@ -2371,6 +2445,9 @@ psa_status_t psa_driver_wrapper_mac_compute( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 262 | switch( location ) |
| 263 | { |
| 264 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 265 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 266 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 267 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 268 | /* Key is stored in the slot in export representation, so |
| 269 | * cycle through all known transparent accelerators */ |
| 270 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 271 | @@ -2441,6 +2518,9 @@ psa_status_t psa_driver_wrapper_mac_sign_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 272 | switch( location ) |
| 273 | { |
| 274 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 275 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 276 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 277 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 278 | /* Key is stored in the slot in export representation, so |
| 279 | * cycle through all known transparent accelerators */ |
| 280 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 281 | @@ -2522,6 +2602,9 @@ psa_status_t psa_driver_wrapper_mac_verify_setup( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 282 | switch( location ) |
| 283 | { |
| 284 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 285 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 286 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 287 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 288 | /* Key is stored in the slot in export representation, so |
| 289 | * cycle through all known transparent accelerators */ |
| 290 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 291 | @@ -2822,6 +2905,9 @@ psa_status_t psa_driver_wrapper_asymmetric_decrypt( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 292 | switch( location ) |
| 293 | { |
| 294 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 295 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 296 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 297 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 298 | /* Key is stored in the slot in export representation, so |
| 299 | * cycle through all known transparent accelerators */ |
| 300 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
Summer Qin | 614002c | 2023-01-19 15:22:39 +0800 | [diff] [blame] | 301 | @@ -2900,6 +2986,9 @@ psa_status_t psa_driver_wrapper_key_agreement( |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 302 | switch( location ) |
| 303 | { |
| 304 | case PSA_KEY_LOCATION_LOCAL_STORAGE: |
| 305 | +#if defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) |
| 306 | + case TFM_BUILTIN_KEY_LOADER_KEY_LOCATION: |
| 307 | +#endif /* defined(PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER) */ |
| 308 | /* Key is stored in the slot in export representation, so |
| 309 | * cycle through all known transparent accelerators */ |
| 310 | #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) |
| 311 | -- |
Antonio de Angelis | 2718b58 | 2022-08-23 14:58:40 +0100 | [diff] [blame] | 312 | 2.25.1 |
Raef Coles | b97e098 | 2022-02-28 11:29:56 +0000 | [diff] [blame] | 313 | |