mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-01 21:10:16 +00:00
Disable debug messages that can introduce a timing side channel.
Introduced the POLARSSL_SSL_DEBUG_ALL flag to enable all these debug
messages in case somebody does want to see the reason checks fail.
(cherry picked from commit d66f070d49
)
Conflicts:
include/polarssl/config.h
library/ssl_tls.c
This commit is contained in:
parent
6a229c1f8c
commit
48b7cb8ea2
|
@ -3,6 +3,8 @@ PolarSSL ChangeLog
|
||||||
= Branch 1.1
|
= Branch 1.1
|
||||||
Changes
|
Changes
|
||||||
* Allow enabling of dummy error_strerror() to support some use-cases
|
* Allow enabling of dummy error_strerror() to support some use-cases
|
||||||
|
* Debug messages about padding errors during SSL message decryption are
|
||||||
|
disabled by default and can be enabled with POLARSSL_SSL_DEBUG_ALL
|
||||||
|
|
||||||
Security
|
Security
|
||||||
* Removed timing differences during SSL message decryption in
|
* Removed timing differences during SSL message decryption in
|
||||||
|
|
|
@ -216,6 +216,22 @@
|
||||||
*/
|
*/
|
||||||
#define POLARSSL_SELF_TEST
|
#define POLARSSL_SELF_TEST
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def POLARSSL_SSL_DEBUG_ALL
|
||||||
|
*
|
||||||
|
* Enable the debug messages in SSL module for all issues.
|
||||||
|
* Debug messages have been disabled in some places to prevent timing
|
||||||
|
* attacks due to (unbalanced) debugging function calls.
|
||||||
|
*
|
||||||
|
* If you need all error reporting you should enable this during debugging,
|
||||||
|
* but remove this for production servers that should log as well.
|
||||||
|
*
|
||||||
|
* Uncomment this macro to report all debug messages on errors introducing
|
||||||
|
* a timing side-channel.
|
||||||
|
*
|
||||||
|
#define POLARSSL_SSL_DEBUG_ALL
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
* \def POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||||
*
|
*
|
||||||
|
|
|
@ -769,9 +769,10 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
||||||
|
|
||||||
if( ssl->in_msglen < ssl->maclen + padlen )
|
if( ssl->in_msglen < ssl->maclen + padlen )
|
||||||
{
|
{
|
||||||
|
#if defined(POLARSSL_SSL_DEBUG_ALL)
|
||||||
SSL_DEBUG_MSG( 1, ( "msglen (%d) < maclen (%d) + padlen (%d)",
|
SSL_DEBUG_MSG( 1, ( "msglen (%d) < maclen (%d) + padlen (%d)",
|
||||||
ssl->in_msglen, ssl->maclen, padlen ) );
|
ssl->in_msglen, ssl->maclen, padlen ) );
|
||||||
|
#endif
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
fake_padlen = 256;
|
fake_padlen = 256;
|
||||||
correct = 0;
|
correct = 0;
|
||||||
|
@ -781,9 +782,11 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
||||||
{
|
{
|
||||||
if( padlen > ssl->ivlen )
|
if( padlen > ssl->ivlen )
|
||||||
{
|
{
|
||||||
|
#if defined(POLARSSL_SSL_DEBUG_ALL)
|
||||||
SSL_DEBUG_MSG( 1, ( "bad padding length: is %d, "
|
SSL_DEBUG_MSG( 1, ( "bad padding length: is %d, "
|
||||||
"should be no more than %d",
|
"should be no more than %d",
|
||||||
padlen, ssl->ivlen ) );
|
padlen, ssl->ivlen ) );
|
||||||
|
#endif
|
||||||
correct = 0;
|
correct = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,8 +812,10 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
||||||
else
|
else
|
||||||
minlen = 1;
|
minlen = 1;
|
||||||
}
|
}
|
||||||
|
#if defined(POLARSSL_SSL_DEBUG_ALL)
|
||||||
if( padlen > 0 && correct == 0)
|
if( padlen > 0 && correct == 0)
|
||||||
SSL_DEBUG_MSG( 1, ( "bad padding byte detected" ) );
|
SSL_DEBUG_MSG( 1, ( "bad padding byte detected" ) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue