Skip to content
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

Strengthen MuSig nonce gen by feeding addresses of args #152

Open
jonasnick opened this issue Nov 1, 2021 · 1 comment
Open

Strengthen MuSig nonce gen by feeding addresses of args #152

jonasnick opened this issue Nov 1, 2021 · 1 comment

Comments

@jonasnick
Copy link
Contributor

The musig nonce function looks as follows:

static void secp256k1_nonce_function_musig(secp256k1_scalar *k, const unsigned char *session_id, const unsigned char *key32, const unsigned char *msg32, const unsigned char *agg_pk, const unsigned char *extra_input32) {

There's a chance that if this nonce function is accidentally called twice with the same argument values, the argument pointers store different addresses. Thus, we could hash these locations like this:

secp256k1_sha256_write(&sha, (unsigned char *)&session_id, sizeof(session_id));

However, it should be possible to test the nonce function without this, to make sure that different values are sufficient to produce a different hash.

This idea was originally brought up by @elichai.

@apoelstra
Copy link
Contributor

I like it. The address will maybe only have five or ten bits of entropy ... but to prevent lattice attacks in practice you pretty-much only need one (assuming your nonce, aside from being reused, is pretty high-entropy :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants