Skip to content

Commit

Permalink
ARM & Aarch64: Add ability to disable hardware crypto for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Oct 2, 2023
1 parent 00d6393 commit e4a85af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
13 changes: 12 additions & 1 deletion src/cpu/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e4a85af

Please sign in to comment.