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

x/crypto/sha3: add KMAC #24988

Closed
conradoplg opened this issue Apr 21, 2018 · 16 comments
Closed

x/crypto/sha3: add KMAC #24988

conradoplg opened this issue Apr 21, 2018 · 16 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Proposal-Accepted Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@conradoplg
Copy link
Contributor

The KMAC message authentication code specified in NIST SP 800-185 may be a useful MAC implementation.

In particular, it can be used as a KDF as specified by NIST SP 800-56C.

I'm submitting a CL implementing it, in case there is interest. I can also add support for TupleHash and ParallelHash.

@gopherbot gopherbot added this to the Unreleased milestone Apr 21, 2018
@gopherbot
Copy link

Change https://golang.org/cl/108715 mentions this issue: x/crypto/sha3: add NewKMAC128 and NewKMAC256

@agnivade
Copy link
Contributor

This adds new API. Any new public API needs to go through a proposal and accepted first. Perhaps you can create a proposal citing proper reasons why this should be inside x/crypto/sha3 and not in an external package ?

/cc @FiloSottile / @agl

@conradoplg
Copy link
Contributor Author

This adds new API. Any new public API needs to go through a proposal and accepted first. Perhaps you can create a proposal citing proper reasons why this should be inside x/crypto/sha3 and not in an external package ?

Sure. What's the proper procedure for that? Should I just add "proposal:" to the title of the issue?

Basically, the main reason is that KMAC is based on the underlying Keccak sponge implementation. If I were to create an external package, I'd have to duplicate the entire Keccak implementation from x/crypto/sha3.

@agnivade
Copy link
Contributor

Perhaps, it's better to create a new issue altogether to preserve context, since this one is already polluted a bit. You can update the CL with the new "Fixes #xxxx" text once it gets accepted.

@FiloSottile FiloSottile changed the title x/crypto/sha3: add KMAC proposal: x/crypto/sha3: add KMAC Apr 23, 2018
@FiloSottile FiloSottile added Proposal-Crypto Proposal related to crypto packages or other security issues and removed Proposal labels Apr 23, 2018
@FiloSottile
Copy link
Contributor

FiloSottile commented May 3, 2018

Relatedly, https://golang.org/cl/111281 implements cSHAKE.

@FiloSottile
Copy link
Contributor

I'm inclined to accept both cSHAKE and KMAC, unless @agl has objections. SHA-3 has defined way too many functions, but making people reimplement them or roll their own MAC doesn't sound like the right answer.

@agl
Copy link
Contributor

agl commented May 3, 2018

I thought it was a requirement of SHA-3 candidates that they not permit length-extension, so I'm unsure what the point of KMAC is. But it looks to be tiny wrapper around cSHAKE, so whatever, throw it in!

@conradoplg
Copy link
Contributor Author

That's a good question, apparently KMAC was proposed in a SHA-3 workshop but I did not found a rationale for it. I could only deduce that it's for providing domain separation and to avoid some weird pitfalls when using SHAKE directly such as a 16-byte MAC being the prefix of a 32-byte MAC over the same message/key, or a MAC collision of MAC(K,M) and MAC(K[0:-1], K[-1]||M).

When https://golang.org/cl/111281 is accepted I'll change this CL to use its implementation of cSHAKE.

@FiloSottile
Copy link
Contributor

Ok on adding KMAC and cSHAKE. Docs should point to hmac.Equal.

@Scratch-net
Copy link

Please consider adding TupleHash too. It's the only way to hash multiple slices without collisions

@conradoplg
Copy link
Contributor Author

I updated my CL with the new cSHAKE some time ago, but forgot to comment here...

I can add TupleHash if desired.

@Scratch-net
Copy link

That would be awesome

@FiloSottile FiloSottile added NeedsFix The path to resolution is known, but the work has not been done. and removed Proposal labels Mar 26, 2020
@conradoplg
Copy link
Contributor Author

conradoplg commented Mar 20, 2021

Not sure if there is still interest in this, but I finally added TupleHash (and TupleHashXOF) to the CL 😅

I guess I should just add ParallelHash too; I'll add it soon.

@rsc rsc changed the title proposal: x/crypto/sha3: add KMAC x/crypto/sha3: add KMAC Aug 5, 2022
@FiloSottile
Copy link
Contributor

A few years have passed, and cSHAKE landed. Did KMAC end up used in any protocol we know of? There doesn't seem to be a lot of demand for it here, judging from comments and reactions.

@conradoplg
Copy link
Contributor Author

A few years have passed, and cSHAKE landed. Did KMAC end up used in any protocol we know of? There doesn't seem to be a lot of demand for it here, judging from comments and reactions.

Yeah I don't see any point in including KMAC if cSHAKE is available. One Day™️ I'll put my code in a separate project. I'll just go ahead and close this if it's OK.

@conradoplg conradoplg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2022
@rautammi
Copy link

rautammi commented Apr 4, 2023

I beg your pardon for being late with my comment: https://doi.org/10.6028/NIST.SP.800-108r1 specifies KMAC as a KDF but not SHAKE. Shall I open a new issue about really adding KMAC support this time?

@golang golang locked and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Proposal-Accepted Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
None yet
Development

No branches or pull requests

7 participants