From 85726b6a6d53f6c3a2c18ba3412ee5b14ee4d6f3 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 4 Jun 2013 13:22:56 +0200 Subject: rnd: add gen_key_bytes to generate key from good entropy source Make this a function and do not have this in curvetun hard coded. Signed-off-by: Daniel Borkmann --- curvetun.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'curvetun.c') diff --git a/curvetun.c b/curvetun.c index 1b69b2d..ffb6314 100644 --- a/curvetun.c +++ b/curvetun.c @@ -257,17 +257,7 @@ static void create_keypair(char *home) printf("Reading from %s (this may take a while) ...\n", HIG_ENTROPY_SOURCE); - fd = open_or_die(HIG_ENTROPY_SOURCE, O_RDONLY); - - ret = read_exact(fd, secretkey, sizeof(secretkey), 0); - if (ret != sizeof(secretkey)) { - err = EIO; - errstr = "Cannot read from "HIG_ENTROPY_SOURCE"!\n"; - goto out; - } - - close(fd); - + gen_key_bytes(secretkey, sizeof(secretkey)); crypto_scalarmult_curve25519_base(publickey, secretkey); memset(path, 0, sizeof(path)); -- cgit v1.2.3-54-g00ecf