diff options
Diffstat (limited to 'src/pkg/runtime/thread_openbsd.c')
| -rw-r--r-- | src/pkg/runtime/thread_openbsd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pkg/runtime/thread_openbsd.c b/src/pkg/runtime/thread_openbsd.c index 700c481475..f2d17404fd 100644 --- a/src/pkg/runtime/thread_openbsd.c +++ b/src/pkg/runtime/thread_openbsd.c @@ -160,6 +160,22 @@ runtime·osinit(void) } void +runtime·get_random_data(byte **rnd, int32 *rnd_len) +{ + static byte urandom_data[HashRandomBytes]; + int32 fd; + fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); + if(runtime·read(fd, urandom_data, HashRandomBytes) == HashRandomBytes) { + *rnd = urandom_data; + *rnd_len = HashRandomBytes; + } else { + *rnd = nil; + *rnd_len = 0; + } + runtime·close(fd); +} + +void runtime·goenvs(void) { runtime·goenvs_unix(); |
