x/crypto/argon2: fix panic when calling IDKey or Key with keyLen == 0#95
x/crypto/argon2: fix panic when calling IDKey or Key with keyLen == 0#95psampaz wants to merge 2 commits into
Conversation
|
This PR (HEAD: 7e2d075) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/crypto/+/189878 to see it. Tip: You can toggle comments from me using the |
| func deriveKey(mode int, password, salt, secret, data []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { | ||
| if keyLen == 0 { | ||
| return []byte{} | ||
| } |
There was a problem hiding this comment.
I think it's slightly more technically correct to put this after the time/threads checks directly below
|
This PR (HEAD: 205e825) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/crypto/+/189878 to see it. Tip: You can toggle comments from me using the |
205e825 to
096cba9
Compare
|
This PR (HEAD: 096cba9) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/crypto/+/189878 to see it. Tip: You can toggle comments from me using the |
|
Message from Zach Jones: Patch Set 4: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/189878. |
|
Message from Akhil Indurti: Patch Set 8: Relaying my comments from the issue here: Doesn't argon2 expect a minimum keyLen of 4 as per https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-3.1? In that case, how about intentionally panicking on a keyLen < 4? Something like, The panic is currently happening because blake2b expects a hash size of at least 1, so maybe we should error out instead. Please don’t reply on this GitHub thread. Visit golang.org/cl/189878. |
|
Message from Zach Jones: Patch Set 4: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/189878. |
|
Message from Akhil Indurti: Patch Set 8: Relaying my comments from the issue here: Doesn't argon2 expect a minimum keyLen of 4 as per https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-3.1? In that case, how about intentionally panicking on a keyLen < 4? Something like, The panic is currently happening because blake2b expects a hash size of at least 1, so maybe we should error out instead. Please don’t reply on this GitHub thread. Visit golang.org/cl/189878. |
Calling IDKey or Key functions using 0 as KeyLen panics. This change fixes this error by returning an empty byte slice.
Fixes golang/go#33583