summaryrefslogtreecommitdiff
path: root/curvetun.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-04 13:22:56 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-04 13:22:56 +0200
commit85726b6a6d53f6c3a2c18ba3412ee5b14ee4d6f3 (patch)
tree4a76b6b0e85127135eaa30e6478cfdc18847702a /curvetun.c
parent26b173d328e36e423ff7765df5b3fc75abb6a1d9 (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'curvetun.c')
-rw-r--r--curvetun.c12
1 files changed, 1 insertions, 11 deletions
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));