Skip to content

Commit c3729e7

Browse files
committed
cpu::intel: Do CPU feature detection in Rust.
1 parent 2a32709 commit c3729e7

5 files changed

Lines changed: 85 additions & 326 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ include = [
3939
"crypto/cipher_extra/test/aes_128_gcm_siv_tests.txt",
4040
"crypto/cipher_extra/test/aes_256_gcm_siv_tests.txt",
4141
"crypto/constant_time_test.c",
42-
"crypto/cpu_intel.c",
4342
"crypto/crypto.c",
4443
"crypto/curve25519/asm/x25519-asm-arm.S",
4544
"crypto/curve25519/curve25519.c",

build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ const RING_SRCS: &[(&[&str], &str)] = &[
6666

6767
(&[ARM, X86_64, X86], "crypto/crypto.c"),
6868

69-
(&[X86_64, X86], "crypto/cpu_intel.c"),
70-
7169
(&[X86], "crypto/fipsmodule/aes/asm/aesni-x86.pl"),
7270
(&[X86], "crypto/fipsmodule/aes/asm/vpaes-x86.pl"),
7371
(&[X86], "crypto/fipsmodule/bn/asm/x86-mont.pl"),
@@ -878,7 +876,6 @@ fn prefix_all_symbols(pp: char, prefix_prefix: &str, prefix: &str) -> String {
878876
"LIMBS_window5_split_window",
879877
"LIMBS_window5_unsplit_window",
880878
"LIMB_shr",
881-
"OPENSSL_cpuid_setup",
882879
"aes_hw_ctr32_encrypt_blocks",
883880
"aes_hw_set_encrypt_key",
884881
"aes_hw_set_encrypt_key_alt",

crypto/cpu_intel.c

Lines changed: 0 additions & 252 deletions
This file was deleted.

crypto/internal.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -510,34 +510,10 @@ static inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
510510

511511
// Runtime CPU feature support
512512

513-
#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
514-
// OPENSSL_ia32cap_P contains the Intel CPUID bits when running on an x86 or
515-
// x86-64 system.
516-
//
517-
// Index 0:
518-
// EDX for CPUID where EAX = 1
519-
// Bit 20 is always zero
520-
// Bit 28 is adjusted to reflect whether the data cache is shared between
521-
// multiple logical cores
522-
// Bit 30 is used to indicate an Intel CPU
523-
// Index 1:
524-
// ECX for CPUID where EAX = 1
525-
// Bit 11 is used to indicate AMD XOP support, not SDBG
526-
// Index 2:
527-
// EBX for CPUID where EAX = 7, ECX = 0
528-
// Bit 14 (for removed feature MPX) is used to indicate a preference for ymm
529-
// registers over zmm even when zmm registers are supported
530-
// Index 3:
531-
// ECX for CPUID where EAX = 7, ECX = 0
532-
//
533-
// Note: the CPUID bits are pre-adjusted for the OSXSAVE bit and the XMM, YMM,
534-
// and AVX512 bits in XCR0, so it is not necessary to check those. (WARNING: See
535-
// caveats in cpu_intel.c.)
536513
#if defined(OPENSSL_X86_64)
537514
extern uint32_t avx2_available;
538515
extern uint32_t adx_bmi2_available;
539516
#endif
540-
#endif
541517

542518

543519
#if defined(OPENSSL_ARM)

0 commit comments

Comments
 (0)