Lines Matching refs:a
5 …s been implemented. Implementations which only ever call PSA functions from a single thread are no…
11 …- Key slots are protected by a global mutex, as described in [Key store consistency and abstractio…
37 …a system is thread-safe if any valid set of concurrent calls is handled as if the effect and retur…
47 There is no busy-waiting in our implementation, every API call completes in a finite number of step…
59 > * A call to `psa_destroy_key()` must not overlap with a concurrent call to any of the following f…
60 > - Any call where the same key identifier is a parameter to the call.
61 > - Any call in a multi-part operation, where the same key identifier was used as a parameter t…
69 …e: suppose two calls are executed concurrently which both attempt to create a new key with the sam…
74 > If the application concurrently modifies an input parameter while a function call is in progress,…
78 …from a single thread, or which protect all PSA calls using a mutex, are not affected by this new f…
92 … identifier does not exist. This is a functional requirement for persistent keys: any thread can i…
95 … called on a key that is in use, guarantee 2 may be violated. This is consistent with the PSA spec…
101 …entry points using the same key, there is also no protection from destroying a key which is in use.
115 …a call to [`psa_crypto_init`](https://arm-software.github.io/psa-api/crypto/1.1/api/library/librar…
119 … same set of keys, as soon as one thread returns from creating/loading a key via a key management …
121 …a lack of resources to cause errors which do not arise in sequential execution. For example, multi…
123 …a mutex operation fails, which only happens if the mutex implementation fails, the error code `PSA…
129 `mbedtls_psa_crypto_free` must only be called by a single thread once all threads have completed th…
139 We have added a mutex `mbedtls_threading_psa_globaldata_mutex` defined in `include/mbedtls/threadin…
141 There are two `psa_global_data_t` structs, each with a single instance `global_data`:
148 A deadlock would occur if a thread attempts to lock a mutex while already holding it. Functions whi…
150 To avoid performance degradation, functions must hold mutexes for as short a time as possible. In p…
155 Keys are stored internally in a global array of key slots known as the "key store", defined in `lib…
159 Each key slot has a state variable and a `registered_readers` counter. These two variables dictate …
161 There are four possible states for a key slot:
164 …le for the next state transition. Other threads cannot read the contents of a slot which is in thi…
165 * `PSA_SLOT_FULL`: the slot contains a key, and any thread is able to use the key after registering…
166 …d or marked for destruction, but at least one thread is still registered as a reader (`registered_…
171 …ween two states `q1` and `q2` with label `f` indicates that if the state of a slot is `q1` immedia…
176 The state of a key slot is updated via the internal function `psa_key_slot_state_transition`. To ch…
178 Changing a slot's state to `PSA_SLOT_EMPTY` is done via `psa_wipe_key_slot`, this function wipes th…
180 …der count of a slot is incremented via `psa_register_read`, and decremented via `psa_unregister_re…
184 The key store is protected by a single global mutex `mbedtls_threading_key_slot_mutex`.
186 …mutex is held; there is a convenience function `psa_unregister_read_under_mutex` which wraps a cal…
194 …a slot which has a `PSA_SLOT_FILLING` or `PSA_SLOT_PENDING_DELETION` state). Attempting to start u…
198 …a lock or unlock operation fails and this is the first failure within a function, the function wil…
200 We have defined a set of macros in `library/psa_crypto_core.h` to capture the common pattern of (un…
204 To load a new key into a slot, the following internal utility functions are used:
206 … `mbedtls_threading_key_slot_mutex`, iterates through the key store to find a slot whose state is …
207 * `psa_start_key_creation` - This function wraps around `psa_reserve_free_key_slot`, if a slot has …
209 * `psa_fail_key_creation` - If there is a failure at any point in the key creation stage, this clea…
213 …a persistent key that has been kicked out of a slot, the call to `psa_get_and_lock_key_slot` will …
215 … `psa_reserve_free_key_slot` cannot find a suitable slot, the key cannot be loaded back in. This w…
219 One-shot operations follow a standard pattern when using an existing key:
221 …_get_and_lock_key_slot_X` functions, which then finds the key and registers the thread as a reader.
222 * They operate on the key slot, usually copying the key into a separate buffer to be used by the op…
225 …a "setup" function where the key is passed in, these functions follow the above pattern. The key i…
231 … is equal to 1. This implements a "last one out closes the door" approach. The final thread to unr…
237 …a "linearization point" for each call, this is a single execution step where the function takes ef…
239 …a resource-management error is not returned. In a set of concurrent calls, it is permitted for a c…
243 …a successful call is the mutex unlock within `psa_finish_key_creation`; it is at this point that t…
244 * `psa_destroy_key` - The linearization point for a successful destruction is the mutex unlock, the…
245 …ization point is the mutex unlock after wiping the slot for a success, or unregistering for a fail…
255 …de the global variables used in tests thread-safe. If multiple threads fail a test assert, the fir…
261 Our testing is a work in progress. It is not feasible to run our traditional, single-threaded, test…
267 …combination of concurrent API calls. API calls can in general be split into a few categories, each…
275 * For every API call, have a test which runs multiple copies of the call simultaneously.
278 …variables are protected, for this we would need to cover every operation in a concurrent scenario …
292 …. This will build on the work that we have already completed. This requires a full suite of testin…
296 …al mutex for finding the relevant key in the key slot, and unregistering as a reader after the ope…
302 …pi/keys/management.html#key-destruction) mandates that implementations make a best effort to ensur…
308 … identifier does not exist. This is a functional requirement for persistent keys: any thread can i…
310 …l exists. Rationale: this is a security requirement. We do not have this requirement yet, but we n…
314 It would be ideal to add these to a future major version; we cannot add these as requirements to th…
318 …* When a thread calls `psa_destroy_key`, they continue as normal until the `psa_unregister_read` c…
331 …an compromise the crypto service. For example, if the operation context has a pointer (depending o…
333 … against this within the library then operations will require a status field protected by a global…
341 * Even with a thread-safe driver, the core never starts the destruction of a key while there are op…
348 …a deadlock is when there are several drivers with circular dependencies. That is, Driver A makes a…
353 2. Provide a new public API that drivers can safely call.
355 …a whitelist of core APIs that drivers can call. Drivers providing entry points to these must not m…
357 …e second and the third would require making it a stable API, and would likely increase the code si…
363 …hread-safe drivers work, thread-safe drivers must not make a call to the core when handling a call…