Skip to contentSkip to conversation

Really fix '--cipher none' regression

PATCH In review Steffan Karger 2 participants 2 messages Dec 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Really fix '--cipher none' regression

... by not incorrectly hinting to the compiler the function argument of cipher_kt_mode_{cbc,ofb_cfb}() is nonnull, since that no longer is the case.

Verified the fix on Debian Wheezy, one of the platforms the reporter in trac #473 mentions with a compiler that would optimize out the required checks.

Also add a testcase for --cipher none to t_lpback, to prevent further regressions.

---
 src/openvpn/crypto_backend.h | 6 ++----
 tests/t_lpback.sh            | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
src/openvpn/crypto_backend.h +2 -4
index 8749878..4e45df0 100644
@@ -237,8 +237,7 @@ int cipher_kt_mode (const cipher_kt_t *cipher_kt);
  *
  * @return		true iff the cipher is a CBC mode cipher.
  */
-bool cipher_kt_mode_cbc(const cipher_kt_t *cipher)
-  __attribute__((nonnull));
+bool cipher_kt_mode_cbc(const cipher_kt_t *cipher);
 
 /**
  * Check if the supplied cipher is a supported OFB or CFB mode cipher.
@@ -247,8 +246,7 @@ bool cipher_kt_mode_cbc(const cipher_kt_t *cipher)
  *
  * @return		true iff the cipher is a OFB or CFB mode cipher.
  */
-bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher)
-  __attribute__((nonnull));
+bool cipher_kt_mode_ofb_cfb(const cipher_kt_t *cipher);
 
 
 /**
tests/t_lpback.sh +3 -0
index 8f88ad9..d7792cd 100755
@@ -35,6 +35,9 @@ CIPHERS=$(${top_builddir}/src/openvpn/openvpn --show-ciphers | \
 # GD, 2014-07-06 do not test RC5-* either (fails on NetBSD w/o libcrypto_rc5)
 CIPHERS=$(echo "$CIPHERS" | egrep -v '^(DES-EDE3-CFB1|DES-CFB1|RC5-)' )
 
+# Also test cipher 'none'
+CIPHERS=${CIPHERS}$(printf "\nnone")
+
 "${top_builddir}/src/openvpn/openvpn" --genkey --secret key.$$
 set +e
 
Signature · 1 line
1.9.1
#1 lore raw

ACK.

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

commit 98156e90e1e83133a6a6a020db8e7333ada6156b (master) commit 785838614afc20d362b64907b0212e9a779e2287 (release/2.3)

Author: Steffan Karger
Date:   Tue Dec 2 21:42:00 2014 +0100
     Really fix '--cipher none' regression

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

--
kind regards,

Gert Doering