Skip to content

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
scv35 added a commit to scv35/Signature-algorithms that referenced this pull request Jul 4, 2025
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.
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