-
Notifications
You must be signed in to change notification settings - Fork 41
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
Stm reduce transmute #675
Stm reduce transmute #675
Conversation
1524a6c
to
3c00e04
Compare
let ser_sk = sk.0.serialize().as_ptr(); | ||
let mut sk_scalar = blst_scalar::default(); | ||
blst_scalar_from_bendian(&mut sk_scalar, ser_sk); | ||
let mut out = blst_p1::default(); | ||
blst_sk_to_pk_in_g1(&mut out, sk_scalar); | ||
blst_sk_to_pk_in_g1(&mut out, &sk_scalar); |
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.
In general I would avoid doing serialisation/deserialisation, and use it as a last resort. So if for the other usages of transmute we can use different strategies, it'll be best.
If we were to continue with this technique (of serialisation and deserialisation), I would be careful with secret material. i.e. I would overwrite ser_sk
and sk_scalar
with zeroes and blst_scalar::default
respectively.
As mentioned by @curiecrypt, the regression is considerable, and we won't proceed on that path. Doing serialisation/deserialisation, while being safer, has an important hit on performance. In order to minimise the risks of transmute, we will create helper function (to facilitate auditing), and fix to a particular version of |
Content
This PR aims to reduce or completely remove the use of
transmute
inmulti_sig.rs
.Pre-submit checklist
Comments
The following are the benchmark results giving the regression between the versions with
transmute
andserde
. The performance has regressed drastically. So, we should consider another way to prevent the possible problems of usingtransmute
which is also efficient. As we discussed, a helper structure for unsafe codes could be better @iquerejeta.Issue(s)
Closes #532