From 6c9074772ce135c5c2bd2124be198fef913ba201 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 7 Mar 2025 10:37:40 +0100 Subject: [PATCH] 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. --- compiler/symbol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/symbol.go b/compiler/symbol.go index 1de3c6f39..1226683d5 100644 --- a/compiler/symbol.go +++ b/compiler/symbol.go @@ -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