-
Notifications
You must be signed in to change notification settings - Fork 32
make PrivateKey + Signature comparisons use constant time comparisons #44
make PrivateKey + Signature comparisons use constant time comparisons #44
Conversation
Fixes #43 Avoid susceptibility to timing/side channel attacks by ensuring that private key and signature comparisons use `subtle.ConstantTimeCompare` instead of `bytes.Equal`
Thanks @odeke-em . Seems like a good idea. But does it matter for signatures? And where do we even use privKey.Equals ? |
@ebuchman, yeah for signatures I infer that from the case that those are like authenticated messages, but I perhaps am wrong that it doesn't matter. In regards to where we use PrivKey.Equals, interestingly I don't seem to see usages in our repos. |
Hm, seems maybe we can eliminate both Equals ? I see no reason to ever be checking privkey equality like that, and same for signatures? Are we using that anywhere? |
status? |
@odeke-em note Also, is there some reason the signatures need to be checked in constant time? |
Thank you @ebuchman for the refurbish! Mother of God, why did I use |
oh cool - agl doesn't think verify should be in constant time either: golang/crypto@c412588#diff-8183aa2c95dc1385c8f58bf1917fcb0b |
Gotcha gotcha, thanks for the discussion and you called this about signatures not needing constant time comparisons. |
Fixes #43
Avoid susceptibility to timing/side channel attacks by ensuring
that private key and signature comparisons use
subtle.ConstantTimeCompare
instead of
bytes.Equal