Use __ARM_FEATURE_CRYPTO for non-Linux and non-FreeBSD
Categories
(NSS :: Libraries, enhancement)
Tracking
(Not tracked)
People
(Reporter: m_kato, Assigned: m_kato)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Actually, we have CPU feature detection for Linux and FreeBSD on aarch64 platform. But others doesn't. Example, macOS has no detection.
We should use __ARM_FEATURE_CRYPTO macro of gcc/clang too for feature detection. macOS's default sets __ARM_FEATURE_CRYPTO since all Apple aarch64 chip seems to implement ARM crypto extension.
Assignee | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
Not sure, is there a particular reason why we need this ? According to the documentation it is deprecated.
https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros?lang=en
Theoretically, current NSS should already build our most efficient crypto for M1 as we check for "arm64" and "darwin" and pass the expected hardware feature requirements to the compiler.
Do we have a DTK or an M1 I could connect to remotely to double check?
Assignee | ||
Comment 2•3 years ago
•
|
||
(In reply to Benjamin Beurdouche [:beurdouche] from comment #1)
Not sure, is there a particular reason why we need this ? According to the documentation it is deprecated.
Apple M1 supports ARM crypto extension, but CheckARMSupports() sets FALSE even if it is supported. It means that NSS don't use ARM specific instructions.
https://developer.arm.com/documentation/101028/0012/5--Feature-test-macros?lang=en
Theoretically, current NSS should already build our most efficient crypto for M1 as we check for "arm64" and "darwin" and pass the expected hardware feature requirements to the compiler.
Do we have a DTK or an M1 I could connect to remotely to double check?
I verified this on Apple M1. All Apple aarch64 chips (inc. iPhone) support ARM crypto extension, and compiler flag of crypto extension is set as default. sysctlbyname supports newer features only such as SHA512 since old apple chip doesn't support newer ARMv8.2/v8.3 features.
Assignee | ||
Comment 3•3 years ago
|
||
Actually, we have CPU feature detection for Linux and FreeBSD on aarch64
platform. But others don't.
macOS doesn't has any CPU feature detection for ARM Crypto Extension, but
toolchain default is turned on. So we should respect __ARM_FEATURE_CRYPTO.
Assignee | ||
Comment 4•3 years ago
|
||
:beurdouche, Although I have no push permission for NSS repository, could you land this? Or should I wait for kjacobs's review?
Comment 5•3 years ago
|
||
Updated•3 years ago
|
Description
•