Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limits.h inclusion to ssl_tls.c and udp_proxy.c #1999

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions configs/config-ccm-psk-tls1_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,4 @@
*/
#define MBEDTLS_SSL_MAX_CONTENT_LEN 1024

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
2 changes: 0 additions & 2 deletions configs/config-mini-tls1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,4 @@
/* For testing with compat.sh */
#define MBEDTLS_FS_IO

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
2 changes: 0 additions & 2 deletions configs/config-no-entropy.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,4 @@
/* Miscellaneous options */
#define MBEDTLS_AES_ROM_TABLES

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
2 changes: 0 additions & 2 deletions configs/config-suite-b.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,4 @@
*/
#define MBEDTLS_SSL_MAX_CONTENT_LEN 1024

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
2 changes: 0 additions & 2 deletions configs/config-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,4 @@
/* Save ROM and a few bytes of RAM by specifying our own ciphersuite list */
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
2 changes: 0 additions & 2 deletions include/mbedtls/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3688,6 +3688,4 @@
#include MBEDTLS_USER_CONFIG_FILE
#endif

#include "mbedtls/check_config.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one place where check_config.h modifies the configuration.

#if defined(_WIN32)
#if !defined(MBEDTLS_PLATFORM_C)
#error "MBEDTLS_PLATFORM_C is required on Windows"
#endif

/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
 * it would confuse config.py. */
#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
    !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
#endif

#if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
    !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
#endif
#endif /* _WIN32 */

If check_config.h is no longer included from config.h, and thus only included from library code and not from application code, this won't do. Application code and library code must have the same configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only code in the library that is functionally affected by MBEDTLS_PLATFORM_SNPRINTF_ALT or MBEDTLS_PLATFORM_VSNPRINTF_ALT is in platform.h and platform.c. Application code that is affected by these macros can be reasonably expected to include mbedtls/platform.h. Therefore I think this hack can be adapted to fit in platform.h instead.

Feature detection (version_features.c, query_config) would no longer report these alt symbols correctly. I think that an acceptable change would be to not set the symbols, but cause their effect in platform.h regardless.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fortunately, it turns out that changing the configuration is not necessary: platform.h will do its thing (activate an snprintf wrapper) regardless. #3453


#endif /* MBEDTLS_CONFIG_H */