-
Notifications
You must be signed in to change notification settings - Fork 578
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
Restrictions in Keccak parametrization affect KMAC #3279
Comments
|
I am a bit confused now.
What is imlemented in Botan as Keccak is not Keccak[capacity](input string, output_length) according according to https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf#page=28 ? And it is meant to stay like this?
SHA-3 is for sure the wrong primitive to build on. KMAC is defined in terms of Keccak.
Why would I not want define it in terms of the hash function? That is the most natural approach in my understanding and avoids unnecessary code duplication. My approach would be to implement Keccak and then KMAC on top of it. But if a hash named Keccak already exists and it is not the standardized version of Keccak, then I think we need a second version of Keccak and need to agree on the naming. |
It seems like these may be the same? But if so this is largely an accident. What is implemented as If it happens that this |
OK, I think now I basically understand the source of the confusion. NIST themselfes seem to use the name "Keccak" to refer to two different things:
I didn't try to find out where both version deviate technically, but in any case they differ in scope as the So most likely both variants are useful. I will propose a PR with |
I am unconvinced that this is the best approach. While it may be the easiest implementation of these subsidiary algorithms, it exposes a Also I am unconvinced this is a simplification overall. The implementations of |
No problem, then the Keccak-FIPS algorithm needs not to be part of the public API.
I disagree. They can be much shorter. With the changes I propose SHA3 based on Keccak[c] – which is simply the order of derivation the specs give us – there is only the need to override the ctor of SHA3. The current code reproduces the whole set of member functions, while in the specs these algorithms differ only in a few parameters. With the present code-base I had a pretty hard time figuring out how to realize KMAC. This is due to
In my proposal I resolve all these problems. The complete pull request isn't ready, but I'll if want to take a look here: https://github.com/falko-strenzke/botan, branch @randombit From tomorrow I am on vacation for 3 weeks. Afterwards I'll be happy to pick up the discussion again. |
The BSI asked us to move the integration of KMAC forward because they need it for one of their projects. You, @falko-strenzke, already created a branch for this integration. Is there still work to be done with KMAC, or can we expect a pull request in the following weeks? Otherwise, we want to offer our support, or, if you currently do not have time, offer to continue/finish your work. |
Work on KMAC is mostly done from my side, but since I accidentally based the implementation on the dilithium branch, I still have some rebasing work to do. But I plan to finish it in the next weeks. |
Very nice! |
With the parallel introduction of the XOF interface (#3671), this whole integration process became a mess. Sorry for that! Nevertheless, I think, we're converging nicely now. Here's what I think needs to be done to integrate this:
|
This was quite a journey to get KMAC upstream. Though, I think the improvements in Keccak and the XOF interface were very much worth it. I'm happy with the final shape of this implementation. Thanks a lot @falko-strenzke for all the work you put in and also your patience. @randombit thanks for bearing with us discussing the nitty gritty Keccak architecture. :) |
While implementing KMAC256, I found that the current Keccak implementation has the following restriction regarding output lengths:
Is there a specific reason for this? This restriction means that Keccak[c](N, d) defined in the Keccak specification is not supported for general parameters. My suggestion would be to lift at least the restriction for the output lengths and allow arbitrary output lengths. Would this have any known implications?
The text was updated successfully, but these errors were encountered: