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

stream-cipher: add FromBlockCipherMut trait #334

Merged
merged 1 commit into from
Oct 14, 2020

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Oct 14, 2020

Support for initializing a stream cipher from a BlockCipherMut.

This is a corollary to FromBlockCipher, but for cases where &mut access is needed to the inner block cipher instance (e.g. cryptographic accelerator hardware peripherals).

Using chained blanket impls, it's possible to allow a blanket impl of NewStreamCipher for types which impl either FromBlockCipherMut or FromBlockCipher.

Support for initializing a stream cipher from a `BlockCipherMut`.

This is a corollary to `FromBlockCipher`, but for cases where `mut`
access is needed to the inner block cipher instance (e.g. cryptographic
accelerator hardware peripherals).

Using chained blanket impls, it's possible to allow a blanket impl of
`NewStreamCipher` for types which impl either `FromBlockCipherMut` or
`FromBlockCipher`.
@tarcieri
Copy link
Member Author

Want to try this out with Ctr32BE and Ctr32LE, adding Ctr32BEMut and Ctr32LEMut wrappers, which will finally enable wiring up AES-GCM with a hardware cryptographic accelerator that needs &mut access.

@newpavlov will make sure to get your review/approval before cutting a (non-pre)release with this change. We can always revert it.

@tarcieri tarcieri merged commit cdd3492 into master Oct 14, 2020
@tarcieri tarcieri deleted the stream-cipher/from-stream-cipher-mut branch October 14, 2020 17:39
dns2utf8 pushed a commit to dns2utf8/traits that referenced this pull request Jan 24, 2023
Expands the set of clippy lints applied to include ones intended to
eliminate panics.

Replaces `usize::try_from(n: u32).unwrap()` usages with `as u32` to
avoid panics, avoiding possible truncation by adding a `compile_error!`
if the `target_pointer_width` isn't 32 or 64-bit.
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.

None yet

1 participant