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

signature: use &mut impl CryptoRngCore RNG arguments #1147

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Nov 2, 2022

rand_core v0.6.4 added an auto-impl'd CryptoRngCore marker trait for types which impl CryptoRng + RngCore which is slightly more convenient and less verbose.

This commit changes to using &mut impl CryptoRngCore as proposed in #1087. This hopefully strikes a balance between least surprise and minimal required syntax, namely &mut references are reusable and don't
require knowledge of the blanket impl of RngCore for &mut R: RngCore

`rand_core` v0.6.4 added an auto-impl'd `CryptoRngCore` marker trait for
types which impl `CryptoRng + RngCore` which is slightly more convenient
and less verbose.

This commit changes to using `&mut impl CryptoRngCore` as proposed
in #1087. This hopefully strikes a balance between least surprise and
minimal required syntax, namely &mut references are reusable and don't
require knowledge of the blanket impl of `RngCore` for `&mut R: RngCore`
@tarcieri
Copy link
Member Author

tarcieri commented Nov 2, 2022

I opened #1148 which spells out the rationale for this type signature a bit more and can hopefully serve as a place to discuss if we should switch to this across the other trait crates (or if not this, then discussing what it should be).

@tarcieri tarcieri merged commit 45f1bab into master Nov 2, 2022
@tarcieri tarcieri deleted the signature/cryptorngcore branch November 2, 2022 03:31
tarcieri added a commit that referenced this pull request Nov 4, 2022
In #1147, other usages of a CSRNG were changed to use
`&mut impl CryptoRngCore`. However, `RandomizedPrehashSigner` was not
updated accordingly.

This commit updates it as well.
tarcieri added a commit that referenced this pull request Nov 4, 2022
In #1147, other usages of a CSRNG were changed to use
`&mut impl CryptoRngCore`. However, `RandomizedPrehashSigner` was not
updated accordingly.

This commit updates it as well.
tarcieri added a commit that referenced this pull request Nov 4, 2022
In #1147, other usages of a CSRNG were changed to use
`&mut impl CryptoRngCore`. However, `RandomizedPrehashSigner` was not
updated accordingly.

This commit updates it as well.
tarcieri added a commit to RustCrypto/signatures that referenced this pull request Nov 4, 2022
As discussed in RustCrypto/traits#1148, this uses
`&mut impl CryptoRngCore` as the API for passing CSRNGs.

This removes the need for a generic parameter in the type signature
while also keeping syntax to a minimum.

The traits in `signature` v2.0.0-pre.2 switched to these APIs. See
RustCrypto/traits#1147.
tarcieri added a commit to RustCrypto/signatures that referenced this pull request Nov 4, 2022
As discussed in RustCrypto/traits#1148, this uses
`&mut impl CryptoRngCore` as the API for passing CSRNGs.

This removes the need for a generic parameter in the type signature
while also keeping syntax to a minimum.

The traits in `signature` v2.0.0-pre.2 switched to these APIs. See
RustCrypto/traits#1147.
@tarcieri tarcieri mentioned this pull request Jan 15, 2023
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