Skip to content

ecdsa: add RFC6979 test (plus dev::curve module)#136

Merged
tarcieri merged 1 commit into
masterfrom
rfc6979-test
Sep 2, 2020
Merged

ecdsa: add RFC6979 test (plus dev::curve module)#136
tarcieri merged 1 commit into
masterfrom
rfc6979-test

Conversation

@tarcieri

@tarcieri tarcieri commented Sep 2, 2020

Copy link
Copy Markdown
Member

Adds a test that the RFC6979 implementation produces the correct ephemeral scalar (k) for the test vector in RFC 6979 Appendix 2.5:

https://tools.ietf.org/html/rfc6979#appendix-A.2.5

This unfortunately requires basic scalar support, as RFC6979 uses rejection sampling to select a k value, so this commit also contains the rudiments of a P-256 scalar implementation necessary to implement the test.

Hopefully this will be useful for testing other aspects of ECDSA, or potentially ensuring that the scalars of an ECDSA signature are in-range generically, even if no curve arithmetic backend is available.

Adds a test that the RFC6979 implementation produces the correct
ephemeral scalar (`k`) for the test vector in RFC 6979 Appendix 2.5:

https://tools.ietf.org/html/rfc6979#appendix-A.2.5

This unfortunately requires basic scalar support, as RFC6979 uses
rejection sampling to select a `k` value, so this commit also contains
the rudiments of a P-256 scalar implementation necessary to implement
the test.

Hopefully this will be useful for testing other aspects of ECDSA, or
potentially ensuring that the scalars of an ECDSA signature are in-range
generically, even if no curve arithmetic backend is available.
@codecov-commenter

codecov-commenter commented Sep 2, 2020

Copy link
Copy Markdown

Codecov Report

Merging #136 into master will decrease coverage by 6.54%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
- Coverage   36.57%   30.03%   -6.55%     
==========================================
  Files           7        8       +1     
  Lines         257      313      +56     
==========================================
  Hits           94       94              
- Misses        163      219      +56     
Impacted Files Coverage Δ
ecdsa/src/dev/curve.rs 0.00% <0.00%> (ø)
ecdsa/src/signer/rfc6979.rs 0.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de67a52...f684924. Read the comment docs.

@tarcieri tarcieri merged commit 7974228 into master Sep 2, 2020
@tarcieri tarcieri deleted the rfc6979-test branch September 2, 2020 02:27
@tarcieri tarcieri mentioned this pull request Sep 11, 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.

2 participants