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

blake2: MAC variants should not be constructable with an empty key? #509

Closed
edward-shen opened this issue Oct 9, 2023 · 0 comments · Fixed by #510
Closed

blake2: MAC variants should not be constructable with an empty key? #509

edward-shen opened this issue Oct 9, 2023 · 0 comments · Fixed by #510

Comments

@edward-shen
Copy link
Contributor

edward-shen commented Oct 9, 2023

blake 0.10 permits construction of MAC variants with empty keys, but I don't think this is a valid construction of blake2. Using RFC7693 as reference:

Section 2.5 states the following:

The second (little-endian) byte of the parameter block, "kk", specifies the key size in bytes. Set kk = 00 for unkeyed hashing.

I've to understand this as keyed Blake2 is mutually exclusive with an empty key. Yet Blake2*Mac variants seem to permit this construction with new_with_params. This method will accept an empty key, perform operations to initialize blake2 in keyed mode (e.g. the operations in Section 3.3 that assume kk > 0), but then pass a key length of 0 to new_with_params, which then initializes the parameter block with kk = 0x00.

This results in a keyed construction of blake2 buffers with unkeyed initialization which seems incorrect?

If I'm correct, then I think we either need to special-case the empty key when provided to the MAC variants or have empty keys return an error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant