Skip to content

Commit

Permalink
Simplify code (#9925)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Nov 27, 2023
1 parent 7387983 commit 69ab6f9
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/rust/src/backend/aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,30 +235,30 @@ impl AesSiv {
}
};

#[cfg(not(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER))]
{
return Err(CryptographyError::from(
exceptions::UnsupportedAlgorithm::new_err((
"AES-SIV is not supported by this version of OpenSSL",
exceptions::Reasons::UNSUPPORTED_CIPHER,
)),
));
}
#[cfg(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)]
{
if cryptography_openssl::fips::is_enabled() {
cfg_if::cfg_if! {
if #[cfg(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)] {
if cryptography_openssl::fips::is_enabled() {
return Err(CryptographyError::from(
exceptions::UnsupportedAlgorithm::new_err((
"AES-SIV is not supported by this version of OpenSSL",
exceptions::Reasons::UNSUPPORTED_CIPHER,
)),
));
}

let cipher = openssl::cipher::Cipher::fetch(None, cipher_name, None)?;
Ok(AesSiv {
ctx: EvpCipherAead::new(&cipher, key_buf.as_bytes(), 16, true)?,
})
} else {
return Err(CryptographyError::from(
exceptions::UnsupportedAlgorithm::new_err((
"AES-SIV is not supported by this version of OpenSSL",
exceptions::Reasons::UNSUPPORTED_CIPHER,
)),
));
}

let cipher = openssl::cipher::Cipher::fetch(None, cipher_name, None)?;
Ok(AesSiv {
ctx: EvpCipherAead::new(&cipher, key_buf.as_bytes(), 16, true)?,
})
}
}
}

Expand Down

0 comments on commit 69ab6f9

Please sign in to comment.