Commit c136197c authored by Jeff Sickel's avatar Jeff Sickel Committed by Rob Pike

runtime: plan 9 does have /dev/random

R=golang-codereviews, r, aram
CC=0intro, golang-codereviews, rsc
https://golang.org/cl/43420045
parent 82e2db70
......@@ -102,8 +102,18 @@ runtime·crash(void)
void
runtime·get_random_data(byte **rnd, int32 *rnd_len)
{
*rnd = nil;
*rnd_len = 0;
static byte random_data[HashRandomBytes];
int32 fd;
fd = runtime·open("/dev/random", 0 /* O_RDONLY */, 0);
if(runtime·read(fd, random_data, HashRandomBytes) == HashRandomBytes) {
*rnd = random_data;
*rnd_len = HashRandomBytes;
} else {
*rnd = nil;
*rnd_len = 0;
}
runtime·close(fd);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment