[go] crypto/sha3: ensure unwrapped *sha3.Digest are usable

2 views
Skip to first unread message

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:41:44 PMFeb 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Neal Patel has uploaded the change for review

Commit message

crypto/sha3: ensure unwrapped *sha3.Digest are usable

Updates #75154
Change-Id: I57508b1360702d66a89d44b5bd2728decd075305

Change diff

diff --git a/src/crypto/hmac/hmac_test.go b/src/crypto/hmac/hmac_test.go
index 4046a95..d595205 100644
--- a/src/crypto/hmac/hmac_test.go
+++ b/src/crypto/hmac/hmac_test.go
@@ -7,9 +7,11 @@
import (
"crypto/internal/boring"
"crypto/internal/cryptotest"
+ "crypto/internal/fips140hash"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
+ "crypto/sha3"
"crypto/sha512"
"errors"
"fmt"
@@ -596,6 +598,34 @@
}
}

+func TestSHA3Hash(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ fn func() hash.Hash
+ }{
+ {
+ "sha3 zero init hash",
+ func() hash.Hash { return justHash{&sha3.SHA3{}} },
+ },
+ {
+ "sha3 zero init hash by linkname",
+ func() hash.Hash { return justHash{fips140hash.Unwrap(&sha3.SHA3{})} },
+ },
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ h := New(tc.fn, []byte("key"))
+ if _, ok := h.(hash.Cloner); !ok {
+ t.Skip("no Cloner support")
+ }
+ h.Write([]byte("test"))
+ _, err := h.(hash.Cloner).Clone()
+ if !errors.Is(err, errors.ErrUnsupported) {
+ t.Errorf("Clone() = %v, want ErrUnsupported", err)
+ }
+ })
+ }
+}
+
func TestNonUniqueHash(t *testing.T) {
if boring.Enabled {
t.Skip("hash.Hash provided by boringcrypto are not comparable")
diff --git a/src/crypto/sha3/sha3.go b/src/crypto/sha3/sha3.go
index 48c67e9..4711f18 100644
--- a/src/crypto/sha3/sha3.go
+++ b/src/crypto/sha3/sha3.go
@@ -104,6 +104,7 @@

//go:linkname fips140hash_sha3Unwrap crypto/internal/fips140hash.sha3Unwrap
func fips140hash_sha3Unwrap(sha3 *SHA3) *sha3.Digest {
+ sha3.init()
return &sha3.s
}

Change information

Files:
  • M src/crypto/hmac/hmac_test.go
  • M src/crypto/sha3/sha3.go
Change size: S
Delta: 2 files changed, 31 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 1
Gerrit-Owner: Neal Patel <neal...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:41:51 PMFeb 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Neal Patel voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 1
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:41:48 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:45:22 PMFeb 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Neal Patel

Neal Patel uploaded new patchset

Neal Patel uploaded patch set #2 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Neal Patel
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 2
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Attention: Neal Patel <neal...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:45:35 PMFeb 19
to goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com

Neal Patel voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 2
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:45:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:55:28 PMFeb 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Neal Patel

Neal Patel uploaded new patchset

Neal Patel uploaded patch set #3 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Neal Patel
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 3
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Filippo Valsorda <fil...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Neal Patel <neal...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:55:49 PMFeb 19
to goph...@pubsubhelper.golang.org, Go LUCI, Roland Shoemaker, Quim Muntal, Filippo Valsorda, golang-co...@googlegroups.com

Neal Patel voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 3
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Filippo Valsorda <fil...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:55:45 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:56:17 PMFeb 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Neal Patel and Roland Shoemaker

Neal Patel uploaded new patchset

Neal Patel uploaded patch set #4 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Neal Patel
  • Roland Shoemaker
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 4
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Filippo Valsorda <fil...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Roland Shoemaker <rol...@golang.org>
Gerrit-Attention: Neal Patel <neal...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Feb 19, 2026, 1:56:43 PMFeb 19
to goph...@pubsubhelper.golang.org, Go LUCI, Roland Shoemaker, Quim Muntal, Filippo Valsorda, golang-co...@googlegroups.com
Attention needed from Roland Shoemaker

Neal Patel voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Roland Shoemaker
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 4
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Filippo Valsorda <fil...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Roland Shoemaker <rol...@golang.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:56:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Apr 8, 2026, 7:56:01 PM (6 hours ago) Apr 8
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Filippo Valsorda and Roland Shoemaker

Neal Patel uploaded new patchset

Neal Patel uploaded patch set #5 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Filippo Valsorda
  • Roland Shoemaker
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 5
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Filippo Valsorda <fil...@golang.org>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Roland Shoemaker <rol...@golang.org>
Gerrit-Attention: Filippo Valsorda <fil...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Neal Patel (Gerrit)

unread,
Apr 8, 2026, 7:56:13 PM (6 hours ago) Apr 8
to goph...@pubsubhelper.golang.org, Filippo Valsorda, Go LUCI, Roland Shoemaker, Quim Muntal, golang-co...@googlegroups.com
Attention needed from Filippo Valsorda and Roland Shoemaker

Neal Patel voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Filippo Valsorda
  • Roland Shoemaker
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I57508b1360702d66a89d44b5bd2728decd075305
Gerrit-Change-Number: 747160
Gerrit-PatchSet: 5
Gerrit-Owner: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Filippo Valsorda <fil...@golang.org>
Gerrit-Reviewer: Neal Patel <neal...@google.com>
Gerrit-Reviewer: Roland Shoemaker <rol...@golang.org>
Gerrit-CC: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Roland Shoemaker <rol...@golang.org>
Gerrit-Attention: Filippo Valsorda <fil...@golang.org>
Gerrit-Comment-Date: Wed, 08 Apr 2026 23:56:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages