-
Notifications
You must be signed in to change notification settings - Fork 228
crypto-mac v0.9 #217
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
crypto-mac v0.9 #217
Conversation
What's the concrete error? Do you have a full example? |
|
I've tried the following code: impl<T, C> NewMac for T
where
T: From<C>,
C: BlockCipher + NewBlockCipher,
{
type KeySize = C::KeySize;
fn new(key: &Key<Self>) -> Self {
C::new(key).into()
}
fn new_varkey(key: &[u8]) -> Result<Self, InvalidKeyLength> {
C::new_varkey(key).map_err(|_| InvalidKeyLength)?.into()
}
}And I get this compilation error: Which in hindsight should've been expected. Right now I have no idea how to properly structure code and if it's even possible in principle. |
|
@newpavlov aah yeah, that looks similar to what I was running into with |
|
So what do you think? Should we go ahead with the current code for the time being? |
tarcieri
left a comment
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.
Seems fine to me
Release notes: RustCrypto#724
FromBlockCiphertrait and respectiveNewMacblanket implementationblobbyto v0.3impl_write!macro, since it's useless for generic typesI couldn't make code generic over
From<BlockCipher>trait due to the "unconstrained type parameter" error, so I had to introduce a new non-polymorphic trait instead. Any ideas how this problem can be worked around?