-
Notifications
You must be signed in to change notification settings - Fork 61
salsa20: support insecure 16-byte keys #433
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
base: master
Are you sure you want to change the base?
Conversation
Of course it fails immediately in CI. I'll have a look. 😆 |
Fixed CI. |
This looks OK to me, but @micolous looks like there's a merge conflict? |
I don't think we need to make the backends generic over key size since only state initialization is different. |
6afb946
to
147b588
Compare
Resolved, looks like this was caused by (later) PRs #436 and #446.
I don't think there's any way around this with RustCrypto's traits, without providing a different version of If we're implementing
I had a poke around RustCrypto cipher implementations for those that take multiple key sizes. They seem to either take a type parameter (eg: Adding an extra By comparison, adding a type parameter only affects the If someone wants to add support for 10 byte keys in the future, then they would just provide another |
We have 3 options:
Personally, I prefer the last option. |
Fixes #432.
This adds a
KeySize
parameter toSalsaCore
(like RC4), and sets it toU32
by default, for compatibility with existing code.I had a look at implementing 10 byte keys, but couldn't find test vectors for it, so I've left it out.
I haven't added support for
XSalsa
with other key sizes; that would need a similar change.I tested this with
aarch64-apple-darwin
andx86_64-apple-darwin
(via Rosetta 2, which seems to support SSE2).ECRYPT test vectors were acquired via https://github.com/oxarbitrage/salsa20-ecrypt-vectors-converter, with a little
jq
to convert their JSON files intoblobby
's text format: