pub fn convert_algorithm(alg: &Algorithm) -> Result<psa_algorithm_t> {
    let mut algo_val: psa_algorithm_t;
    match alg {
        Algorithm::AsymmetricSignature(asym_sign) => match asym_sign {
            AsymmetricSignature::RsaPkcs1v15Sign { hash_alg } => {
                algo_val = PSA_ALG_RSA_PKCS1V15_SIGN_BASE;
                algo_val |= convert_hash_algorithm(*hash_alg)? & PSA_ALG_HASH_MASK;
                Ok(algo_val)
            }
            _ => Err(ResponseStatus::PsaErrorNotSupported),
        },
        _ => Err(ResponseStatus::PsaErrorNotSupported),
    }
}
/// Converts between native and Mbed Crypto algorithm values.
///
/// # Errors
///
/// Only `AlgorithmInner::Sign` is supported as algorithm with only the
/// `SignAlgorithm::RsaPkcs1v15Sign` signing algorithm. Will return
/// ResponseStatus::PsaErrorNotSupported otherwise.
Converts between native and Mbed Crypto algorithm values.
Converts between native and Mbed Crypto algorithm values .
pub fn convert_algorithm(alg: &Algorithm) -> Result<psa_algorithm_t> {
    let mut algo_val: psa_algorithm_t;
    match alg {
        Algorithm::AsymmetricSignature(asym_sign) => match asym_sign {
            AsymmetricSignature::RsaPkcs1v15Sign { hash_alg } => {
                algo_val = PSA_ALG_RSA_PKCS1V15_SIGN_BASE;
                algo_val |= convert_hash_algorithm(*hash_alg)? & PSA_ALG_HASH_MASK;
                Ok(algo_val)
            }
            _ => Err(ResponseStatus::PsaErrorNotSupported),
        },
        _ => Err(ResponseStatus::PsaErrorNotSupported),
    }
}
pub fn convert_algorithm ( alg : & Algorithm ) -> Result < psa_algorithm_t > { let mut algo_val : psa_algorithm_t ; match alg { Algorithm :: AsymmetricSignature ( asym_sign ) => match asym_sign { AsymmetricSignature :: RsaPkcs1v15Sign { hash_alg } => { algo_val = PSA_ALG_RSA_PKCS1V15_SIGN_BASE ; algo_val |= convert_hash_algorithm ( * hash_alg ) ? & PSA_ALG_HASH_MASK ; Ok ( algo_val ) } _ => Err ( ResponseStatus :: PsaErrorNotSupported ) , } , _ => Err ( ResponseStatus :: PsaErrorNotSupported ) , } }
Converts between native and Mbed Crypto algorithm values.
Converts between native and Mbed Crypto algorithm values .
alg
&Algorithm
alg
&Algorithm
errors
Only `AlgorithmInner::Sign` is supported as algorithm with only the
`SignAlgorithm::RsaPkcs1v15Sign` signing algorithm. Will return
ResponseStatus::PsaErrorNotSupported otherwise.
Only ` AlgorithmInner :: Sign ` is supported as algorithm with only the ` SignAlgorithm :: RsaPkcs1v15Sign ` signing algorithm . Will return ResponseStatus :: PsaErrorNotSupported otherwise .