Closed Bug 1678990 Opened 3 years ago Closed 3 years ago

Use __ARM_FEATURE_CRYPTO for non-Linux and non-FreeBSD

Categories

(NSS :: Libraries, enhancement)

ARM64
macOS
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

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.

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?

Flags: needinfo?(m_kato)

(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.

Flags: needinfo?(m_kato)

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.

:beurdouche, Although I have no push permission for NSS repository, could you land this? Or should I wait for kjacobs's review?

Flags: needinfo?(bbeurdouche)
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.60
Flags: needinfo?(bbeurdouche)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: