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

Key derivations failures could lead to all zero byte keys #93

Open
kelbyludwig opened this issue Jan 18, 2018 · 0 comments
Open

Key derivations failures could lead to all zero byte keys #93

kelbyludwig opened this issue Jan 18, 2018 · 0 comments

Comments

@kelbyludwig
Copy link

kelbyludwig commented Jan 18, 2018

crypto_pwhash can return non-zero error codes in the event of an failure.

The function returns 0 on success, and -1 if the computation didn't complete, usually because the operating system refused to allocate the amount of requested memory.

That case is not handled at all here. If this function fails to derive the key, this will return an all zero key silently instead of signaling an error to the caller.

https://github.com/joshjdevl/libsodium-jni/blob/master/src/main/java/org/libsodium/jni/crypto/Hash.java#L51

This is unrelated, but I think crypto_pwhash_alg_default is (as of 1.0.9) Argon2. So isn't this function misnamed?

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

No branches or pull requests

1 participant