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

Optimize HACL* Raw RSA decryption to use CRT #295

Open
franziskuskiefer opened this issue Jun 3, 2024 · 3 comments
Open

Optimize HACL* Raw RSA decryption to use CRT #295

franziskuskiefer opened this issue Jun 3, 2024 · 3 comments
Assignees

Comments

@franziskuskiefer
Copy link
Member

No description provided.

@karthikbhargavan
Copy link
Contributor

Tested on multiple platforms and compilers.

Some observations:

  • compiling with gcc on x64 does not appear to enable HACL_CAN_COMPILE_INTRINSICS in lib_intrinsics.h, leading to a performance degradation. enabling this flag provides a significant boos.
  • optimizing at -O2 (like the Linux Kernel) vs -O3 does not make much difference to this code
  • recent GCCs (e.g. 13) are better at optimizing this code than GCC-11
  • recent clang is still about 10-15% faster than recent GCC
  • the optimizations that work differ for x64 and ARM likely because of the difference in mul instructions and pipelining

Performance

  • Our dec code is 10x slower than optimized OpenSSL assembly that uses CRT
  • On x64, our dec code (without CRT) appears to already be competititive with Kernel code (with CRT)

Next Steps:

  • Send update to Cloudflare
  • Implement and verify CRT

@karthikbhargavan
Copy link
Contributor

It is not yet clear whether CRT is needed in this round (although I would like to do it.)

@franziskuskiefer
Copy link
Member Author

Next steps: push upstream to HACL and to consumers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants