bump workspace versions and replace cfg-if in crypto (#2851)

This commit is contained in:
houseme
2026-05-07 17:04:27 +08:00
committed by GitHub
parent f1cd7c1345
commit eaa5ff3053
4 changed files with 146 additions and 96 deletions
-1
View File
@@ -31,7 +31,6 @@ workspace = true
[dependencies]
aes-gcm = { workspace = true, optional = true }
argon2 = { workspace = true, optional = true }
cfg-if = { workspace = true }
chacha20poly1305 = { workspace = true, optional = true }
jsonwebtoken = { workspace = true }
pbkdf2 = { workspace = true, optional = true }
+10 -6
View File
@@ -13,19 +13,23 @@
// limitations under the License.
pub fn native_aes() -> bool {
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
cfg_select! {
any(target_arch = "x86", target_arch = "x86_64") => {
std::is_x86_feature_detected!("aes") && std::is_x86_feature_detected!("pclmulqdq")
} else if #[cfg(target_arch = "aarch64")] {
}
target_arch = "aarch64" => {
std::arch::is_aarch64_feature_detected!("aes")
} else if #[cfg(target_arch = "powerpc64")] {
}
target_arch = "powerpc64" => {
false
} else if #[cfg(target_arch = "s390x")] {
}
target_arch = "s390x" => {
std::is_s390x_feature_detected!("aes")
&& std::is_s390x_feature_detected!("aescbc")
&& std::is_s390x_feature_detected!("aesctr")
&& (std::is_s390x_feature_detected!("aesgcm") || std::is_s390x_feature_detected!("ghash"))
} else {
}
_ => {
false
}
}