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

rfc6979: add generate_k_mut; remove digest bounds #773

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

tarcieri
Copy link
Member

Adds an API which writes k into an output buffer rather than allocating and returning it, which also accepts slices as inputs. This makes it possible to use rfc6979 to implement the dsa crate.

Also removes output size bounds on the underlying digest function, which aren't actually relevant to the implementation at all since HMAC-DRBG writes a variable-sized amount of output. This makes it possible to use rfc6979 + ecdsa in conjunction with p521, which has unusually sized scalars (66-bytes) which don't match the output size of the underlying digest function (SHA-512, which has a 64-byte output).

Adds an API which writes `k` into an output buffer rather than
allocating and returning it, which also accepts slices as inputs. This
makes it possible to use `rfc6979` to implement the `dsa` crate.

Also removes output size bounds on the underlying digest function, which
aren't actually relevant to the implementation at all since HMAC-DRBG
writes a variable-sized amount of output. This makes it possible to use
`rfc6979` + `ecdsa` in conjunction with `p521`, which has unusually
sized scalars (66-bytes) which don't match the output size of the
underlying digest function (SHA-512, which has a 64-byte output).
@tarcieri tarcieri force-pushed the rfc6979/remove-digest-output-size-bounds branch from 0948c21 to 509b92b Compare January 16, 2024 16:53
@tarcieri tarcieri merged commit 2472e1c into master Jan 16, 2024
37 checks passed
@tarcieri tarcieri deleted the rfc6979/remove-digest-output-size-bounds branch January 16, 2024 16:57
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jan 16, 2024
Now that RustCrypto/signatures#773 and RustCrypto/signatures#774 have
landed it should be possible to use the upstream RFC6979 implementation
from the `ecdsa` crate in conjunction with `p521`, which uses a Digest
with a 64-byte output, but uses 66-byte field elements.

However, we're currently failing to match RFC6979 test vectors.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jan 16, 2024
Now that RustCrypto/signatures#773 and RustCrypto/signatures#774 have
landed it should be possible to use the upstream RFC6979 implementation
from the `ecdsa` crate in conjunction with `p521`, which uses a Digest
with a 64-byte output, but uses 66-byte field elements.

However, we're currently failing to match RFC6979 test vectors.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jan 17, 2024
Now that RustCrypto/signatures#773 and RustCrypto/signatures#774 have
landed it should be possible to use the upstream RFC6979 implementation
from the `ecdsa` crate in conjunction with `p521`, which uses a Digest
with a 64-byte output, but uses 66-byte field elements.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jan 17, 2024
Now that RustCrypto/signatures#773 and RustCrypto/signatures#774 have
landed it should be possible to use the upstream RFC6979 implementation
from the `ecdsa` crate in conjunction with `p521`, which uses a Digest
with a 64-byte output, but uses 66-byte field elements.
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.

1 participant