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

Fix a few minor issues #199

Merged
merged 2 commits into from
Mar 4, 2020
Merged

Fix a few minor issues #199

merged 2 commits into from
Mar 4, 2020

Conversation

real-or-random
Copy link

  • Recommend a byte length for aux random data
  • Clarify that with signature verification by default at the end of the signing algorithm, using public keys from untrusted sources is not an issue.
  • A few editorial nits

 * Recommend a byte length for aux random data
 * Clarify that with signature verification by default at the end of the signing algorithm, using public keys from untrusted sources is not an issue.  
 *  A few editorial nits
@sipa
Copy link
Owner

sipa commented Feb 25, 2020

ACK

@@ -169,7 +169,7 @@ The algorithm ''Sign(sk, m)'' is defined as:
* If ''Verify(bytes(P), m, sig)'' (see below) returns failure, abort<ref>Verifying the signature before leaving the signer prevents random or attacker provoked computation errors. This prevents publishing invalid signatures which may leak information about the secret key. It is recommended, but can be omitted if the computation cost is prohibitive.</ref>.
* Return the signature ''sig''.

The auxiliary random data should be set to fresh randomness generated at signing time, resulting in what is called a ''synthetic nonce''. If no randomness is available, a simple counter can be used as well, or even nothing at all. Using any non-repeating value increases protection against [https://moderncrypto.org/mail-archive/curves/2017/000925.html fault injection attacks]. Using unpredictable randomness additionally increases protection against other side-channel attacks, and is '''recommended whenever available'''. Note that while this means the resulting nonce is not deterministic, the randomness is only supplemental to security. The normal security properties (excluding side-channel attacks) do not depend on the quality of the signing-time RNG.
The auxiliary random data should be set to fresh randomness generated at signing time, resulting in what is called a ''synthetic nonce''. Using 32 bytes of randomness is optimal but if obtaining randomness is expensive, fewer random bytes can be used. If randomness is not available, a simple counter can be used as well (optimally at least 64 bits wide), or even an empty byte array of length 0. Using any non-repeating value increases protection against [https://moderncrypto.org/mail-archive/curves/2017/000925.html fault injection attacks]. Using unpredictable randomness additionally increases protection against other side-channel attacks, and is '''recommended whenever available'''. Note that while this means the resulting nonce is not deterministic, the randomness is only supplemental to security. The normal security properties (excluding side-channel attacks) do not depend on the quality of the signing-time RNG.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 64 bits wide?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make sure the counter does not really overflow. I think a reasonable attacker can make enough signing requests to overflow a 32bit counter. I'm sure 64 bit is overkill but it's easy to reason about. Open to other suggestions of course.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I think it makes more sense to say that this is supposed to be a non-overflowing counter and not mention a specific bit length, because it's up to the implementation (or alternatively add the rationale that we consider 64 bit wide enough to not overflow).

@real-or-random
Copy link
Author

I changed it to only 32 bytes aux data but I'm not really convinced because now we say a lot about padding byte arrays to 32 bytes. This seems like an artificial restriction now. I liked the other variant more, I think.

Copy link

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't sound too bad imo, and simplification of the test vectors is a clear advantage. ACK.

@real-or-random
Copy link
Author

Ok, then let's keep it. :) I forced-push to change "constant bytes" to "null bytes" as suggested elsewhere. (And didn't want to write "zero bytes" because I always read this as "0 bytes". :D)

@jonasnick
Copy link

@sipa is this ready to merge?

@sipa sipa merged commit 9abbfa5 into sipa:bip-taproot Mar 4, 2020
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

Successfully merging this pull request may close these issues.

3 participants