Add crypto target feature detection to arm32 (#833)
This commit is contained in:
parent
e367bcd7f9
commit
09ef01ade1
3 changed files with 19 additions and 0 deletions
|
|
@ -16,4 +16,6 @@ features! {
|
|||
/// Polynomial Multiply
|
||||
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] crc: "crc";
|
||||
/// CRC32 (Cyclic Redundancy Check)
|
||||
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] crypto: "crypto";
|
||||
/// Crypto: AES + PMULL + SHA1 + SHA2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@ pub(crate) fn detect_features() -> cache::Initializer {
|
|||
enable_feature(&mut value, Feature::neon, bit::test(auxv.hwcap, 12));
|
||||
enable_feature(&mut value, Feature::pmull, bit::test(auxv.hwcap2, 1));
|
||||
enable_feature(&mut value, Feature::crc, bit::test(auxv.hwcap2, 4));
|
||||
enable_feature(
|
||||
&mut value,
|
||||
Feature::crypto,
|
||||
bit::test(auxv.hwcap2, 0)
|
||||
&& bit::test(auxv.hwcap2, 1)
|
||||
&& bit::test(auxv.hwcap2, 2)
|
||||
&& bit::test(auxv.hwcap2, 3),
|
||||
);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +39,14 @@ pub(crate) fn detect_features() -> cache::Initializer {
|
|||
);
|
||||
enable_feature(&mut value, Feature::pmull, c.field("Features").has("pmull"));
|
||||
enable_feature(&mut value, Feature::crc, c.field("Features").has("crc32"));
|
||||
enable_feature(
|
||||
&mut value,
|
||||
Feature::crypto,
|
||||
c.field("Features").has("aes")
|
||||
&& c.field("Features").has("pmull")
|
||||
&& c.field("Features").has("sha1")
|
||||
&& c.field("Features").has("sha2"),
|
||||
);
|
||||
return value;
|
||||
}
|
||||
value
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ fn arm_linux() {
|
|||
println!("neon: {}", is_arm_feature_detected!("neon"));
|
||||
println!("pmull: {}", is_arm_feature_detected!("pmull"));
|
||||
println!("crc: {}", is_arm_feature_detected!("crc"));
|
||||
println!("crypto: {}", is_arm_feature_detected!("crypto"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue