File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
src/providers/mbed_provider Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ pub const PSA_ERROR_INVALID_PADDING: psa_status_t = -150;
38
38
pub const PSA_ERROR_INSUFFICIENT_DATA : psa_status_t = -143 ;
39
39
pub const PSA_ERROR_INVALID_HANDLE : psa_status_t = -136 ;
40
40
41
+ pub const PSA_MAX_PERSISTENT_KEY_IDENTIFIER : psa_key_id_t = 0xfffe_ffff ;
41
42
pub const PSA_KEY_SLOT_COUNT : isize = 32 ;
42
43
pub const EMPTY_KEY_HANDLE : psa_key_handle_t = 0 ;
43
44
pub const PSA_KEY_TYPE_NONE : psa_key_type_t = 0x0000_0000 ;
Original file line number Diff line number Diff line change @@ -107,7 +107,10 @@ fn create_key_id(
107
107
local_ids_handle : & mut LocalIdStore ,
108
108
) -> Result < psa_crypto_binding:: psa_key_id_t > {
109
109
let mut key_id = rand:: random :: < psa_crypto_binding:: psa_key_id_t > ( ) ;
110
- while local_ids_handle. contains ( & key_id) {
110
+ while local_ids_handle. contains ( & key_id)
111
+ && key_id != 0
112
+ && key_id < constants:: PSA_MAX_PERSISTENT_KEY_IDENTIFIER
113
+ {
111
114
key_id = rand:: random :: < psa_crypto_binding:: psa_key_id_t > ( ) ;
112
115
}
113
116
match store_handle. insert ( key_triple. clone ( ) , key_id. to_ne_bytes ( ) . to_vec ( ) ) {
You can’t perform that action at this time.
0 commit comments