-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
wolfcrypt.ciphers.ChaCha20Poly1305 has many of the same methods as wolfcrypt.ciphers.AesGcmStream, suggesting that it also supports streaming usage, but it actually doesn't.
Specifically, both these classes provide the following methods: set_aad, encrypt / decrypt, final. This suggests the following workflow:
# for encryption
set_aad(aad) -> encrypt(data1) -> encrypt(data2) -> ... -> final()
# for decryption
set_aad(aad) -> decrypt(data1) -> decrypt(data2) -> ... -> final(tag)
AesGcmStream does actually work like this, but ChaCha20Poly1305 does not.
Problems of ChaCha20Poly1305 include:
__init__requires theaadargument, makingset_aadredundantencryptreturns both ciphertext and tag, and callingencryptagain raisesUnboundLocalErrordecrypttakes both ciphertext and tag, makingfinalredundant- there is no workflow where
finalcan be called at all
Recommendations:
First, decide whether ChaCha20Poly1305 should support streaming or not.
- If
ChaCha20Poly1305should support streaming:- Make its interface exactly the same as
AesGcmStream
- Make its interface exactly the same as
- If
ChaCha20Poly1305should not support streaming:- Make its interface exactly the same as
AesSiv
- Make its interface exactly the same as
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels