Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 28 Jan 2015 10:02:12 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: getrandom syscall

* Daniel Cegie??ka <daniel.cegielka@...il.com> [2015-01-27 23:12:46 +0100]:
> #include <stddef.h>
> #include <errno.h>
> #include "syscall.h"
> 

#ifdef SYS_getrandom

> int getrandom(void *buf, size_t len)
> {
> 	int ret, pre_errno = errno;
> 
> 	if (len > 256) {
> 		errno = EIO;
> 		return -1;
> 	}
> 	do {
> 		ret = syscall(SYS_getrandom, buf, len, 0);
> 	} while (ret == -1 && errno == EINTR);
> 	if (ret != len)
> 		return -1;
> 	errno = pre_errno;
> 	return 0;
> }

#endif

eg sh does not have the syscall (linux is not consistent with
syscalls for whatever reason)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.