From: David Sommerseth Date: Tue, 9 Mar 2010 15:34:42 +0100 Message-Id: <1268145282-8727-1-git-send-email-openvpn.list@...1114...> Subject: [Openvpn-devel] [PATCH] Don't ASSERT() on stream cipher List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net Cc: "Vladimir I. Kobylyanskiy" , David Sommerseth From: Vladimir I. Kobylyanskiy We (Ltd. LISSI, http://www.lissi.ru, info at lissi.ru), are trying to use OpenVPN with stream ciphers, including Russian cipher GOST 28147-89(ALLOW_NON_CBC_CIPHERS flag is set). And we found the bug: function EVP_CipherFinal() returns 0, when cipher has block_size == 1(stream cipher). So hear is the patch to fix the bug. sf.net tracker: Signed-off-by: David Sommerseth --- crypto.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/crypto.c b/crypto.c index 444f036..fd7d2ef 100644 --- a/crypto.c +++ b/crypto.c @@ -159,7 +159,8 @@ openvpn_encrypt (struct buffer *buf, struct buffer work, /* Flush the encryption buffer */ ASSERT (EVP_CipherFinal (ctx->cipher, BPTR (&work) + outlen, &outlen)); work.len += outlen; - ASSERT (outlen == iv_size); + if (mode == EVP_CIPH_CBC_MODE) + ASSERT (outlen == iv_size); /* prepend the IV to the ciphertext */ if (opt->flags & CO_USE_IV) -- 1.6.6.1