-
Notifications
You must be signed in to change notification settings - Fork 20
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
Remove unsafe cell from SecretKey #87
Conversation
let mut ss = SecretScalar(UnsafeCell::new([xof(), xof()]) ); | ||
ss.resplit_mut(); | ||
let mut ss = SecretScalar([xof(), xof()]); | ||
ss.resplit(); |
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.
maybe this resplit here is redundant as the secret has just been constructed
A - maybe better - alternative is to define The This second approach could be better as it performs one single split instead of two (i.e. one on construction externally and one before the op internally - as we can't assume that the user externally performed the re-split, e.g. for long living |
Yeah, this should the best compromize. I never did this before because we still interact with the same key material many times this way, but.. The big timing vulnerability is the conditional adds in the scalar multiplication, which yes this avoids just fine. Also, we incure no costs by making the field constant time, unlike the elliptic curve operations. It'd be nice if arkworks provided constant-time arithmetic somehow of course, but whatever.. Also.. I'm unsure how much this matters for sassafras. It matters for identity of course, but I implemented this hack mostly nugget_bls in bridges, but everyone picked syed's development off my old crappy bls crate, which is probably just vunlerable, like every other bls12-381. lol As an aside, dfinity should be more vulnerable than other blockchains: few validators on identical hardware in few data centers. Also, if you break the threshold number of keys in one reshare period, then you break their chain key forever. |
Superseeded by #88 |
I kinda prefer #87 over #88 really, primarily because #87 admits more implementations. #88 exposes the scalar directly via The big difference is: #88 creates one scalar directly, not two seperate ones. If arkworks ever gets constant time arithemtic then this simplifies the spec, but SW curves are generally known for not being constant time, so if this improves the spec is debatable. We've started running schnorrkel & others in the runtime, which while dubious looks harmess. Is there a need for that here too? |
@burdges The public scalar thing is easily fixable: 68b4510. Now is private. Don't know why I made it pub in the first place 😃 Yeah #88 maintains one scalar but it splits it just before each operation. IMO splitting it during construction (as in #87) doesn't offer any additional value as:
#88 is even more secure as if you are using If the important thing is to use the splitted scalar to perform the operation, then both of them are providing this property (with the difference that #88 has less footprint and is harder to misuse) |
If you refer to paritytech/polkadot-sdk#2044 then this only allows to create the secret in the runtime. Signing is still not exposed by default (requires the |
Instead of applying the resplit after the operation. Resplit before (by cloning where necessary).
This also allows the secret key to be
Sync