]> git.meshlink.io Git - meshlink/blobdiff - src/libmeshlink.c
Merge branch 'master' into saverio
[meshlink] / src / libmeshlink.c
index aa1f935033b391f0a8ba4576f11c2635a30203b5..db0362b1e89680ae62ea54abdd44517fa0544a8c 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libmeshlink.h -- Tincd Library
-    Copyright (C) 2014 Guus Sliepen <guus@tinc-vpn.org> Saverio Proto <zioproto@gmail.com>
+    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io> Saverio Proto <zioproto@gmail.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,7 +18,6 @@
 */
 
 #include "libmeshlink.h"
-#include LZO1X_H
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
@@ -264,63 +263,6 @@ bool ecdsa_keygen(bool ask) {
        return true;
 }
 
-/*
-  Generate a public/private RSA keypair, and ask for a file to store
-  them in.
-*/
-bool rsa_keygen(int bits, bool ask) {
-       rsa_t *key;
-       FILE *f;
-       char *pubname, *privname;
-
-       fprintf(stderr, "Generating %d bits keys:\n", bits);
-
-       if(!(key = rsa_generate(bits, 0x10001))) {
-               fprintf(stderr, "Error during key generation!\n");
-               return false;
-       } else
-               fprintf(stderr, "Done.\n");
-
-       xasprintf(&privname, "%s" SLASH "rsa_key.priv", confbase);
-       f = ask_and_open(privname, "private RSA key", "a", ask, 0600);
-       free(privname);
-
-       if(!f)
-               return false;
-
-       if(!rsa_write_pem_private_key(key, f)) {
-               fprintf(stderr, "Error writing private key!\n");
-               fclose(f);
-               rsa_free(key);
-               return false;
-       }
-
-       fclose(f);
-
-       if(name)
-               xasprintf(&pubname, "%s" SLASH "hosts" SLASH "%s", confbase, name);
-       else
-               xasprintf(&pubname, "%s" SLASH "rsa_key.pub", confbase);
-
-       f = ask_and_open(pubname, "public RSA key", "a", ask, 0666);
-       free(pubname);
-
-       if(!f)
-               return false;
-
-       if(!rsa_write_pem_public_key(key, f)) {
-               fprintf(stderr, "Error writing public key!\n");
-               fclose(f);
-               rsa_free(key);
-               return false;
-       }
-
-       fclose(f);
-       rsa_free(key);
-
-       return true;
-}
-
 static bool try_bind(int port) {
        struct addrinfo *ai = NULL;
        struct addrinfo hint = {
@@ -412,7 +354,7 @@ bool tinc_setup(const char* confbaseapi, const char* name) {
        fprintf(f, "Name = %s\n", name);
        fclose(f);
 
-       if(!rsa_keygen(2048, false) || !ecdsa_keygen(false))
+       if(!ecdsa_keygen(false))
                return false;
 
        check_port(name);
@@ -451,13 +393,6 @@ bool tinc_main_thread(void * in) {
        if(!read_server_config())
                return false;
 
-#ifdef HAVE_LZO
-       if(lzo_init() != LZO_E_OK) {
-               logger(DEBUG_ALWAYS, LOG_ERR, "Error initializing LZO compressor!");
-               return false;
-       }
-#endif
-
        //char *priority = NULL; //shoud be not needed in libmeshlink
 
 #ifdef HAVE_MLOCKALL
@@ -524,7 +459,6 @@ end:
        crypto_exit();
 
        exit_configuration(&config_tree);
-       free(cmdline_conf);
 
        return status;