Skip to contentSkip to conversation

Fixed tls-cipher translation bug in openssl-build

PATCH In review Steffan Karger 3 participants 3 messages Apr 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixed tls-cipher translation bug in openssl-build

Hi,

Attached a patch to fix a bug in the TLS-cipher translation introduced (by me) in commit 030c7b0. The previous version would not parse tls-cipher strings with more than two ciphers specified correctly.

The patch has been tested by the user that reported the bug.

-Steffan

From c32a559743d0b261663c489a56d6b651dc3011ff Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Thu, 4 Apr 2013 21:53:07 +0200
Subject: [PATCH] Fixed tls-cipher translation bug in openssl-build

---
 src/openvpn/ssl_openssl.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
src/openvpn/ssl_openssl.c +5 -2
index 1006617..79cc056 100644
@@ -217,8 +217,9 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
   ASSERT(NULL != ctx);
 
   // Translate IANA cipher suite names to OpenSSL names
-  for (begin_of_cipher = 0; begin_of_cipher < strlen(ciphers); begin_of_cipher = end_of_cipher+1) {
-      end_of_cipher = strcspn(&ciphers[begin_of_cipher], ":");
+  begin_of_cipher = end_of_cipher = 0;
+  for (; begin_of_cipher < strlen(ciphers); begin_of_cipher = end_of_cipher) {
+      end_of_cipher += strcspn(&ciphers[begin_of_cipher], ":");
       cipher_pair = tls_get_cipher_name_pair(&ciphers[begin_of_cipher], end_of_cipher - begin_of_cipher);
 
       if (NULL == cipher_pair)
@@ -257,6 +258,8 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
       openssl_ciphers_len += current_cipher_len;
       openssl_ciphers[openssl_ciphers_len] = ':';
       openssl_ciphers_len++;
+
+      end_of_cipher++;
   }
 
   if (openssl_ciphers_len > 0)
Signature · 1 line
1.7.9.5
#1 lore raw

Am 05.04.13 10:00, schrieb Steffan Karger:

Quoted 6 lines

Hi,

Attached a patch to fix a bug in the TLS-cipher translation introduced (by me) in commit 030c7b0. The previous version would not parse tls-cipher strings with more than two ciphers specified correctly.

The patch has been tested by the user that reported the bug.

ACK from me. Also the user reporting the problem has tested the patch and reports the patched version working.

Arne

#2 lore raw
In reply to Steffan Karger

Your patch has been applied to the master and release/2.3 branch.

commit 0bcde52f6a96a19c28e035e2c562f8a66eaa416f (master) commit 0710f9259dd03bc23dcb621e38e203b1d6a9984e (release/2.3)

Author: Steffan Karger
Date:   Thu Apr 4 21:53:07 2013 +0200
     Fixed tls-cipher translation bug in openssl-build

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/7480
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering