fn create_key_id(
    key_triple: KeyTriple,
    key_attributes: KeyAttributes,
    store_handle: &mut dyn ManageKeyIDs,
    local_ids_handle: &mut LocalIdStore,
) -> Result<psa_key_id_t> {
    let mut key_id = rand::random::<psa_key_id_t>();
    while local_ids_handle.contains(&key_id)
        || key_id == 0
        || key_id > constants::PSA_MAX_PERSISTENT_KEY_IDENTIFIER
    {
        key_id = rand::random::<psa_key_id_t>();
    }
    let key_info = KeyInfo {
        id: key_id.to_ne_bytes().to_vec(),
        attributes: key_attributes,
    };
    match store_handle.insert(key_triple.clone(), key_info) {
        Ok(insert_option) => {
            if insert_option.is_some() {
                warn!("Overwriting Key triple mapping ({})", key_triple);
            }
            let _ = local_ids_handle.insert(key_id);

            Ok(key_id)
        }
        Err(string) => Err(key_id_managers::to_response_status(string)),
    }
}
/// Creates a new PSA Key ID and stores it in the Key ID Manager.
Creates a new PSA Key ID and stores it in the Key ID Manager.
Creates a new PSA Key ID and stores it in the Key ID Manager .
fn create_key_id(
    key_triple: KeyTriple,
    key_attributes: KeyAttributes,
    store_handle: &mut dyn ManageKeyIDs,
    local_ids_handle: &mut LocalIdStore,
) -> Result<psa_key_id_t> {
    let mut key_id = rand::random::<psa_key_id_t>();
    while local_ids_handle.contains(&key_id)
        || key_id == 0
        || key_id > constants::PSA_MAX_PERSISTENT_KEY_IDENTIFIER
    {
        key_id = rand::random::<psa_key_id_t>();
    }
    let key_info = KeyInfo {
        id: key_id.to_ne_bytes().to_vec(),
        attributes: key_attributes,
    };
    match store_handle.insert(key_triple.clone(), key_info) {
        Ok(insert_option) => {
            if insert_option.is_some() {
                warn!("Overwriting Key triple mapping ({})", key_triple);
            }
            let _ = local_ids_handle.insert(key_id);
            Ok(key_id)
        }
        Err(string) => Err(key_id_managers::to_response_status(string)),
    }
}
fn create_key_id ( key_triple : KeyTriple , key_attributes : KeyAttributes , store_handle : & mut dyn ManageKeyIDs , local_ids_handle : & mut LocalIdStore , ) -> Result < psa_key_id_t > { let mut key_id = rand :: random :: < psa_key_id_t > ( ) ; while local_ids_handle . contains ( & key_id ) || key_id == 0 || key_id > constants :: PSA_MAX_PERSISTENT_KEY_IDENTIFIER { key_id = rand :: random :: < psa_key_id_t > ( ) ; } let key_info = KeyInfo { id : key_id . to_ne_bytes ( ) . to_vec ( ) , attributes : key_attributes , } ; match store_handle . insert ( key_triple . clone ( ) , key_info ) { Ok ( insert_option ) => { if insert_option . is_some ( ) { warn ! ( " " key_triple ) ; } let _ = local_ids_handle . insert ( key_id ) ; Ok ( key_id ) } Err ( string ) => Err ( key_id_managers :: to_response_status ( string ) ) , } }
Creates a new PSA Key ID and stores it in the Key ID Manager.
Creates a new PSA Key ID and stores it in the Key ID Manager .
key_triple
KeyTriple
key_attributes
KeyAttributes
store_handle
&mut dyn ManageKeyIDs
local_ids_handle
&mut LocalIdStore
key_triple
KeyTriple
key_attributes
KeyAttributes
store_handle
&mut dyn ManageKeyIDs
local_ids_handle
&mut LocalIdStore