Skip to contentSkip to conversation

OpenVPN-mbedTLS depends on mbedTLS debug module - safe to remove?

Openvpn-devel Magnus Kroken 3 participants 7 messages Jun 12, 2016 – Jun 14, 2016

lore
Share & tools
lore
#0 lore raw

Hi

The mbedTLS/PolarSSL build of OpenVPN depends on the debug.c part of mbedTLS. Specifically ssl_polarssl.c (ssl_mbedtls.c in master branch), key_state_ssl_init() calls debug_set_threshold() [1]. Removing this line removes the dependency.

Is it safe to remove the call to debug_set_threshold? Is it only used for more verbose logging, or can this cause a TLS error to not be noticed (or lead to other security implications)?

Building mbedTLS with the debug module increases its size by about 40k, and e.g. OpenWrt builds it without the debug module by default for this reason. I'm not asking OpenVPN to remove this, but I would like to know the known consequences of such a change.

1: https://github.com/OpenVPN/openvpn/commit/a9226fbdd90ac37891937b396c9c3212cd324262#diff-a06a4475e26fd6ec7e0cd3bbdcb30966R745

Regards,
Magnus Kroken

#1 lore raw

Hi,

Quoted 3 lines · Magnus Kroken

Is it safe to remove the call to debug_set_threshold? Is it only used for more verbose logging, or can this cause a TLS error to not be noticed (or lead to other security implications)?

Yes, the debug_set_threshold() call is only used for more verbose error logging. Very useful for debugging problems, but not critical for OpenVPN's operation or security.

-Steffan

#2 lore raw

Hi,

Quoted 8 lines · Steffan Karger
Quoted 3 lines · Magnus Kroken

Is it safe to remove the call to debug_set_threshold? Is it only used for more verbose logging, or can this cause a TLS error to not be noticed (or lead to other security implications)?

Yes, the debug_set_threshold() call is only used for more verbose error logging. Very useful for debugging problems, but not critical for OpenVPN's operation or security.

Can we detect and #ifdef this at build time?

Yes, adding another #ifdef is what we try to avoid - but this is a fairly localized thing, and the dependency is clear, not a "user selectable combination of build options".

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#3 lore raw
Quoted 10 lines · Gert Doering
Quoted 8 lines · Steffan Karger
Quoted 3 lines · Magnus Kroken

Is it safe to remove the call to debug_set_threshold? Is it only used for more verbose logging, or can this cause a TLS error to not be noticed (or lead to other security implications)?

Yes, the debug_set_threshold() call is only used for more verbose error logging. Very useful for debugging problems, but not critical for OpenVPN's operation or security.

Quoted 5 lines

Can we detect and #ifdef this at build time?

Yes, adding another #ifdef is what we try to avoid - but this is a fairly localized thing, and the dependency is clear, not a "user selectable combination of build options".

Sure. We can put this in e.g. #ifndef ENABLE_SMALL.

This information is not just useful for debugging during development, but also for debugging user problems. So I'd rather keep it in there by default, most users don't care at all about 40 kB :)

-Steffan

#4 lore raw

Hi,

Quoted 7 lines · Steffan Karger
Quoted 5 lines

Can we detect and #ifdef this at build time?

Yes, adding another #ifdef is what we try to avoid - but this is a fairly localized thing, and the dependency is clear, not a "user selectable combination of build options".

Sure. We can put this in e.g. #ifndef ENABLE_SMALL.

Was more thinking along the line of

#if !defined(ENABLE_SMALL) && !defined(MBEDTLS_COMPILED_WITH_SILLY_OPTION)

because --enable-small would remove lots of other useful information...

Quoted 3 lines

This information is not just useful for debugging during development, but also for debugging user problems. So I'd rather keep it in there by default, most users don't care at all about 40 kB :)

As far as I understood, if you build mbedtls without this debug.o, linking OpenVPN would just *fail* today.

Or did I misunderstand?

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#5 lore raw
Quoted 13 lines · Gert Doering
Quoted 7 lines · Steffan Karger
Quoted 5 lines

Can we detect and #ifdef this at build time?

Yes, adding another #ifdef is what we try to avoid - but this is a fairly localized thing, and the dependency is clear, not a "user selectable combination of build options".

Sure. We can put this in e.g. #ifndef ENABLE_SMALL.

Was more thinking along the line of

#if !defined(ENABLE_SMALL) && !defined(MBEDTLS_COMPILED_WITH_SILLY_OPTION)

Quoted 8 lines

because --enable-small would remove lots of other useful information...

Quoted 3 lines

This information is not just useful for debugging during development, but also for debugging user problems. So I'd rather keep it in there by default, most users don't care at all about 40 kB :)

As far as I understood, if you build mbedtls without this debug.o, linking OpenVPN would just *fail* today.

Right, of course. Sorry - too tired today. That would be #ifdef MBEDTLS_DEBUG_C, and totally makes sense. I'll send a patch.

-Steffan

#6 lore raw

Hi,

Quoted 2 lines · Steffan Karger

Right, of course. Sorry - too tired today. That would be #ifdef MBEDTLS_DEBUG_C, and totally makes sense. I'll send a patch.

commit b63f98633dbe2ca92cd43fc6f8597ab283a600bf

Author: Steffan Karger
Date:   Tue Jun 14 22:00:03 2016 +0200

mbedtls: don't set debug threshold if compiled without MBEDTLS_DEBUG_C

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...