X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_setup.c;h=12b09a91045e716af1165804ba54cf834ff67da2;hp=d45cb1bbd80ee7906e041debd6c2118235f1effe;hb=a227843b739d279b63adcf3736ebb03d856080c4;hpb=7242868b64f9d6f62b6c5bbf1526eb632ed9a4d6 diff --git a/src/net_setup.c b/src/net_setup.c index d45cb1bb..12b09a91 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -13,11 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "system.h" @@ -46,14 +44,11 @@ char *myport; -bool read_rsa_public_key(connection_t *c) -{ +bool read_rsa_public_key(connection_t *c) { FILE *fp; char *fname; char *key; - cp(); - if(!c->rsa_key) { c->rsa_key = RSA_new(); // RSA_blinding_on(c->rsa_key, NULL); @@ -147,14 +142,11 @@ bool read_rsa_public_key(connection_t *c) return false; } -bool read_rsa_private_key(void) -{ +bool read_rsa_private_key(void) { FILE *fp; char *fname, *key, *pubkey; struct stat s; - cp(); - if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) { if(!get_config_string(lookup_config(myself->connection->config_tree, "PublicKey"), &pubkey)) { logger(LOG_ERR, _("PrivateKey used but no PublicKey found!")); @@ -211,8 +203,7 @@ bool read_rsa_private_key(void) /* Configure node_t myself and set up the local sockets (listen only) */ -bool setup_myself(void) -{ +bool setup_myself(void) { config_t *cfg; subnet_t *subnet; char *name, *hostname, *mode, *afname, *cipher, *digest; @@ -222,8 +213,6 @@ bool setup_myself(void) bool choice; int i, err; - cp(); - myself = new_node(); myself->connection = new_connection(); init_configuration(&myself->connection->config_tree); @@ -362,14 +351,14 @@ bool setup_myself(void) } } } else - myself->incipher = EVP_bf_cbc(); + myself->incipher = EVP_aes_256_cbc(); if(myself->incipher) myself->inkeylength = myself->incipher->key_len + myself->incipher->iv_len; else myself->inkeylength = 1; - myself->connection->outcipher = EVP_bf_ofb(); + myself->connection->outcipher = EVP_aes_256_ofb(); if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime)) keylifetime = 3600; @@ -390,9 +379,9 @@ bool setup_myself(void) } } } else - myself->indigest = EVP_sha1(); + myself->indigest = EVP_sha256(); - myself->connection->outdigest = EVP_sha1(); + myself->connection->outdigest = EVP_sha256(); if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->inmaclength)) { if(myself->indigest) { @@ -508,10 +497,7 @@ bool setup_myself(void) /* initialize network */ -bool setup_network(void) -{ - cp(); - +bool setup_network(void) { now = time(NULL); init_events(); @@ -545,15 +531,12 @@ bool setup_network(void) /* close all open network connections */ -void close_network_connections(void) -{ +void close_network_connections(void) { avl_node_t *node, *next; connection_t *c; char *envp[5]; int i; - cp(); - for(node = connection_tree->head; node; node = next) { next = node->next; c = node->data;