aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r--src/cmd/compile/internal/liveness/plive.go4
-rw-r--r--src/cmd/compile/internal/ssa/func.go4
-rw-r--r--src/cmd/compile/internal/ssa/print.go9
-rw-r--r--src/cmd/compile/internal/staticdata/data.go8
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go4
-rw-r--r--src/cmd/compile/internal/types/fmt.go6
6 files changed, 18 insertions, 17 deletions
diff --git a/src/cmd/compile/internal/liveness/plive.go b/src/cmd/compile/internal/liveness/plive.go
index bd0a6fa1a33..93f49fad454 100644
--- a/src/cmd/compile/internal/liveness/plive.go
+++ b/src/cmd/compile/internal/liveness/plive.go
@@ -15,7 +15,6 @@
package liveness
import (
- "crypto/sha1"
"fmt"
"os"
"sort"
@@ -30,6 +29,7 @@ import (
"cmd/compile/internal/ssa"
"cmd/compile/internal/typebits"
"cmd/compile/internal/types"
+ "cmd/internal/notsha256"
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/src"
@@ -959,7 +959,7 @@ func (lv *liveness) enableClobber() {
// Clobber only functions where the hash of the function name matches a pattern.
// Useful for binary searching for a miscompiled function.
hstr := ""
- for _, b := range sha1.Sum([]byte(lv.f.Name)) {
+ for _, b := range notsha256.Sum256([]byte(lv.f.Name)) {
hstr += fmt.Sprintf("%08b", b)
}
if !strings.HasSuffix(hstr, h) {
diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go
index 35a93826634..75f17634ec5 100644
--- a/src/cmd/compile/internal/ssa/func.go
+++ b/src/cmd/compile/internal/ssa/func.go
@@ -8,8 +8,8 @@ import (
"cmd/compile/internal/abi"
"cmd/compile/internal/base"
"cmd/compile/internal/types"
+ "cmd/internal/notsha256"
"cmd/internal/src"
- "crypto/sha1"
"fmt"
"io"
"math"
@@ -854,7 +854,7 @@ func (f *Func) DebugHashMatch(evname string) bool {
// We use this feature to do a binary search to
// find a function that is incorrectly compiled.
hstr := ""
- for _, b := range sha1.Sum([]byte(name)) {
+ for _, b := range notsha256.Sum256([]byte(name)) {
hstr += fmt.Sprintf("%08b", b)
}
diff --git a/src/cmd/compile/internal/ssa/print.go b/src/cmd/compile/internal/ssa/print.go
index 96cd2c7c90a..aea9ce9e33a 100644
--- a/src/cmd/compile/internal/ssa/print.go
+++ b/src/cmd/compile/internal/ssa/print.go
@@ -6,10 +6,11 @@ package ssa
import (
"bytes"
- "cmd/internal/src"
- "crypto/sha256"
"fmt"
"io"
+
+ "cmd/internal/notsha256"
+ "cmd/internal/src"
)
func printFunc(f *Func) {
@@ -17,7 +18,7 @@ func printFunc(f *Func) {
}
func hashFunc(f *Func) []byte {
- h := sha256.New()
+ h := notsha256.New()
p := stringFuncPrinter{w: h, printDead: true}
fprintFunc(p, f)
return h.Sum(nil)
@@ -32,7 +33,7 @@ func (f *Func) String() string {
// rewriteHash returns a hash of f suitable for detecting rewrite cycles.
func (f *Func) rewriteHash() string {
- h := sha256.New()
+ h := notsha256.New()
p := stringFuncPrinter{w: h, printDead: false}
fprintFunc(p, f)
return fmt.Sprintf("%x", h.Sum(nil))
diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go
index b114bb2df6c..b8b645f246f 100644
--- a/src/cmd/compile/internal/staticdata/data.go
+++ b/src/cmd/compile/internal/staticdata/data.go
@@ -5,7 +5,6 @@
package staticdata
import (
- "crypto/sha256"
"fmt"
"go/constant"
"io"
@@ -20,6 +19,7 @@ import (
"cmd/compile/internal/objw"
"cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
+ "cmd/internal/notsha256"
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/src"
@@ -73,7 +73,7 @@ func StringSym(pos src.XPos, s string) (data *obj.LSym) {
// Indulge in some paranoia by writing the length of s, too,
// as protection against length extension attacks.
// Same pattern is known to fileStringSym below.
- h := sha256.New()
+ h := notsha256.New()
io.WriteString(h, s)
symname = fmt.Sprintf(stringSymPattern, len(s), h.Sum(nil))
} else {
@@ -131,7 +131,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj.
sym = slicedata(pos, string(data)).Linksym()
}
if len(hash) > 0 {
- sum := sha256.Sum256(data)
+ sum := notsha256.Sum256(data)
copy(hash, sum[:])
}
return sym, size, nil
@@ -148,7 +148,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj.
// Compute hash if needed for read-only content hashing or if the caller wants it.
var sum []byte
if readonly || len(hash) > 0 {
- h := sha256.New()
+ h := notsha256.New()
n, err := io.Copy(h, f)
if err != nil {
return nil, 0, err
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 12159b71e1b..9436aa55047 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -236,7 +236,6 @@ package typecheck
import (
"bytes"
- "crypto/md5"
"encoding/binary"
"fmt"
"go/constant"
@@ -250,6 +249,7 @@ import (
"cmd/compile/internal/ir"
"cmd/compile/internal/types"
"cmd/internal/goobj"
+ "cmd/internal/notsha256"
"cmd/internal/src"
)
@@ -353,7 +353,7 @@ func WriteExports(out io.Writer, extensions bool) {
hdr.uint64(dataLen)
// Flush output.
- h := md5.New()
+ h := notsha256.New()
wr := io.MultiWriter(out, h)
io.Copy(wr, &hdr)
io.Copy(wr, &p.strings)
diff --git a/src/cmd/compile/internal/types/fmt.go b/src/cmd/compile/internal/types/fmt.go
index bdd3ca1d287..3c02cb86810 100644
--- a/src/cmd/compile/internal/types/fmt.go
+++ b/src/cmd/compile/internal/types/fmt.go
@@ -6,7 +6,6 @@ package types
import (
"bytes"
- "crypto/md5"
"encoding/binary"
"fmt"
"go/constant"
@@ -15,6 +14,7 @@ import (
"sync"
"cmd/compile/internal/base"
+ "cmd/internal/notsha256"
)
// BuiltinPkg is a fake package that declares the universe block.
@@ -771,7 +771,7 @@ func FmtConst(v constant.Value, sharp bool) string {
func TypeHash(t *Type) uint32 {
p := tconv(t, 0, fmtTypeIDHash)
- // Using MD5 is overkill, but reduces accidental collisions.
- h := md5.Sum([]byte(p))
+ // Using SHA256 is overkill, but reduces accidental collisions.
+ h := notsha256.Sum256([]byte(p))
return binary.LittleEndian.Uint32(h[:4])
}