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

CryptoAlg-629: Remove prefetch from select_w7 #82

Merged
merged 4 commits into from
Jan 12, 2021
Merged

Conversation

nebeid
Copy link
Contributor

@nebeid nebeid commented Jan 6, 2021

Issues:

Resolves CryptoAlg-629

Description of changes:

This PR addresses the comments from @sebpop on the assembly functions developed to support ARMv8-optimized P-256 implementation.

  • Removed the prefetch instruction from select_w7 to

    let the processor figure out the memory access pattern: in this case it is linear access which is very easy to predict.
    This will reduce code size for the loop and it will reduce execution time by not having to decode the instruction.

    There was a noticeable small improvement in the performance of ECDSA sign (0.6%) and ECDH (0.2%) where multiplying by the base point is employed. It's more noticeable in ECDSA sign than ECDH since multiplication by the base point dominates ECDSA sign operation, but is only the first part of ECDH which also contains multiplication by an arbitrary public point which is a slower operation.
    These improvements are understandably negligible, but they only show that prefetch, which may improve performance in some cases such as tree traversal and on platforms where there isn't a good hardware-supported prefetch, in this case, affects the performance (slightly) negatively.

  • Addressed other comments on the development application such as removing the .arch directive and the -march compilation option.

  • Enabled P-256 optimizations by default on ARMv8
    which means reverting "CryptoAlg-530: Add ci test with -DOPENSSL_AARCH64_P256=1"
    commit 270f803

Call-outs:

N/A

Testing:

Tested on ARMv8 EC2 instance.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This improved the performance slightly, thanks @sebpop.
Also, addressed other comments from Sebastian on the development
application.
Sebastian Pop and others added 3 commits January 6, 2021 16:33
Copy/paste mistake placed `ret` before popping the stack.
This change includes
reverting "CryptoAlg-530: Add ci test with -DOPENSSL_AARCH64_P256=1"
commit
[270f803](aws@270f803).
@nebeid nebeid merged commit 37bb31d into aws:main Jan 12, 2021
dkostic pushed a commit to dkostic/aws-lc that referenced this pull request Dec 5, 2024
This patch adds a constant-time table-lookup function for x86 and its proof.
This resolves issue aws#82.
Also, it contains the following changes:
- The specification of Arm bignum_copy_row_from_table is slightly updated to use
  `LENGTH bignum_copy_row_from_table_mc` rather than its actual number.
- `x86_print_log` flag is added, to do the things what `arm_print_log` does.
- Let `NONOVERLAPPING_TAC` print the goal when it fails, to help users.

Resolving the origin of the problem (dealing with negative offset in nonoverlapping
reasoning) was simply avoided by rewriting the relevant loop assembly code from
decreasing counter form to increasing counter form.
I think this issue must be addressed at some point. For constant-time table lookup, this
wasn't a critical problem however. I have an idea for reducing the time
that proof CI takes, and if it is successful, the time necesary to address this kind
of problem will be significantly reduced... I think this is the right order to tackle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants