Skip to content

rfc6979: add generate_k_mut; remove digest bounds#773

Merged
tarcieri merged 1 commit intomasterfrom
rfc6979/remove-digest-output-size-bounds
Jan 16, 2024
Merged

rfc6979: add generate_k_mut; remove digest bounds#773
tarcieri merged 1 commit intomasterfrom
rfc6979/remove-digest-output-size-bounds

Conversation

@tarcieri
Copy link
Copy Markdown
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
@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.
@tarcieri tarcieri mentioned this pull request May 6, 2026
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