Skip to content

Commit be7f413

Browse files
committed
Fix K1/K2 use in the comments in ChaCha20-Poly1305 AEAD
This is done for the ChaCha20-Poly1305 AEAD test vector and for the K1/K2 ChaCha20 cipher instances in chacha_poly_aead.h
1 parent 0ccf9b2 commit be7f413

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/crypto/chacha_poly_aead.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static constexpr int AAD_PACKAGES_PER_ROUND = 21; /* 64 / 3 round down*/
117117
class ChaCha20Poly1305AEAD
118118
{
119119
private:
120-
ChaCha20 m_chacha_main; // payload and poly1305 key-derivation cipher instance
121-
ChaCha20 m_chacha_header; // AAD cipher instance (encrypted length)
120+
ChaCha20 m_chacha_header; // AAD cipher instance (encrypted length) and poly1305 key-derivation cipher instance
121+
ChaCha20 m_chacha_main; // payload
122122
unsigned char m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]; // aad keystream cache
123123
uint64_t m_cached_aad_seqnr; // aad keystream cache hint
124124

src/test/crypto_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,8 @@ BOOST_AUTO_TEST_CASE(chacha20_poly1305_aead_testvector)
694694

695695
TestChaCha20Poly1305AEAD(true, 0,
696696
/* m */ "0000000000000000000000000000000000000000000000000000000000000000",
697-
/* k1 (payload) */ "0000000000000000000000000000000000000000000000000000000000000000",
698-
/* k2 (AAD) */ "0000000000000000000000000000000000000000000000000000000000000000",
697+
/* k1 (AAD) */ "0000000000000000000000000000000000000000000000000000000000000000",
698+
/* k2 (payload) */ "0000000000000000000000000000000000000000000000000000000000000000",
699699
/* AAD keystream */ "76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee6586",
700700
/* encrypted message & MAC */ "76b8e09f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32d2fc11829c1b6c1df1f551cd6131ff08",
701701
/* encrypted message & MAC at sequence 999 */ "b0a03d5bd2855d60699e7d3a3133fa47be740fe4e4c1f967555e2d9271f31c3aaa7aa16ec62c5e24f040c08bb20c3598");

0 commit comments

Comments
 (0)