Completely remove DES checks
PATCH 1/1 Completely remove DES checks
We already removed the check in d67658fee for OpenSSL 3.0. This removes the checks entirely for all crypto libraries.
--- src/openvpn/crypto.c | 15 -------- src/openvpn/crypto_backend.h | 28 --------------- src/openvpn/crypto_mbedtls.c | 56 ------------------------------ src/openvpn/crypto_openssl.c | 66 ------------------------------------ 4 files changed, 165 deletions(-)
src/openvpn/crypto.c +0 -15
@@ -986,21 +986,6 @@ check_key(struct key *key, const struct key_type *kt) {return false; } - -/* -* Check for weak or semi-weak DES keys. -*/ - { -const int ndc =key_des_num_cblocks (kt->cipher); -if (ndc) - { -return key_des_check (key->cipher, kt->cipher_length, ndc); - } -else - { -return true; - } - } }return true; }
src/openvpn/crypto_backend.h +0 -28
@@ -156,34 +156,6 @@ bool crypto_pem_decode(const char *name, struct buffer *dst,*/ int rand_bytes (uint8_t *output,int len); -/* -* -* Key functions, allow manipulation of keys. -* -*/ - - -/** -* Return number of DES cblocks (1 cblock = length of a single-DES key) for the -* current key type or 0 if not a DES cipher. -* -* @param kt Type of key -* -* @return Number of DES cblocks that the key consists of, or 0. -*/ -int key_des_num_cblocks (const cipher_kt_t *kt); - -/* -* Check the given DES key. Checks the given key's length, weakness and parity. -* -* @param key Key to check -* @param key_len Length of the key, in bytes -* @param ndc Number of DES cblocks that the key is made up of. -* -* @return \c true if the key is valid, \c false otherwise. -*/ -bool key_des_check (uint8_t *key,int key_len,int ndc); -/** * Encrypt the given block, using DES ECB mode *
src/openvpn/crypto_mbedtls.c +0 -56
62 lines not on this page · raw message
src/openvpn/crypto_openssl.c +0 -66
72 lines not on this page · raw message
Signature · 1 line
2.33.0
Quoted 4 lines · Arne Schwabe
We already removed the check in
d67658feefor OpenSSL 3.0. This removes the checks entirely for all crypto libraries.Signed-off-by Arne Schwabe <[email protected]...>
Looks good to me!
Compiled and ran --test-crypto for DES/DES3, with mbedtls and OpenSSL 3.
Am 07.11.21 um 10:01 schrieb Arne Schwabe:
Quoted 10 lines
We already removed the check in
d67658feefor OpenSSL 3.0. This removes the checks entirely for all crypto libraries.Signed-off-by Arne Schwabe <[email protected]...>--- src/openvpn/crypto.c | 15 -------- src/openvpn/crypto_backend.h | 28 --------------- src/openvpn/crypto_mbedtls.c | 56 ------------------------------ src/openvpn/crypto_openssl.c | 66 ------------------------------------ 4 files changed, 165 deletions(-)
src/openvpn/crypto_openssl.c rand_bytes(uint8_t *output, int len) · line 617
Quoted 5 lines
src/openvpn/crypto_openssl.c +0
-5-/* DES is deprecated and the method to even check the keys is deprecated -* in OpenSSL 3.0. Instead of checking for the 16 weak/semi-weak keys -* we just accept them in OpenSSL 3.0 since the risk of randomly getting -* these is pretty low (and "all DES keys are weak" anyway) */ -return true;
Should not we nuke DES altogether in that case? Or am I misunderstanding the patch?
Am 07.11.21 um 12:57 schrieb Matthias Andree:
Quoted 20 lines
Am 07.11.21 um 10:01 schrieb Arne Schwabe:
Quoted 10 lines
We already removed the check in
d67658feefor OpenSSL 3.0. This removes the checks entirely for all crypto libraries.Signed-off-by Arne Schwabe <[email protected]...>---
src/openvpn/crypto.c | 15 --------src/openvpn/crypto_backend.h | 28 --------------- src/openvpn/crypto_mbedtls.c | 56 ------------------------------ src/openvpn/crypto_openssl.c | 66 ------------------------------------ 4 files changed, 165 deletions(-)Quoted 8 lines
- /* DES is deprecated and the method to even check the keys is deprecated
- * in OpenSSL 3.0. Instead of checking for the 16 weak/semi-weak keys
- * we just accept them in OpenSSL 3.0 since the risk of randomly getting
- * these is pretty low (and "all DES keys are weak" anyway) */ - return true;
Quoted 2 lines
Should not we nuke DES altogether in that case? Or am I misunderstanding the patch?
The patch removes checking for weak keys and making DES just like any other CBC cipher and not doing extra checks for this. It basically removes the special treatment of DES.
Arne
Am 07.11.21 um 13:13 schrieb Arne Schwabe:
Quoted 23 lines
Am 07.11.21 um 12:57 schrieb Matthias Andree:
Quoted 22 lines
Am 07.11.21 um 10:01 schrieb Arne Schwabe:
Quoted 20 lines
We already removed the check in
d67658feefor OpenSSL 3.0. This removes the
checks entirely for all crypto libraries.Signed-off-by Arne Schwabe <[email protected]...>---
src/openvpn/crypto.c | 15 --------src/openvpn/crypto_backend.h | 28 --------------- src/openvpn/crypto_mbedtls.c | 56 ------------------------------ src/openvpn/crypto_openssl.c | 66 ------------------------------------ 4 files changed, 165 deletions(-)- /* DES is deprecated and the method to even check the keys is deprecated
- * in OpenSSL 3.0. Instead of checking for the 16 weak/semi-weak keys
- * we just accept them in OpenSSL 3.0 since the risk of randomly getting
- * these is pretty low (and "all DES keys are weak" anyway) */ - return true;
Quoted 7 lines
Quoted 2 lines
Should not we nuke DES altogether in that case? Or am I misunderstanding the patch?
The patch removes checking for weak keys and making DES just like any other CBC cipher and not doing extra checks for this. It basically removes the special treatment of DES.
After this, do we have any DES functionality left in OpenVPN? If so, we should remove it.
Quoted 10 lines
Quoted 5 lines
The patch removes checking for weak keys and making DES just like any other CBC cipher and not doing extra checks for this. It basically removes the special treatment of DES.
After this, do we have any DES functionality left in OpenVPN? If so, we should remove it.
After this patch, no special handling for DES anymore. YOu can still use DES but it is handled like any other cipher, e.g. BF-CBC, AES-CBC
Arne
Quoted 7 lines · Arne Schwabe
Quoted 7 lines
Quoted 5 lines
The patch removes checking for weak keys and making DES just like any other CBC cipher and not doing extra checks for this. It basically removes the special treatment of DES.
Quoted 7 lines
Quoted 3 lines
After this, do we have any DES functionality left in OpenVPN? If so, we should remove it.
After this patch, no special handling for DES anymore. YOu can still use DES but it is handled like any other cipher, e.g. BF-CBC, AES-CBC
Arne
I think the point is that if we stop checking weak keys, we should rip out DES support completely. (I'd be in favor, but I'm not deep enough into it to know what the fallout would be.)
My view is, if someone's doing DES, they're not caring about security, so the small risk of weak keys is acceptable. Basically, "all DES keys are weak keys."
Patch looks good, explanation makes sense, logical continuation of the process started with the "removal for 3.0.0". All DES keys are weak :-)
Lightly tested with OpenSSL 1.1.1 and mbedTLS builds (no actual *use* of DES, though, besides "make check").
Your patch has been applied to the master branch.
commit 1325cf1198f78ccd8ab74394bb2e9b13f410ef20
Author: Arne Schwabe Date: Sun Nov 7 10:01:38 2021 +0100
Completely remove DES checks
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Max Fillinger <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg23115.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering