pub fn convert_status(psa_status: psa_status_t) -> ResponseStatus {
    // psa_status_t errors are i32, negative values between -132 and -151. To map them to u16
    // ResponseStatus values between 1000 and 1999 (as per the Wire Protocol), they are taken their
    // absolute values and added 1000.
    let psa_status = match psa_status.checked_abs() {
        Some(status) => status,
        None => return ResponseStatus::InvalidEncoding,
    };
    let psa_status = match psa_status.checked_add(PSA_STATUS_TO_RESPONSE_STATUS_OFFSET) {
        Some(status) => status,
        None => return ResponseStatus::InvalidEncoding,
    };
    let psa_status = match u16::try_from(psa_status) {
        Ok(status) => status,
        Err(_) => return ResponseStatus::InvalidEncoding,
    };
    psa_status
        .try_into()
        .unwrap_or(ResponseStatus::InvalidEncoding)
}
/// Converts between Mbed Crypto and native status values.
/// Returns None if the conversion can not happen.
Converts between Mbed Crypto and native status values.
Returns None if the conversion can not happen.
Converts between Mbed Crypto and native status values . Returns None if the conversion can not happen .
pub fn convert_status(psa_status: psa_status_t) -> ResponseStatus {
    // psa_status_t errors are i32, negative values between -132 and -151. To map them to u16
    // ResponseStatus values between 1000 and 1999 (as per the Wire Protocol), they are taken their
    // absolute values and added 1000.
    let psa_status = match psa_status.checked_abs() {
        Some(status) => status,
        None => return ResponseStatus::InvalidEncoding,
    };
    let psa_status = match psa_status.checked_add(PSA_STATUS_TO_RESPONSE_STATUS_OFFSET) {
        Some(status) => status,
        None => return ResponseStatus::InvalidEncoding,
    };
    let psa_status = match u16::try_from(psa_status) {
        Ok(status) => status,
        Err(_) => return ResponseStatus::InvalidEncoding,
    };
    psa_status
        .try_into()
        .unwrap_or(ResponseStatus::InvalidEncoding)
}
pub fn convert_status ( psa_status : psa_status_t ) -> ResponseStatus { // psa_status_t errors are i32, negative values between -132 and -151. To map them to u16 // ResponseStatus values between 1000 and 1999 (as per the Wire Protocol), they are taken their // absolute values and added 1000. let psa_status = match psa_status . checked_abs ( ) { Some ( status ) => status , None => return ResponseStatus :: InvalidEncoding , } ; let psa_status = match psa_status . checked_add ( PSA_STATUS_TO_RESPONSE_STATUS_OFFSET ) { Some ( status ) => status , None => return ResponseStatus :: InvalidEncoding , } ; let psa_status = match u16 :: try_from ( psa_status ) { Ok ( status ) => status , Err ( _ ) => return ResponseStatus :: InvalidEncoding , } ; psa_status . try_into ( ) . unwrap_or ( ResponseStatus :: InvalidEncoding ) }
Converts between Mbed Crypto and native status values.
Converts between Mbed Crypto and native status values .
psa_status
psa_status_t
psa_status
psa_status_t