File tree Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1156
1156
*/
1157
1157
//#define MBEDTLS_PSA_HAS_ITS_IO
1158
1158
1159
+ /* MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
1160
+ *
1161
+ * In PSA key storage, encode the owner of the key.
1162
+ *
1163
+ * This is only meaningful when building the library as part of a
1164
+ * multi-client service. When you activate this option, you must provide
1165
+ * an implementation of the type psa_key_owner_id_t and a translation
1166
+ * from psa_key_file_id_t to file name in all the storage backends that
1167
+ * you wish to support.
1168
+ *
1169
+ * Note that this option is meant for internal use only and may be removed
1170
+ * without notice.
1171
+ */
1172
+ //#define MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
1173
+
1159
1174
/**
1160
1175
* \def MBEDTLS_MEMORY_DEBUG
1161
1176
*
Original file line number Diff line number Diff line change @@ -68,8 +68,28 @@ typedef uint16_t psa_key_handle_t;
68
68
* #psa_key_id_t. */
69
69
typedef uint32_t psa_app_key_id_t ;
70
70
71
+ #if defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER )
72
+
73
+ typedef struct
74
+ {
75
+ uint32_t key_id ;
76
+ psa_key_owner_id_t owner ;
77
+ } psa_key_file_id_t ;
78
+ #define PSA_KEY_FILE_GET_KEY_ID ( file_id ) ( ( file_id ).key_id )
79
+
80
+ /* Since crypto.h is used as part of the PSA Cryptography API specification,
81
+ * it must use standard types for things like the argument of psa_open_key().
82
+ * If it wasn't for that constraint, psa_open_key() would take a
83
+ * `psa_key_file_id_t` argument. As a workaround, make `psa_key_id_t` an
84
+ * alias for `psa_key_file_id_t` when building for a multi-client service. */
85
+ typedef psa_key_file_id_t psa_key_id_t ;
86
+
87
+ #else /* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
88
+
71
89
/* By default, a key file identifier is just the application key identifier. */
72
90
typedef psa_app_key_id_t psa_key_file_id_t ;
73
91
#define PSA_KEY_FILE_GET_KEY_ID ( id ) ( id )
74
92
93
+ #endif /* !MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
94
+
75
95
#endif /* PSA_CRYPTO_PLATFORM_H */
Original file line number Diff line number Diff line change @@ -90,7 +90,14 @@ typedef uint32_t psa_key_lifetime_t;
90
90
91
91
/** Encoding of identifiers of persistent keys.
92
92
*/
93
+ /* Implementation-specific quirk: The Mbed Crypto library can be built as
94
+ * part of a multi-client service that exposes the PSA Crypto API in each
95
+ * client and encodes the client identity in the key id argument of functions
96
+ * such as psa_open_key(). In this build configuration, we define
97
+ * psa_key_id_t in crypto_platform.h instead of here. */
98
+ #if !defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER )
93
99
typedef uint32_t psa_key_id_t ;
100
+ #endif
94
101
95
102
/**@}*/
96
103
Original file line number Diff line number Diff line change @@ -411,6 +411,9 @@ static const char *features[] = {
411
411
#if defined(MBEDTLS_PSA_HAS_ITS_IO )
412
412
"MBEDTLS_PSA_HAS_ITS_IO" ,
413
413
#endif /* MBEDTLS_PSA_HAS_ITS_IO */
414
+ #if defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER )
415
+ "MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER" ,
416
+ #endif /* MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
414
417
#if defined(MBEDTLS_MEMORY_DEBUG )
415
418
"MBEDTLS_MEMORY_DEBUG" ,
416
419
#endif /* MBEDTLS_MEMORY_DEBUG */
Original file line number Diff line number Diff line change 100
100
MBEDTLS_NO_64BIT_MULTIPLICATION
101
101
MBEDTLS_PSA_CRYPTO_SPM
102
102
MBEDTLS_PSA_HAS_ITS_IO
103
+ MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
103
104
MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
104
105
MBEDTLS_USE_PSA_CRYPTO
105
106
_ALT\s*$
You can’t perform that action at this time.
0 commit comments