You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture/mbed-crypto-storage-specification.md
+89Lines changed: 89 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -193,3 +193,92 @@ The layout of a key file is:
193
193
* key material length (4 bytes)
194
194
* key material: output of `psa_export_key`
195
195
* Any trailing data is rejected on load.
196
+
197
+
Mbed Crypto TBD
198
+
---------------
199
+
200
+
Tags: TBD
201
+
202
+
Released in TBD 2019. <br>
203
+
Integrated in Mbed OS TBD.
204
+
205
+
### Changes introduced in TBD
206
+
207
+
* The layout of a key file now has a lifetime field before the type field.
208
+
* Key files can store references to keys in a secure element. In such key files, the key material contains the slot number.
209
+
210
+
### File namespace on a PSA platform on TBD
211
+
212
+
Assumption: ITS provides a 64-bit file identifier namespace. The Crypto service can use arbitrary file identifiers and no other part of the system accesses the same file identifier namespace.
213
+
214
+
Assumption: the owner identifier is a nonzero value of type `int32_t`.
215
+
216
+
* Files 0 through 0xfffeffff: unused.
217
+
* Files 0xffff0000 through 0xffffffff: reserved for internal use of the crypto library or crypto service. See [non-key files](#non-key-files-on-tbd).
218
+
* Files 0x100000000 through 0xffffffffffff: [content](#key-file-format-for-1.0.0) of the [key whose identifier is the file identifier](#key-names-for-1.0.0). The upper 32 bits determine the owner.
219
+
220
+
### File namespace on ITS as a library on TBD
221
+
222
+
Assumption: ITS provides a 64-bit file identifier namespace. The entity using the crypto library can use arbitrary file identifiers and no other part of the system accesses the same file identifier namespace.
223
+
224
+
This is a library integration, so there is no owner. The key file identifier is identical to the key identifier.
225
+
226
+
* File 0: unused.
227
+
* Files 1 through 0xfffeffff: [content](#key-file-format-for-1.0.0) of the [key whose identifier is the file identifier](#key-names-for-1.0.0).
228
+
* Files 0xffff0000 through 0xffffffff: reserved for internal use of the crypto library or crypto service. See [non-key files](#non-key-files-on-tbd).
229
+
* Files 0x100000000 through 0xffffffffffffffff: unused.
230
+
231
+
### Non-key files on TBD
232
+
233
+
File identifiers in the range 0xffff0000 through 0xffffffff are reserved for internal use in Mbed Crypto.
234
+
235
+
* Files 0xfffffe02 through 0xfffffeff (`PSA_CRYPTO_SE_DRIVER_ITS_UID_BASE + lifetime`): secure element driver storage. The content of the file is the secure element driver's persistent data.
236
+
* File 0xffffff52 (`PSA_CRYPTO_ITS_RANDOM_SEED_UID`): [nonvolatile random seed](#nonvolatile-random-seed-file-format-for-1.0.0).
* For a transparent key: output of `psa_export_key`.
256
+
* For an opaque key (key in a secure element): slot number (8 bytes), in platform endianness.
257
+
* Any trailing data is rejected on load.
258
+
259
+
### Transaction file format for TBD
260
+
261
+
The transaction file contains data about an ongoing action that cannot be completed atomically. It exists only if there is an ongoing transaction.
262
+
263
+
All integers are encoded in platform endianness.
264
+
265
+
All currently existing transactions concern a key in a secure element.
266
+
267
+
The layout of a transaction file is:
268
+
269
+
* type (2 bytes): the [transaction type](#transaction-types-on-tbd).
270
+
* unused (2 bytes)
271
+
* lifetime (4 bytes): `psa_key_lifetime_t` value that corresponds to a key in a secure element.
272
+
* slot number (8 bytes): `psa_key_slot_number_t` value. This is the unique designation of the key for the secure element driver.
273
+
* key identifier (4 bytes in a library integration, 8 bytes on a PSA platform): the internal representation of the key identifier. On a PSA platform, this encodes the key owner in the same way as [in file identifiers for key files](#file-namespace-on-a-psa-platform-on-tbd)).
274
+
275
+
#### Transaction types on TBD
276
+
277
+
* 0x0001: key creation. The following locations may or may not contain data about the key that is being created:
278
+
* The slot in the secure element designated by the slot number.
279
+
* The file containing the key metadata designated by the key identifier.
280
+
* The driver persistent data.
281
+
* 0x0002: key destruction. The following locations may or may not still contain data about the key that is being destroyed:
282
+
* The slot in the secure element designated by the slot number.
283
+
* The file containing the key metadata designated by the key identifier.
0 commit comments