#include #include #include #include #include "rnd.h" #include "die.h" #include "ioexact.h" #include "ioops.h" static int fdw = -1; static void randombytes_weak(unsigned char *x, unsigned long long xlen) { int ret; if (fdw == -1) { for (;;) { fdw = open(LOW_ENTROPY_SOURCE, O_RDONLY); if (fdw != -1) break; sleep(1); } } while (xlen > 0) { if (xlen < 1048576) ret = xlen; else ret = 1048576; ret = read(fdw, x, ret); if (ret < 1) { sleep(1); continue; } x += ret; xlen -= ret; } } static void randombytes_strong(unsigned char *x, unsigned long long xlen) { int fds, ret; fds = open_or_die(HIG_ENTROPY_SOURCE, O_RDONLY); ret = read_exact(fds, x, xlen, 0); if (ret != xlen) panic("Error reading from entropy source!\n"); close(fds); } int secrand(void) { int ret; randombytes_weak((void *) &ret, sizeof(ret)); return ret; } void gen_key_bytes(unsigned char *area, size_t len) { randombytes_strong(area, len); } tion value='emaclite-cleanup'>emaclite-cleanup net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Binns <frank.binns@imgtec.com>2016-06-24 18:15:17 +0100
committerAlex Deucher <alexander.deucher@amd.com>2016-07-07 15:02:07 -0400
commit7056bb5c8203c472aab0fa87dee79cfd87429ad2 (patch)
treec4a39664662dddc3b9700c17b582c56223a5c304
parentee7fd9575734f434ad541a5985687f195a2ff853 (diff)
drm/amd/amdgpu: Set DRIVER_MODESET feature flag at build time
This flag was being set unconditionally at runtime so just set it at compile time instead. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Frank Binns <frank.binns@imgtec.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>