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

PBKDF2 derive bits should throw OperationError when length is zero #274

Closed
littledivy opened this issue Aug 25, 2021 · 1 comment · Fixed by #275
Closed

PBKDF2 derive bits should throw OperationError when length is zero #274

littledivy opened this issue Aug 25, 2021 · 1 comment · Fixed by #275

Comments

@littledivy
Copy link
Contributor

WPT has a test for it https://github.com/web-platform-tests/wpt/blob/561fc4c5463673e5291894705c7a6aeb88e78d99/WebCryptoAPI/derive_bits_keys/pbkdf2.js#L118

I'm confused if the underlying implementation (following RFC 2898 Section 5.2) should already be validating that. If not so, the spec should consider adding this step.

@twiss
Copy link
Member

twiss commented Aug 26, 2021

Technically speaking the underlying algorithm doesn't validate, but merely requires that dkLen is a positive integer. So yeah, I agree this should be checked in this step. Thanks for raising this! If you feel like making a PR, it'd be very welcome, otherwise I can do so :)
Also, we should probably add the same check in HKDF, as well.

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.

2 participants