mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 14:23:13 +00:00
fix: make cargo check happy
This commit is contained in:
+3
-2
@@ -14,7 +14,7 @@ chacha20poly1305 = { version = "0.10.1", optional = true }
|
||||
jsonwebtoken = "9.3.0"
|
||||
pbkdf2 = { version = "0.12.2", optional = true }
|
||||
rand = { workspace = true, optional = true }
|
||||
sha2 = "0.10.8"
|
||||
sha2 = { version = "0.10.8", optional = true }
|
||||
thiserror.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@@ -24,6 +24,7 @@ test-case.workspace = true
|
||||
time.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["crypto", "fips"]
|
||||
fips = []
|
||||
crypto = [
|
||||
"dep:aes-gcm",
|
||||
@@ -31,8 +32,8 @@ crypto = [
|
||||
"dep:chacha20poly1305",
|
||||
"dep:pbkdf2",
|
||||
"dep:rand",
|
||||
"dep:sha2",
|
||||
]
|
||||
default = ["crypto", "fips"]
|
||||
|
||||
[lints.clippy]
|
||||
unwrap_used = "deny"
|
||||
|
||||
@@ -37,7 +37,7 @@ fn decryp<T: aes_gcm::aead::Aead>(stream: T, nonce: &[u8], data: &[u8]) -> Resul
|
||||
.map_err(Error::ErrDecryptFailed)
|
||||
}
|
||||
|
||||
#[cfg(all(not(test), not(feature = "crypto")))]
|
||||
#[cfg(not(any(test, feature = "crypto")))]
|
||||
pub fn decrypt_data(_password: &[u8], data: &[u8]) -> Result<Vec<u8>, crate::Error> {
|
||||
Ok(data.to_vec())
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ fn encrypt<T: aes_gcm::aead::Aead>(
|
||||
Ok(ciphertext)
|
||||
}
|
||||
|
||||
#[cfg(all(not(test), not(feature = "crypto")))]
|
||||
#[cfg(not(any(test, feature = "crypto")))]
|
||||
pub fn encrypt_data(_password: &[u8], data: &[u8]) -> Result<Vec<u8>, crate::Error> {
|
||||
Ok(data.to_vec())
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,5 +1,3 @@
|
||||
use sha2::digest::InvalidLength;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("unexpected header")]
|
||||
@@ -8,8 +6,9 @@ pub enum Error {
|
||||
#[error("invalid encryption algorithm ID: {0}")]
|
||||
ErrInvalidAlgID(u8),
|
||||
|
||||
#[cfg(any(test, feature = "crypto"))]
|
||||
#[error("{0}")]
|
||||
ErrInvalidLength(#[from] InvalidLength),
|
||||
ErrInvalidLength(#[from] sha2::digest::InvalidLength),
|
||||
|
||||
#[cfg(any(test, feature = "crypto"))]
|
||||
#[error("encrypt failed")]
|
||||
|
||||
Reference in New Issue
Block a user