From 4fd73e5d4ca8c87efa127ee7a3290b1d0fdae313 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 4 Sep 2024 18:30:35 +0700 Subject: cmd: do not use notsha256 CL 402595 used notsha256 to prevent the compiler from depending on cgo-based implementations of sha1 and sha256. However, since CL 454836, cmd is built with CGO_ENABLED=0, which will disable boringcrypto. Thus all usages of notsha256 is not necessary anymore. Updates #51940 Updates #64751 Change-Id: I503090f7a2efb5723e8a79523b143dc7cdb4edd0 Reviewed-on: https://go-review.googlesource.com/c/go/+/610596 Auto-Submit: Cuong Manh Le LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Dmitri Shuralyov Reviewed-by: Keith Randall --- src/cmd/internal/obj/objfile.go | 4 ++-- src/cmd/internal/obj/sym.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/cmd/internal/obj') diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index bf135af554..6aa208a1c0 100644 --- a/src/cmd/internal/obj/objfile.go +++ b/src/cmd/internal/obj/objfile.go @@ -10,7 +10,7 @@ import ( "bytes" "cmd/internal/bio" "cmd/internal/goobj" - "cmd/internal/notsha256" + "cmd/internal/hash" "cmd/internal/objabi" "cmd/internal/sys" "cmp" @@ -494,7 +494,7 @@ func contentHash64(s *LSym) goobj.Hash64Type { // For now, we assume there is no circular dependencies among // hashed symbols. func (w *writer) contentHash(s *LSym) goobj.HashType { - h := notsha256.New() + h := hash.New32() var tmp [14]byte // Include the size of the symbol in the hash. diff --git a/src/cmd/internal/obj/sym.go b/src/cmd/internal/obj/sym.go index 943be3c38c..0fd0eb7f0f 100644 --- a/src/cmd/internal/obj/sym.go +++ b/src/cmd/internal/obj/sym.go @@ -33,7 +33,7 @@ package obj import ( "cmd/internal/goobj" - "cmd/internal/notsha256" + "cmd/internal/hash" "cmd/internal/objabi" "encoding/base64" "encoding/binary" @@ -207,7 +207,7 @@ func (ctxt *Link) Int128Sym(hi, lo int64) *LSym { // GCLocalsSym generates a content-addressable sym containing data. func (ctxt *Link) GCLocalsSym(data []byte) *LSym { - sum := notsha256.Sum256(data) + sum := hash.Sum32(data) str := base64.StdEncoding.EncodeToString(sum[:16]) return ctxt.LookupInit(fmt.Sprintf("gclocals·%s", str), func(lsym *LSym) { lsym.P = data -- cgit v1.3-5-g45d5