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

Content encryption: Clarify generation sequence #679

Closed
raphaelrobert opened this issue May 17, 2022 · 2 comments · Fixed by #699
Closed

Content encryption: Clarify generation sequence #679

raphaelrobert opened this issue May 17, 2022 · 2 comments · Fixed by #699
Assignees

Comments

@raphaelrobert
Copy link
Member

The generation numbers should be increased sequentially, gaps should be avoided to avoid unnecessary expensive operations on clients. Clients might also abort if the gap is too large to prevent attacks from malicious insiders.

@Bren2010
Copy link
Collaborator

This is stated in 10.1:

The sender uses the j-th key/nonce pair in the sequence to encrypt (using the AEAD) the j-th message they send during that epoch.

@bifurcation
Copy link
Collaborator

bifurcation commented May 20, 2022

I suspect that what Raphael is worried about is that a malicious insider (someone in possession of the sender_data_secret) could make an MLSCiphertext with generation set to 0xffffffff that would cause the receiver to do 2^32-1 HKDF invocations. The attacker doesn't have to incur this cost because they don't need to generate the required key -- the ciphertext can be garbage because the key generation happens before the decryption does.

It seems like we could use a paragraph at the end of {{encryption-keys}} covering this and the fact that if you want to allow for out-of-order messages, you need to keep the intermediate keys. Since big gaps would force you to store the keys as well as doing the hashing.

Clients might not receive messages in the order they are sent. In order to allow for decryption of out-of-order messages, clients MAY retain keys and nonces for generations earlier than the latest received generation. clients MAY impose a limit on the size of gaps they will allow in the generation sequence, in order to avoid generating and/or storing large numbers of such keys and nonces.

A figure here might also be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants