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

Clang 12 bignum issue also affects aarch64 #4962

Closed
sfan5 opened this issue Sep 21, 2021 · 1 comment · Fixed by #4968
Closed

Clang 12 bignum issue also affects aarch64 #4962

sfan5 opened this issue Sep 21, 2021 · 1 comment · Fixed by #4968
Labels
bug component-crypto Crypto primitives and low-level interfaces

Comments

@sfan5
Copy link

sfan5 commented Sep 21, 2021

Issue #4943 exists as a reminder but it doesn't look like you're aware of concrete bugs, so I'm opening this issue.
If you are aware of this bug already feel free to close this one.

This is functionally identical to #4917.

Just like the other issue it goes away with gcc or -O1 or by downgrading to mbedTLS 2.26.0.

Steps to reproduce

git clone https://github.com/ARMmbed/mbedtls -b development
cd mbedtls
make -j4 programs || exit 1

echo "Running on $(uname -rms)"
echo "compiler: $($CC --version | head -1)"
echo "commit: $(git rev-parse HEAD)"

./programs/ssl/ssl_server &>/dev/null &
sleep 1
./programs/ssl/ssl_client1
killall ssl_server

Expected behavior

Running on Linux 5.14.1-0-ARCH aarch64
compiler: gcc (GCC) 10.2.0
commit: 304689e

  . Seeding the random number generator... ok
  . Loading the CA root certificate ... ok (0 skipped)
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Performing the SSL/TLS handshake... ok
  . Verifying peer X.509 certificate... ok
[...]

Actual behavior

Running on Linux 5.14.1-0-ARCH aarch64
compiler: clang version 12.0.1
commit: 304689e

  . Seeding the random number generator... ok
  . Loading the CA root certificate ... ok (0 skipped)
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Performing the SSL/TLS handshake...ssl_tls.c:2121: x509_verify_cert() returned -9984 (-0x2700)
ssl_msg.c:4384: mbedtls_ssl_fetch_input() returned -29312 (-0x7280)
ssl_msg.c:3735: ssl_get_next_record() returned -29312 (-0x7280)
ssl_cli.c:2932: mbedtls_ssl_read_record() returned -29312 (-0x7280)
 failed
  ! mbedtls_ssl_handshake returned -0x7280

Last error was: -29312 - SSL - The connection indicated an EOF
@davidhorstmann-arm davidhorstmann-arm added bug component-crypto Crypto primitives and low-level interfaces Community labels Sep 22, 2021
@davidhorstmann-arm
Copy link
Contributor

Thanks for letting us know! We were unaware of this specific bug.

davidhorstmann-arm added a commit to davidhorstmann-arm/mbedtls that referenced this issue Sep 22, 2021
Add memory constraints to the aarch64 inline assembly in MULADDC_STOP.
This fixes an issue where Clang 12 and 13 were generating
non-functional code on aarch64 platforms. See Mbed-TLS#4962, Mbed-TLS#4943
for further details.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
davidhorstmann-arm added a commit to davidhorstmann-arm/mbedtls that referenced this issue Sep 22, 2021
Add memory constraints to the aarch64 inline assembly in MULADDC_STOP.
This fixes an issue where Clang 12 and 13 were generating
non-functional code on aarch64 platforms. See Mbed-TLS#4962, Mbed-TLS#4943
for further details.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
davidhorstmann-arm added a commit to davidhorstmann-arm/mbedtls that referenced this issue Sep 24, 2021
Add memory constraints to the aarch64 inline assembly in MULADDC_STOP.
This fixes an issue where Clang 12 and 13 were generating
non-functional code on aarch64 platforms. See Mbed-TLS#4962, Mbed-TLS#4943
for further details.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants