-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix invalid parent hash with empty root left subtree #430
Conversation
Thanks for finding this. Just to recap / restate the issue here: The problem arises when the whole left subtree of the ratchet tree is empty:
This can arise, for example, via the following sequence of events:
In this case, right now, the algorithms for creating and verifying parent hashes disagree. On the creation side, the In the above example tree, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor simplifications to the test case, but otherwise LGTM.
It seems like we could actually do this as a test case on TreeKEMPublicKey::update
, but we can do that in a follow-on.
Fixes a bug with parent hash generation when the left subtree of the root node is empty.
If left subtree of the root node becomes empty (for example, when first two members are removed by a third group member) the parent hash computed during
TreeKEMPublicKey::update
will be invalid. A subsequent welcome will also have an invalid tree, and the welcome is unprocessable.This occurred because
parent_hashes
assumed that the root node was always present in the filtered direct path, and therefore used the root node as the initial parent when doing a top-down generation of parent hashes.