mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
Fix linker errors for runtime.vgetrandom and crypto/internal/sysrand.fatal
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package runtime
|
||||
|
||||
import _ "unsafe"
|
||||
|
||||
// TODO: Use hardware when available
|
||||
//
|
||||
//go:linkname vgetrandom
|
||||
func vgetrandom(p []byte, flags uint32) (ret int, supported bool) { return 0, false }
|
||||
|
||||
//go:linkname fatal crypto/internal/sysrand.fatal
|
||||
func fatal(msg string) { runtimePanic(msg) }
|
||||
@@ -4,6 +4,8 @@ package os_smoke_test
|
||||
// Intended to catch build tag mistakes affecting bare metal targets.
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -25,3 +27,10 @@ func TestFmt(t *testing.T) {
|
||||
t.Errorf("printf returned %d, expected 14", n)
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/tinygo-org/tinygo/issues/4921
|
||||
func TestRand(t *testing.T) {
|
||||
if _, err := rsa.GenerateKey(rand.Reader, 2048); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user