Skip to content

Commit

Permalink
Move preprocessor logic to build_info.h
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Szépkúti <[email protected]>
  • Loading branch information
bensze01 committed Jun 28, 2021
1 parent c662b36 commit c5c9eb4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 65 deletions.
6 changes: 0 additions & 6 deletions configs/config-ccm-psk-tls1_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*
* See README.txt for usage instructions.
*/
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* System support */
//#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */
Expand Down Expand Up @@ -85,7 +83,3 @@
*/
#define MBEDTLS_SSL_IN_CONTENT_LEN 1024
#define MBEDTLS_SSL_OUT_CONTENT_LEN 1024

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
7 changes: 0 additions & 7 deletions configs/config-no-entropy.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
* See README.txt for usage instructions.
*/

#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* System support */
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
Expand Down Expand Up @@ -86,7 +83,3 @@

/* Miscellaneous options */
#define MBEDTLS_AES_ROM_TABLES

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
7 changes: 0 additions & 7 deletions configs/config-suite-b.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
* See README.txt for usage instructions.
*/

#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* System support */
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
Expand Down Expand Up @@ -113,7 +110,3 @@
*/
#define MBEDTLS_SSL_IN_CONTENT_LEN 1024
#define MBEDTLS_SSL_OUT_CONTENT_LEN 1024

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
9 changes: 0 additions & 9 deletions configs/config-symmetric-only.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
* limitations under the License.
*/

#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* System support */
//#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
Expand Down Expand Up @@ -90,9 +87,3 @@
//#define MBEDTLS_THREADING_C
#define MBEDTLS_TIMING_C
#define MBEDTLS_VERSION_C

#include "mbedtls/config_psa.h"

#include "check_config.h"

#endif /* MBEDTLS_CONFIG_H */
7 changes: 0 additions & 7 deletions configs/config-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
* See README.txt for usage instructions.
*/

#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* System support */
#define MBEDTLS_HAVE_ASM

Expand Down Expand Up @@ -89,7 +86,3 @@

/* 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 */
19 changes: 19 additions & 0 deletions include/mbedtls/build_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,29 @@
#ifndef MBEDTLS_BUILD_INFO_H
#define MBEDTLS_BUILD_INFO_H

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE 1
#endif

#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif

/* Target and application specific configurations
*
* Allow user to override any previous default.
*
*/
#if defined(MBEDTLS_USER_CONFIG_FILE)
#include MBEDTLS_USER_CONFIG_FILE
#endif

#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
#include "mbedtls/config_psa.h"
#endif

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_BUILD_INFO_H */
24 changes: 0 additions & 24 deletions include/mbedtls/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
* limitations under the License.
*/

#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE 1
#endif

/**
* \name SECTION: System support
*
Expand Down Expand Up @@ -3263,20 +3256,3 @@
//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED

/* \} name SECTION: Customisation configuration options */

/* Target and application specific configurations
*
* Allow user to override any previous default.
*
*/
#if defined(MBEDTLS_USER_CONFIG_FILE)
#include MBEDTLS_USER_CONFIG_FILE
#endif

#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
#include "mbedtls/config_psa.h"
#endif

#include "mbedtls/check_config.h"

#endif /* MBEDTLS_CONFIG_H */
5 changes: 0 additions & 5 deletions tests/configs/config-wrapper-malloc-0-null.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
* limitations under the License.
*/

#ifndef MBEDTLS_CONFIG_H
/* Don't #define MBEDTLS_CONFIG_H, let config.h do it. */

#include "mbedtls/config.h"

#include <stdlib.h>
Expand All @@ -33,5 +30,3 @@ static inline void *custom_calloc( size_t nmemb, size_t size )

#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc

#endif /* MBEDTLS_CONFIG_H */

0 comments on commit c5c9eb4

Please sign in to comment.