-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-524: More ChaCha20-Poly1305 optimizations
In the ChaChaEngine, exploit peculiarities of its use in SSH: the counter is actually 32bit and never overflows, and the nonce is the SSH packet sequence number, also 32 bits, and wraps on overflow. As a result two of the ints of the engine state are always zero, and the handling of nonce and counter can be slightly simplified. In Poly1305Mac, inline the long multiplications. Avoid extensions from int to long for the precomputed values (r, s, k); store them as longs up front. For h, reduce the number of extensions from 25 to 5 by doing it once before the multiplications. As a side effect this part of the code also is nicer to read.
- Loading branch information
Showing
3 changed files
with
71 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters