fix(crypto): reject plaintext fallback without crypto (#4391)

* fix(crypto): reject plaintext fallback without crypto

* test(crypto): gate no-feature regression under cfg
This commit is contained in:
Zhengchao An
2026-07-08 09:29:37 +08:00
committed by GitHub
parent 2b063b0c4a
commit f8ee0e7071
6 changed files with 30 additions and 7 deletions
+2 -2
View File
@@ -53,6 +53,6 @@ fn decrypt<T: aes_gcm::aead::Aead>(stream: T, nonce: &[u8], data: &[u8]) -> Resu
}
#[cfg(not(any(test, feature = "crypto")))]
pub fn decrypt_data(_password: &[u8], data: &[u8]) -> Result<Vec<u8>, crate::Error> {
Ok(data.to_vec())
pub fn decrypt_data(_password: &[u8], _data: &[u8]) -> Result<Vec<u8>, crate::Error> {
Err(crate::Error::ErrCryptoDisabled)
}
+2 -2
View File
@@ -75,6 +75,6 @@ fn encrypt<T: aes_gcm::aead::Aead>(
}
#[cfg(not(any(test, feature = "crypto")))]
pub fn encrypt_data(_password: &[u8], data: &[u8]) -> Result<Vec<u8>, crate::Error> {
Ok(data.to_vec())
pub fn encrypt_data(_password: &[u8], _data: &[u8]) -> Result<Vec<u8>, crate::Error> {
Err(crate::Error::ErrCryptoDisabled)
}