syscall: remove RtlGenRandom and move it into internal/syscall
There's on need to expose this to the frozen syscall package, and it
also doesn't need to be unsafe. So we move it into internal/syscall and
have the generator make a safer function signature.
Fixes #43704.
Change-Id: Iccae69dc273a0aa97ee6846eb537f1dc1412f2de
Reviewed-on: https://go-review.googlesource.com/c/go/+/283992
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
diff --git a/src/crypto/rand/rand_windows.go b/src/crypto/rand/rand_windows.go
index 8b2c960..7379f14 100644
--- a/src/crypto/rand/rand_windows.go
+++ b/src/crypto/rand/rand_windows.go
@@ -8,8 +8,8 @@
package rand
import (
+ "internal/syscall/windows"
"os"
- "syscall"
)
func init() { Reader = &rngReader{} }
@@ -24,7 +24,7 @@
return 0, nil
}
- err = syscall.RtlGenRandom(&b[0], inputLen)
+ err = windows.RtlGenRandom(b)
if err != nil {
return 0, os.NewSyscallError("RtlGenRandom", err)
}