compiler: crypto/internal/sysrand is allowed to use unsafe signatures

Apparently this package imports `runtime.getRandomData` from the gojs
module. This is not yet implemented, but simply allowing this package to
do such imports gets crypto/sha256 to compile.
This commit is contained in:
Ayke van Laethem
2025-03-07 10:37:40 +01:00
committed by Ron Evans
parent e49663809b
commit 6c9074772c
+1 -1
View File
@@ -446,7 +446,7 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
// The list of allowed types is based on this proposal:
// https://github.com/golang/go/issues/59149
func (c *compilerContext) checkWasmImportExport(f *ssa.Function, pragma string) {
if c.pkg.Path() == "runtime" || c.pkg.Path() == "syscall/js" || c.pkg.Path() == "syscall" {
if c.pkg.Path() == "runtime" || c.pkg.Path() == "syscall/js" || c.pkg.Path() == "syscall" || c.pkg.Path() == "crypto/internal/sysrand" {
// The runtime is a special case. Allow all kinds of parameters
// (importantly, including pointers).
return