mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +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.
|
// Intended to catch build tag mistakes affecting bare metal targets.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -25,3 +27,10 @@ func TestFmt(t *testing.T) {
|
|||||||
t.Errorf("printf returned %d, expected 14", n)
|
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