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

Backport 2.16: bn_mul.h: require at least ARMv6 to enable the ARM DSP code #2778

Conversation

gilles-peskine-arm
Copy link
Contributor

Fix the build on ARMv5TE in ARM mode. The assembly code in bn_mul.h uses DSP instructions that are not available on this particular architecture, so set the conditional compilation directives to exclude them.

Fix originally contributed in #2169 by @aurel32. I rebased to mbedtls-2.16 to facilitate testing and added a changelog entry and a non-regression test.

aurel32 and others added 3 commits August 3, 2019 14:22
Commit 16b1bd8 "bn_mul.h: add ARM DSP optimized MULADDC code"
added some ARM DSP instructions that was assumed to always be available
when __ARM_FEATURE_DSP is defined to 1. Unfortunately it appears that
the ARMv5TE architecture (GCC flag -march=armv5te) supports the DSP
instructions, but only in Thumb mode and not in ARM mode, despite
defining __ARM_FEATURE_DSP in both cases.

This patch fixes the build issue by requiring at least ARMv6 in addition
to the DSP feature.
Non-regression test for
"bn_mul.h: require at least ARMv6 to enable the ARM DSP code"
Without any -O option, the default is -O0, and then the assembly code
is not used, so this would not be a non-regression test for the
assembly code that doesn't build.
@jainvikas8 jainvikas8 self-requested a review August 9, 2019 07:03
AndrzejKurek
AndrzejKurek previously approved these changes Aug 9, 2019
Copy link
Contributor

@AndrzejKurek AndrzejKurek left a comment

Choose a reason for hiding this comment

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

This PR is consistent with the original one.

@jainvikas8
Copy link
Contributor

I see a test failure

DTLS proxy: duplicate every packet, server anti-replay off ............. FAIL
! pattern 'resend' MUST be present in the Client output
! outputs saved to o-XXX-548.log

Is this a known issue?

@AndrzejKurek
Copy link
Contributor

AndrzejKurek commented Aug 9, 2019

@jainvikas8 Oh, DTLS proxy tests consistency was an issue some time ago, I thought that it has already been fixed :) This seems unrelated to the PR.

@gilles-peskine-arm
Copy link
Contributor Author

The test failure is one instance of one DTLS test, presumably due to a timeout, which is a known problem and obviously unrelated to this PR. So CI is ok.

jainvikas8
jainvikas8 previously approved these changes Aug 9, 2019
Copy link
Contributor

@jainvikas8 jainvikas8 left a comment

Choose a reason for hiding this comment

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

This is as good as this PR.

k-stachowiak
k-stachowiak previously approved these changes Aug 9, 2019
Call the component xxx_arm5vte, because that's what it does. Explain
"armel", and more generally why this component exists, in a comment.
Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

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

I approve the changes, except for the changelog conflict here and in the base PR, which will need to be resolved.

@gilles-peskine-arm
Copy link
Contributor Author

@k-stachowiak It's ok, we resolve add/add changelog conflicts at merge time.

@gilles-peskine-arm gilles-peskine-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Aug 13, 2019
@gilles-peskine-arm gilles-peskine-arm merged commit 560f332 into Mbed-TLS:mbedtls-2.16 Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants