Refactor crypto RNG; add getrandom() support
[tinc] / src / ed25519 / ecdh.c
index 9adf19f..469f502 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "../system.h"
+#include "../random.h"
 
 #include "ed25519.h"
 
@@ -26,15 +27,14 @@ typedef struct ecdh_t {
        uint8_t private[64];
 } ecdh_t;
 
-#include "../crypto.h"
 #include "../ecdh.h"
 #include "../xalloc.h"
 
 ecdh_t *ecdh_generate_public(void *pubkey) {
-       ecdh_t *ecdh = xzalloc(sizeof *ecdh);
+       ecdh_t *ecdh = xzalloc(sizeof(*ecdh));
 
        uint8_t seed[32];
-       randomize(seed, sizeof seed);
+       randomize(seed, sizeof(seed));
        ed25519_create_keypair(pubkey, ecdh->private, seed);
 
        return ecdh;