]> tinc-vpn.org Git - tinc/blobdiff - src/ed25519/ecdh.c
Refactor crypto RNG; add getrandom() support
[tinc] / src / ed25519 / ecdh.c
index 9adf19fe1fb3b2ece8d90c1725197229d6b0f9d5..469f502e18c1a4938d9c74dba2f096a1f5f9890b 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;