From: Guus Sliepen Date: Thu, 28 Nov 2013 13:19:55 +0000 (+0100) Subject: Allow "none" for Cipher and Digest again. X-Git-Tag: release-1.1pre10~39 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=51bddfd4dd95161afae2cac4aa5d31970fef5714;p=tinc Allow "none" for Cipher and Digest again. --- diff --git a/src/net_setup.c b/src/net_setup.c index 421315b8..6157993c 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -747,7 +747,9 @@ static bool setup_myself(void) { if(!get_config_string(lookup_config(config_tree, "Cipher"), &cipher)) cipher = xstrdup("blowfish"); - if(!(myself->incipher = cipher_open_by_name(cipher))) { + if(!strcasecmp(cipher, "none")) { + myself->incipher = NULL; + } else if(!(myself->incipher = cipher_open_by_name(cipher))) { logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized cipher type!"); return false; } @@ -769,7 +771,9 @@ static bool setup_myself(void) { if(!get_config_string(lookup_config(config_tree, "Digest"), &digest)) digest = xstrdup("sha1"); - if(!(myself->indigest = digest_open_by_name(digest, maclength))) { + if(!strcasecmp(digest, "none")) { + myself->indigest = NULL; + } else if(!(myself->indigest = digest_open_by_name(digest, maclength))) { logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized digest type!"); return false; } diff --git a/src/protocol_key.c b/src/protocol_key.c index a3cf3f51..e41ec422 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -395,14 +395,22 @@ bool ans_key_h(connection_t *c, const char *request) { /* Check and lookup cipher and digest algorithms */ - if(!(from->outcipher = cipher_open_by_nid(cipher))) { - logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown cipher!", from->name, from->hostname); - return false; + if(cipher) { + if(!(from->outcipher = cipher_open_by_nid(cipher))) { + logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown cipher!", from->name, from->hostname); + return false; + } + } else { + from->outcipher = NULL; } - if(!(from->outdigest = digest_open_by_nid(digest, maclength))) { - logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown digest!", from->name, from->hostname); - return false; + if(digest) { + if(!(from->outdigest = digest_open_by_nid(digest, maclength))) { + logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown digest!", from->name, from->hostname); + return false; + } + } else { + from->outdigest = NULL; } if(maclength != digest_length(from->outdigest)) {