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

EdDSA signing is incorrect if the message is leading with 0x00 #264

Open
i-xiaov opened this issue Sep 6, 2023 · 1 comment
Open

EdDSA signing is incorrect if the message is leading with 0x00 #264

i-xiaov opened this issue Sep 6, 2023 · 1 comment
Assignees

Comments

@i-xiaov
Copy link

i-xiaov commented Sep 6, 2023

The message is stored in LocalParty as a bit.Int and then passed into EdDSA signing process.
In round_3, it was used as bytes:

h := sha512.New()
h.Reset()
h.Write(encodedR[:])
h.Write(encodedPubKey[:])
h.Write(round.temp.m.Bytes())

The problem is that the returned byte slice from big.Int.Bytes() represents the minimal-length binary form of the integer and does not include any leading zero bytes. So, if the message is leading with 0x00 the result SignatureData will be incorrect.

Using big.Int.FillBytes() or storing message as raw byte slice should be better?

@yycen yycen self-assigned this Sep 20, 2023
@zargarzadehm
Copy link
Contributor

zargarzadehm commented Jan 3, 2024

I have the same issue in eddsa signing:

signData, _ := new(big.Int).SetString("00f163ee51bcaeff9cdff5e0e3c1a646abd19885fffbab0b3b4236e0cf95c9f5", 16)
localTssData.Params = tss.NewParameters(tss.Edwards(), ctx, localPartyId, len(localTssData.PartyIds), threshold)
localTssData.Party = eddsaSigning.NewLocalParty(signData, localTssData.Params, h.savedData, outCh, endCh)

and response for endChannel is something like this:

SignatureData.M -> "f163ee51bcaeff9cdff5e0e3c1a646abd19885fffbab0b3b4236e0cf95c9f5"

so, the signature is not valid because of this problem!

I created a PR for this #284

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

3 participants