axelarnetwork / tofn

A threshold cryptography library in Rust
Apache License 2.0
112 stars 23 forks source link

feat: address delta-inverse vulnerability #154

Closed ggutoski closed 3 years ago

ggutoski commented 3 years ago

fix #110

Notes

ggutoski commented 3 years ago

Address reviewer comments

The nontrivial reviewer comments are:

Resort to post hoc malicious code

Recall that we've settled on a strategy for malicious tests whereby we embed malicious code directly into the protocol. Unfortunately we cannot follow this strategy for the delta-inverse tests because those tests require a rushing adversary and it is difficult to implement such an adversary within that strategy. Thus, for the delta-inverse test I resorted to the method of tweaking messages post hoc (after the round is complete). That method is acceptable for this particular task because the delta-inverse tests are amenable to it. But we might need to revisit our test architecture in the future if we ever encounter a situation with a rushing adversary that is not so amenable to the post hoc method.

ggutoski commented 3 years ago

Forgot to mention: I made the gamma_i and Gamma_i checks mandatory in type5_checks(), even when type-5 sad path is entered via delta-inverse path: https://github.com/axelarnetwork/tofn/blob/7be0e76c081b8ca263ae51d23a29dbcb2a774a42/src/gg20/sign/type5_common.rs#L106-L108 I did this because delta depends on gamma_i and so we always need to check gamma_i, too. If type-5 is entered via delta-inverse then we don't have gamma_i yet (nor Gamma_i). Thus, I made it so that the bcasts_in arg to type5_checks is now a pair (r4::BcastHappy, BcastSadType5). If this code path is entered from round 4 then round 4 needs to compute both happy and sad path bcasts for the bcasts_in arg.