@@ -62,7 +62,7 @@ bool ChaCha20Poly1305AEAD::Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad, int
6262 // block counter 0 for the poly1305 key
6363 // use lower 32bytes for the poly1305 key
6464 // (throws away 32 unused bytes (upper 32) from this ChaCha20 round)
65- m_chacha_main.Seek (0 );
65+ m_chacha_main.Seek64 (0 );
6666 m_chacha_main.Crypt (poly_key, poly_key, sizeof (poly_key));
6767
6868 // if decrypting, verify the tag prior to decryption
@@ -85,7 +85,7 @@ bool ChaCha20Poly1305AEAD::Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad, int
8585 if (m_cached_aad_seqnr != seqnr_aad) {
8686 m_cached_aad_seqnr = seqnr_aad;
8787 m_chacha_header.SetIV (seqnr_aad);
88- m_chacha_header.Seek (0 );
88+ m_chacha_header.Seek64 (0 );
8989 m_chacha_header.Keystream (m_aad_keystream_buffer, CHACHA20_ROUND_OUTPUT);
9090 }
9191 // crypt the AAD (3 bytes message length) with given position in AAD cipher instance keystream
@@ -94,7 +94,7 @@ bool ChaCha20Poly1305AEAD::Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad, int
9494 dest[2 ] = src[2 ] ^ m_aad_keystream_buffer[aad_pos + 2 ];
9595
9696 // Set the playload ChaCha instance block counter to 1 and crypt the payload
97- m_chacha_main.Seek (1 );
97+ m_chacha_main.Seek64 (1 );
9898 m_chacha_main.Crypt (src + CHACHA20_POLY1305_AEAD_AAD_LEN, dest + CHACHA20_POLY1305_AEAD_AAD_LEN, src_len - CHACHA20_POLY1305_AEAD_AAD_LEN);
9999
100100 // If encrypting, calculate and append tag
@@ -117,7 +117,7 @@ bool ChaCha20Poly1305AEAD::GetLength(uint32_t* len24_out, uint64_t seqnr_aad, in
117117 // we need to calculate the 64 keystream bytes since we reached a new aad sequence number
118118 m_cached_aad_seqnr = seqnr_aad;
119119 m_chacha_header.SetIV (seqnr_aad); // use LE for the nonce
120- m_chacha_header.Seek (0 ); // block counter 0
120+ m_chacha_header.Seek64 (0 ); // block counter 0
121121 m_chacha_header.Keystream (m_aad_keystream_buffer, CHACHA20_ROUND_OUTPUT); // write keystream to the cache
122122 }
123123
0 commit comments