Skip to content

Commit

Permalink
Include configuration file to headers
Browse files Browse the repository at this point in the history
Add inclusion to configration file in header files,
instead of relying on other header files to include
the configuration file. This issue resolves Mbed-TLS#1371
  • Loading branch information
Ron Eldor authored and Ron Eldor committed Feb 14, 2018
1 parent 6d6c798 commit 4e89d9d
Show file tree
Hide file tree
Showing 22 changed files with 131 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
mbed TLS ChangeLog (Sorted per branch, date)

= mbed TLS x.x.x branch released xxxx-xx-xx

Changes
* Include configuration file in all header files that use configuration,
instead of relying on other header files that they include.
Inserted as an enhancement for #1371

= mbed TLS 2.7.0 branch released 2018-02-03

Security
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/aesni.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_AESNI_H
#define MBEDTLS_AESNI_H

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

#include "aes.h"

#define MBEDTLS_AESNI_AES 0x02000000u
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/asn1write.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_ASN1_WRITE_H
#define MBEDTLS_ASN1_WRITE_H

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

#include "asn1.h"

#define MBEDTLS_ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else \
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/bn_mul.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
#ifndef MBEDTLS_BN_MUL_H
#define MBEDTLS_BN_MUL_H

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

#include "bignum.h"

#if defined(MBEDTLS_HAVE_ASM)
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ccm.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#ifndef MBEDTLS_CCM_H
#define MBEDTLS_CCM_H

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

#include "cipher.h"

#define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D /**< Bad input parameters to the function. */
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/certs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_CERTS_H
#define MBEDTLS_CERTS_H

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

#include <stddef.h>

#ifdef __cplusplus
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/cmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#ifndef MBEDTLS_CMAC_H
#define MBEDTLS_CMAC_H

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

#include "mbedtls/cipher.h"

#ifdef __cplusplus
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/compat-1.3.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
* This file is part of mbed TLS (https://tls.mbed.org)
*/

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

#if ! defined(MBEDTLS_DEPRECATED_REMOVED)

#if defined(MBEDTLS_DEPRECATED_WARNING)
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ctr_drbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#ifndef MBEDTLS_CTR_DRBG_H
#define MBEDTLS_CTR_DRBG_H

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

#include "aes.h"

#if defined(MBEDTLS_THREADING_C)
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#ifndef MBEDTLS_ECDSA_H
#define MBEDTLS_ECDSA_H

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

#include "ecp.h"
#include "md.h"

Expand Down
5 changes: 5 additions & 0 deletions include/mbedtls/ecjpake.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
* The payloads are serialized in a way suitable for use in TLS, but could
* also be use outside TLS.
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif

#include "ecp.h"
#include "md.h"
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ecp.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_ECP_H
#define MBEDTLS_ECP_H

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

#include "bignum.h"

/*
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ecp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
#ifndef MBEDTLS_ECP_INTERNAL_H
#define MBEDTLS_ECP_INTERNAL_H

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

#if defined(MBEDTLS_ECP_INTERNAL_ALT)

/**
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/gcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#ifndef MBEDTLS_GCM_H
#define MBEDTLS_GCM_H

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

#include "cipher.h"

#include <stdint.h>
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/hmac_drbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_HMAC_DRBG_H
#define MBEDTLS_HMAC_DRBG_H

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

#include "md.h"

#if defined(MBEDTLS_THREADING_C)
Expand Down
5 changes: 5 additions & 0 deletions include/mbedtls/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif

#if !defined(MBEDTLS_DEPRECATED_REMOVED)
#include "mbedtls/net_sockets.h"
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/padlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#ifndef MBEDTLS_PADLOCK_H
#define MBEDTLS_PADLOCK_H

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

#include "aes.h"

#define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/pem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_PEM_H
#define MBEDTLS_PEM_H

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

#include <stddef.h>

/**
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ssl_ciphersuites.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_SSL_CIPHERSUITES_H
#define MBEDTLS_SSL_CIPHERSUITES_H

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

#include "pk.h"
#include "cipher.h"
#include "md.h"
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ssl_cookie.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_SSL_COOKIE_H
#define MBEDTLS_SSL_COOKIE_H

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

#include "ssl.h"

#if defined(MBEDTLS_THREADING_C)
Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ssl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_SSL_INTERNAL_H
#define MBEDTLS_SSL_INTERNAL_H

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

#include "ssl.h"
#include "cipher.h"

Expand Down
6 changes: 6 additions & 0 deletions include/mbedtls/ssl_ticket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#ifndef MBEDTLS_SSL_TICKET_H
#define MBEDTLS_SSL_TICKET_H

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

/*
* This implementation of the session ticket callbacks includes key
* management, rotating the keys periodically in order to preserve forward
Expand Down

0 comments on commit 4e89d9d

Please sign in to comment.