ARM & Aarch64: Add ability to disable hardware crypto for testing.

This commit is contained in:
Brian Smith 2023-10-01 20:46:31 -07:00
parent 00d639339a
commit e4a85afb58
2 changed files with 14 additions and 1 deletions

View File

@ -200,6 +200,8 @@ alloc = []
dev_urandom_fallback = []
slow_tests = []
std = ["alloc"]
unstable-testing-arm-no-hw = []
unstable-testing-arm-no-neon = []
test_logging = []
wasm32_unknown_unknown_js = ["getrandom/js"]

View File

@ -256,7 +256,18 @@ features! {
)
))]
pub unsafe fn initialize_OPENSSL_armcap_P() {
OPENSSL_armcap_P = ARMCAP_STATIC | detect_features();
let detected = detect_features();
let filtered = (if cfg!(feature = "unstable-testing-arm-no-hw") {
AES.mask | SHA256.mask | PMULL.mask
} else {
0
}) | (if cfg!(feature = "unstable-testing-arm-no-neon") {
NEON.mask
} else {
0
});
let detected = detected & !filtered;
OPENSSL_armcap_P = ARMCAP_STATIC | detected;
}
// Some non-Rust code still checks this even when it is statically known