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

runtime/src/common/crypto/mrae: Reinvestigate using RustCrypto's Deoxysii #4521

Open
Yawning opened this issue Feb 28, 2022 · 0 comments
Open
Labels
c:runtime Category: runtime s:blocked Status: blocked on other work

Comments

@Yawning
Copy link
Contributor

Yawning commented Feb 28, 2022

In theory, RustCrypto got support for Deoxys-II fairly recently, including the variant that we use (Deoxys-II-256-128).

Unfortunately, as far as I can tell, the performance of RustCrypto's implementation is total garbage despite using AES-NI, due to the lack of vectorization everywhere else. Encrypting a 2 KiB message (our benchmark includes 64 bytes of AAD, RustCrypto's does not) on a Ryzen 5600X, our implementation clocks in at ~2.34 cpb, while RustCrypto manages ~57.5 cpb (nb: boost enabled because all I cared about is a rough ballpark comparison).

As it stands, a ~25x performance degradation is not a good trade-off for "someone else will maintain it", especially in light of our implementation having received an external audit and extensive testing.

This issue is mostly to document why we continue to use our own implementation (the alternative is too slow), and to serve as a reminder to re-examine the alternative in the event that it receives improvements.

@Yawning Yawning added s:blocked Status: blocked on other work c:runtime Category: runtime labels Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:runtime Category: runtime s:blocked Status: blocked on other work
Projects
None yet
Development

No branches or pull requests

1 participant