mailing list of musl libc
 help / color / mirror / code / Atom feed
48ca3d515b59088f6d65d486990c89972bc1e70e blob 505 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
#include <sys/random.h>
#include <errno.h>
#include "syscall.h"

int getentropy(void *buffer, size_t length)
{
	int ret;
	char *pos = buffer;
	size_t rem = length;

	if (length > 256) {
		return __syscall_ret(-EIO);
	}

	while (rem) {
		ret = __syscall_cp(SYS_getrandom, pos, rem, 0);
		if (ret == -EINTR) {
			continue;
		} else if (ret == -EFAULT || ret == -ENOSYS) {
			return __syscall_ret(ret);
		} else if (ret <= 0) {
			return __syscall_ret(-EIO);
		}

		pos += ret;
		rem -= ret;
	}
	return 0;
}
debug log:

solving 48ca3d51 ...
found 48ca3d51 in https://inbox.vuxu.org/musl/20180106220809.10078-1-hauke@hauke-m.de/

applying [1/1] https://inbox.vuxu.org/musl/20180106220809.10078-1-hauke@hauke-m.de/
diff --git a/src/linux/getentropy.c b/src/linux/getentropy.c
new file mode 100644
index 00000000..48ca3d51

Checking patch src/linux/getentropy.c...
Applied patch src/linux/getentropy.c cleanly.

index at:
100644 48ca3d515b59088f6d65d486990c89972bc1e70e	src/linux/getentropy.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).