Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use __ARMEL__/__ARMEB__ in aarch64 assembly #22176

Closed

Conversation

khorben
Copy link

@khorben khorben commented Sep 22, 2023

This imports a fix relevant to the 3.0.x branch from master, related to the use of __ARMEL__ and __ARMEB__ in aarch64 assembly.

GCC's __ARMEL__ and __ARMEB__ defines denote little- and big-endian arm,
respectively. They are not defined on aarch64, which instead use
__AARCH64EL__ and __AARCH64EB__.

However, OpenSSL's assembly originally used the 32-bit defines on both
platforms and even define __ARMEL__ and __ARMEB__ in arm_arch.h. This is
less portable and can even interfere with other headers, which use
__ARMEL__ to detect little-endian arm.

Over time, the aarch64 assembly has switched to the correct defines,
such as in 32bbb62. This commit
finishes the job: poly1305-armv8.pl needed a fix and the dual-arch
armx.pl files get one more transform to convert from 32-bit to 64-bit.

(There is an even more official endianness detector, __ARM_BIG_ENDIAN in
the Arm C Language Extensions. But I've stuck with the GCC ones here as
that would be a larger change.)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from openssl#17373)
Copy link
Contributor

@tom-cosgrove-arm tom-cosgrove-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Sep 22, 2023
@tom-cosgrove-arm tom-cosgrove-arm added approval: otc review pending This pull request needs review by an OTC member triaged: refactor The issue/pr requests/implements refactoring branch: 3.0 Merge to openssl-3.0 branch tests: exempted The PR is exempt from requirements for testing and removed severity: fips change The pull request changes FIPS provider sources labels Sep 22, 2023
@t8m
Copy link
Member

t8m commented Sep 23, 2023

This is also relevant for the 3.1 branch. Before we can merge this to 3.0 can you please ensure this either can be cleanly cherry-picked there or that there is an equivalent PR for the 3.1 branch?

@paulidale paulidale removed the approval: otc review pending This pull request needs review by an OTC member label Sep 23, 2023
@khorben
Copy link
Author

khorben commented Sep 25, 2023

This is also relevant for the 3.1 branch. Before we can merge this to 3.0 can you please ensure this either can be cleanly cherry-picked there or that there is an equivalent PR for the 3.1 branch?

This commit has already been cherry-picked in the 3.1 branch on November 9th 2022 (0029f78).

@paulidale paulidale added the approval: ready to merge The 24 hour grace period has passed, ready to merge label Sep 26, 2023
@t8m
Copy link
Member

t8m commented Sep 26, 2023

This commit has already been cherry-picked in the 3.1 branch on November 9th 2022 (0029f78).

Ah, right.

@t8m
Copy link
Member

t8m commented Oct 5, 2023

Merged to the 3.0 branch. Thank you for your contribution.

@t8m t8m closed this Oct 5, 2023
openssl-machine pushed a commit that referenced this pull request Oct 5, 2023
GCC's __ARMEL__ and __ARMEB__ defines denote little- and big-endian arm,
respectively. They are not defined on aarch64, which instead use
__AARCH64EL__ and __AARCH64EB__.

However, OpenSSL's assembly originally used the 32-bit defines on both
platforms and even define __ARMEL__ and __ARMEB__ in arm_arch.h. This is
less portable and can even interfere with other headers, which use
__ARMEL__ to detect little-endian arm.

Over time, the aarch64 assembly has switched to the correct defines,
such as in 32bbb62. This commit
finishes the job: poly1305-armv8.pl needed a fix and the dual-arch
armx.pl files get one more transform to convert from 32-bit to 64-bit.

(There is an even more official endianness detector, __ARM_BIG_ENDIAN in
the Arm C Language Extensions. But I've stuck with the GCC ones here as
that would be a larger change.)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from #22176)
wanghao75 pushed a commit to openeuler-mirror/openssl that referenced this pull request Oct 9, 2023
GCC's __ARMEL__ and __ARMEB__ defines denote little- and big-endian arm,
respectively. They are not defined on aarch64, which instead use
__AARCH64EL__ and __AARCH64EB__.

However, OpenSSL's assembly originally used the 32-bit defines on both
platforms and even define __ARMEL__ and __ARMEB__ in arm_arch.h. This is
less portable and can even interfere with other headers, which use
__ARMEL__ to detect little-endian arm.

Over time, the aarch64 assembly has switched to the correct defines,
such as in 32bbb62. This commit
finishes the job: poly1305-armv8.pl needed a fix and the dual-arch
armx.pl files get one more transform to convert from 32-bit to 64-bit.

(There is an even more official endianness detector, __ARM_BIG_ENDIAN in
the Arm C Language Extensions. But I've stuck with the GCC ones here as
that would be a larger change.)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from openssl/openssl#22176)

Signed-off-by: fly2x <fly2x@hitls.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: 3.0 Merge to openssl-3.0 branch tests: exempted The PR is exempt from requirements for testing triaged: refactor The issue/pr requests/implements refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants