-
Notifications
You must be signed in to change notification settings - Fork 187
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
[WIP] cipher: migrate to hybrid array #1357
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replaces `generic-array` with `hybrid-array`, which is built on a combination of `typenum` and const generics, providing a degree of interoperability between the two systems. `hybrid-array` is designed to be a largely drop-in replacement, and the number of changes required to switch are relatively minimal aside from some idiosyncracies.
tarcieri
commented
Oct 8, 2023
block: InOut<'inp, 'out, Block<Self>>, | ||
} | ||
|
||
impl<'inp, 'out, BS: ArrayLength<u8>> BlockSizeUser for BlockCtx<'inp, 'out, BS> { | ||
impl<'inp, 'out, BS: BlockSizes> BlockSizeUser for BlockCtx<'inp, 'out, BS> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused how this worked before, but it seems necessary now, despite the bounds of ArrayLength<T>
and ArraySize
being otherwise identical (Unsigned
):
error[E0277]: the trait bound `BS: Cmp<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>` is not satisfied
--> cipher/src/block.rs:601:51
|
601 | impl<'inp, 'out, BS: ArraySize> BlockSizeUser for BlockCtx<'inp, 'out, BS> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Cmp<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>` is not implemented for `BS`
|
= note: required for `BS` to implement `IsLess<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>`
= note: required for `BS` to implement `crypto_common::sealed::BlockSizes`
= note: required for `BS` to implement `BlockSizes`
note: required by a bound in `BlockCtx`
--> cipher/src/block.rs:597:33
|
597 | struct BlockCtx<'inp, 'out, BS: BlockSizes> {
| ^^^^^^^^^^ required by this bound in `BlockCtx`
help: consider further restricting this bound
|
601 | impl<'inp, 'out, BS: ArraySize + crypto_common::typenum::Cmp<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UInt<crypto_common::typenum::UTerm, crypto_common::typenum::B1>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>, crypto_common::typenum::B0>>> BlockSizeUser for BlockCtx<'inp, 'out, BS> {
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Seems we'll need to update both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuation of #1319