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

non-temporal aes-gcm engine #384

Merged
merged 52 commits into from
Jun 30, 2022
Merged

non-temporal aes-gcm engine #384

merged 52 commits into from
Jun 30, 2022

Conversation

kazuho
Copy link
Member

@kazuho kazuho commented May 1, 2022

This PR implements "non-temporal aes-gcm" engine, that uses non-temporal store instructions when emitting encrypted bytes.

ToDo:

  • Add more tests (like unaligned output).
  • Use 256-bit AESNI / CLMUL instructions when available (Zen 3).
  • Suppress false positives found by ASAN. The engine works on 64-byte lines. If either edge of the supplied output buffer is not aligned to 64-byte, the engine reads the 64-byte line covering the edge, modifies the necessary bytes, then write back the entire line.
  • Implement decrypt side. It's a bit slower than OpenSSL with GCC, bit faster with clang.

Builds on top of #385.

non-temporal aes-gcm engine (encrypt; commit 9f8e12ae)

Older result: as of e0caecc, aes128gcm (16KB block) throughput, compared to openssl (ubuntu 20.04):

gcc (nt on) gcc (nt off1) clang (nt on) clang (nt off)
Core i5 9400 84.1% 95.8% 91.1% 92.2%
Ryzen 7 4750G 97.9% 101.8% 97.3% 101.2%

*: "nt off" indicates that non-temporal store instructions (_mm_stream_si256) were replaced by ordinary stores (_mm_store_si256).

@kazuho kazuho mentioned this pull request May 1, 2022
@kazuho kazuho changed the base branch from master to kazuho/vectorized May 1, 2022 06:03
Copy link
Collaborator

@huitema huitema left a comment

Choose a reason for hiding this comment

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

Maybe split this PR in two? First, do the API changes in struct st_ptls_aead_context_t, including the changes in the bcrypt library, and then, add the support for fastls?

include/picotls.h Outdated Show resolved Hide resolved
@kazuho
Copy link
Member Author

kazuho commented May 1, 2022

Maybe split this PR in two? First, do the API changes in struct st_ptls_aead_context_t, including the changes in the bcrypt library, and then, add the support for fastls?

Right. I opened the PRs in the wrong order, but #385 is supposed to do that.

@kazuho kazuho marked this pull request as ready for review May 11, 2022 05:04
kazuho added a commit to h2o/quicly that referenced this pull request May 11, 2022
@kazuho kazuho changed the base branch from kazuho/vectorized to master June 27, 2022 02:54
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.

2 participants