-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/cipher: NewGCMWithNonceSize allows zero-length nonce #37118
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
Comments
@FiloSottile suggested that we backport this fix as well. |
Change https://golang.org/cl/218500 mentions this issue: |
@gopherbot please open backport, at suggestion of @FiloSottile. |
Backport issue(s) opened: #37416 (for 1.14), #37417 (for 1.13), #37418 (for 1.12). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
@dmitshur, also needs 1.14 backport... |
I'll repurpose the 1.12 one. It won't be getting this backport because 1.14 will be out by then, so it'll be too old. |
Backport issue for 1.12 is now #37418 |
Change https://golang.org/cl/220651 mentions this issue: |
…r AES-GCM Also fix typo in crypto/cipher/gcm_test.go. Updates #37118 Fixes #37416 Change-Id: I8544d1eeeb1f0336cebb977b8c5bfa5e4c5ad8c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/218500 Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 4e8badb) Reviewed-on: https://go-review.googlesource.com/c/go/+/220651 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
Change https://golang.org/cl/220653 mentions this issue: |
/cc @dunhamsteve FYI. |
…r AES-GCM Also fix typo in crypto/cipher/gcm_test.go. Updates #37118 Fixes #37417 Change-Id: I8544d1eeeb1f0336cebb977b8c5bfa5e4c5ad8c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/218500 Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 4e8badb) Reviewed-on: https://go-review.googlesource.com/c/go/+/220653 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
cipher.NewGCMWithNonceSize
allows for any nonce size, including one that is zero length. This is not allowed by NIST SP 800-38D and encrypting with such an IV leaks the authentication key.NIST SP 800-38D:
Allowing a zero-length nonce opens the package up to misuse, and there is never a valid reason to do this. It could be argued that
cipher.NewGCMWithNonceSize
isn't meant to be as safe, and the recommended approach is to usecipher.NewGCM
, however this is a hardening measure that has no negative side effects, in my opinion.cipher.NewGCMWithNonceSize docs:
/cc @FiloSottile
The text was updated successfully, but these errors were encountered: