-
Notifications
You must be signed in to change notification settings - Fork 208
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
Avoid recomputing Ge normalized from Gej in Nonce process #168
base: master
Are you sure you want to change the base?
Conversation
src/modules/musig/session_impl.h
Outdated
@@ -450,7 +447,7 @@ int secp256k1_musig_nonce_process(const secp256k1_context* ctx, secp256k1_musig_ | |||
} | |||
secp256k1_gej_add_ge_var(&aggnonce_ptj[0], &aggnonce_ptj[0], &adaptorp, NULL); |
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.
Thanks for the PR! I think you need to take this line into account. The [0] aggnonce may have changed, so we need to convert the changed nonce back to ge. (I don't think the same is necessary for [1])
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.
Moved the adaptor logic to the internal function.
- When the adaptor is NULL, there is no need to convert between
gej
andge
. - When the adaptor is not NULL, we only convert the required aggnonce[0]
1b971c0
to
9ce21fa
Compare
In secp256k1_musig_nonce_process(), we already have aggnonce in normalized form. We don't need to recompute them again in secp256k1_musig_nonce_process_internal().
9ce21fa
to
a0aaee7
Compare
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.
Concept ACK
} | ||
if (!secp256k1_musig_nonce_process_internal(&session_i.fin_nonce_parity, fin_nonce, &session_i.noncecoef, aggnonce_ptj, agg_pk32, msg32)) { | ||
|
||
if (!secp256k1_musig_nonce_process_internal(ctx, &session_i.fin_nonce_parity, fin_nonce, &session_i.noncecoef, aggnonce_ptj, aggnonce_pt, agg_pk32, msg32, adaptor)) { |
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.
Wouldn't it be clearer to pass only the ge
s to secp256k1_musig_nonce_process_internal
and compute the gej
s only there?
In secp256k1_musig_nonce_process(), we already have aggnonce in
normalized form. We don't need to recompute them again in
secp256k1_musig_nonce_process_internal().
Moved the adaptor logic to the internal function.