Use CFB mode for meta-connections to improve security.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 30 Oct 2016 12:11:24 +0000 (13:11 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 30 Oct 2016 13:08:39 +0000 (14:08 +0100)
m4/openssl.m4
src/net_setup.c

index 4cf26f47bb74920caf42faf8988e388501791f17..adca5f7a5bdef845cb14980f0c75429cc04322fb 100644 (file)
@@ -45,11 +45,11 @@ AC_DEFUN([tinc_OPENSSL],
     [AC_MSG_ERROR([LibreSSL/OpenSSL libraries not found.])]
   )
 
-  AC_CHECK_FUNCS([RAND_bytes EVP_EncryptInit_ex EVP_CIPHER_CTX_new EVP_aes_256_ctr], ,
+  AC_CHECK_FUNCS([RAND_bytes EVP_EncryptInit_ex EVP_CIPHER_CTX_new], ,
     [AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
   )
 
-  AC_CHECK_DECL([OpenSSL_add_all_algorithms], ,
+  AC_CHECK_DECLS([OpenSSL_add_all_algorithms, EVP_aes_256_cfb], ,
     [AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
     [#include <openssl/evp.h>]
   )
index eeeefdf6baaa982f6c9a1ede4ba33b2c50ba2035..d7668885e7f76ca6965f9bfbf3b6ab80a47bb1df 100644 (file)
@@ -657,18 +657,18 @@ static bool setup_myself(void) {
        else
                myself->inkeylength = 1;
 
-       /* We need to use OFB mode for the meta protocol. Use AES for this,
+       /* We need to use a stream mode for the meta protocol. Use AES for this,
           but try to match the key size with the one from the cipher selected
           by Cipher.
        */
 
        int keylen = EVP_CIPHER_key_length(myself->incipher);
        if(keylen <= 16)
-               myself->connection->outcipher = EVP_aes_128_ctr();
+               myself->connection->outcipher = EVP_aes_128_cfb();
        else if(keylen <= 24)
-               myself->connection->outcipher = EVP_aes_192_ctr();
+               myself->connection->outcipher = EVP_aes_192_cfb();
        else
-               myself->connection->outcipher = EVP_aes_256_ctr();
+               myself->connection->outcipher = EVP_aes_256_cfb();
 
        if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
                keylifetime = 3600;