mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Include platform.h unconditionally: second automatic part
Some source files included platform.h in a nested conditional. The previous commit "Include platform.h unconditionally: automatic part" only removed the outer conditional. This commit removes the inner conditional. This commit once again replaces most occurrences of conditional inclusion of platform.h, using the following code: ``` perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"') ``` Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
		@@ -40,9 +40,7 @@
 | 
				
			|||||||
#include "aesni.h"
 | 
					#include "aesni.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_AES_ALT)
 | 
					#if !defined(MBEDTLS_AES_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,9 +31,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_ARIA_ALT)
 | 
					#if !defined(MBEDTLS_ARIA_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_CAMELLIA_ALT)
 | 
					#if !defined(MBEDTLS_CAMELLIA_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,7 @@
 | 
				
			|||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_CHACHA20_ALT)
 | 
					#if !defined(MBEDTLS_CHACHA20_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_CHACHAPOLY_ALT)
 | 
					#if !defined(MBEDTLS_CHACHAPOLY_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,9 +36,7 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * CTR_DRBG context initialization
 | 
					 * CTR_DRBG context initialization
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,9 +33,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_DES_ALT)
 | 
					#if !defined(MBEDTLS_DES_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,9 +34,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ENTROPY_MAX_LOOP    256     /**< Maximum amount to loop before error */
 | 
					#define ENTROPY_MAX_LOOP    256     /**< Maximum amount to loop before error */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,9 +37,7 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_PLATFORM_C */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * HMAC_DRBG context initialization
 | 
					 * HMAC_DRBG context initialization
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_MD5_ALT)
 | 
					#if !defined(MBEDTLS_MD5_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,9 +39,7 @@
 | 
				
			|||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_NIST_KW_ALT)
 | 
					#if !defined(MBEDTLS_NIST_KW_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_POLY1305_ALT)
 | 
					#if !defined(MBEDTLS_POLY1305_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,9 +33,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(MBEDTLS_RIPEMD160_ALT)
 | 
					#if !defined(MBEDTLS_RIPEMD160_ALT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SHA1_VALIDATE_RET(cond)                             \
 | 
					#define SHA1_VALIDATE_RET(cond)                             \
 | 
				
			||||||
    MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA1_BAD_INPUT_DATA )
 | 
					    MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA1_BAD_INPUT_DATA )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__aarch64__)
 | 
					#if defined(__aarch64__)
 | 
				
			||||||
#  if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT) || \
 | 
					#  if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT) || \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,9 +38,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SELF_TEST)
 | 
					 | 
				
			||||||
#include "mbedtls/platform.h"
 | 
					#include "mbedtls/platform.h"
 | 
				
			||||||
#endif /* MBEDTLS_SELF_TEST */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__aarch64__)
 | 
					#if defined(__aarch64__)
 | 
				
			||||||
#  if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
 | 
					#  if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user