Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added conversion helper methods #51

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion psa-crypto/src/types/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,6 @@ impl From<Mac> for psa_crypto_sys::psa_algorithm_t {
}
}

#[cfg(feature = "interface")]
impl From<FullLengthMac> for Mac {
fn from(full_length_mac: FullLengthMac) -> Self {
Mac::FullLength(full_length_mac)
Expand Down Expand Up @@ -925,6 +924,12 @@ impl From<AeadWithDefaultLengthTag> for psa_crypto_sys::psa_algorithm_t {
}
}

impl From<AeadWithDefaultLengthTag> for Aead {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙆‍♂️

fn from(aead_with_default_tag_length: AeadWithDefaultLengthTag) -> Self {
Aead::AeadWithDefaultLengthTag(aead_with_default_tag_length)
}
}

#[cfg(feature = "interface")]
impl From<KeyAgreement> for psa_crypto_sys::psa_algorithm_t {
fn from(key_agreement: KeyAgreement) -> Self {
Expand All @@ -947,6 +952,12 @@ impl From<RawKeyAgreement> for psa_crypto_sys::psa_algorithm_t {
}
}

impl From<RawKeyAgreement> for KeyAgreement {
fn from(raw_key_agreement: RawKeyAgreement) -> Self {
KeyAgreement::Raw(raw_key_agreement)
}
}

#[cfg(feature = "interface")]
impl From<KeyDerivation> for psa_crypto_sys::psa_algorithm_t {
fn from(key_derivation: KeyDerivation) -> Self {
Expand Down