From 07016a8a3174db5caf07182930533cf88ad9b0ad Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 24 Aug 2017 09:05:07 +1000 Subject: [PATCH] Move e_os.h to be the very first include. cryptilib.h is the second. Reviewed-by: Andy Polyakov Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4188) --- apps/apps.h | 2 +- apps/s_client.c | 2 +- crypto/bio/bss_bio.c | 5 ++--- crypto/blake2/blake2b.c | 3 +-- crypto/blake2/blake2s.c | 3 +-- crypto/conf/conf_api.c | 2 +- crypto/conf/conf_lib.c | 2 +- crypto/conf/conf_mod.c | 3 +-- crypto/cryptlib.c | 2 +- crypto/des/cfb64ede.c | 1 - crypto/dllmain.c | 2 +- crypto/engine/eng_devcrypto.c | 3 +-- crypto/engine/eng_init.c | 2 +- crypto/engine/eng_lib.c | 2 +- crypto/engine/tb_asnmth.c | 2 +- crypto/init.c | 2 +- crypto/mem.c | 6 +++--- crypto/mem_sec.c | 2 +- crypto/o_dir.c | 2 +- crypto/o_str.c | 2 +- crypto/ocsp/ocsp_ht.c | 2 +- crypto/rand/rand_unix.c | 3 +-- crypto/store/loader_file.c | 3 +-- crypto/store/store_lib.c | 4 +--- crypto/ui/ui_openssl.c | 2 +- crypto/x509/by_dir.c | 5 ++--- crypto/x509v3/v3_ncons.c | 3 +-- crypto/x509v3/v3_tlsf.c | 4 ++-- crypto/x509v3/v3_utl.c | 4 ++-- e_os.h | 1 + ssl/d1_lib.c | 2 +- ssl/s3_lib.c | 1 - ssl/ssl_cert.c | 4 ---- ssl/ssl_locl.h | 2 +- ssl/statem/statem.c | 2 +- test/bntest.c | 2 +- test/ssl_test_ctx.c | 2 +- test/ssltest_old.c | 4 ++-- test/v3nametest.c | 2 +- 39 files changed, 43 insertions(+), 59 deletions(-) diff --git a/apps/apps.h b/apps/apps.h index bbc9a5ad8f..c208c1999d 100644 --- a/apps/apps.h +++ b/apps/apps.h @@ -10,8 +10,8 @@ #ifndef HEADER_APPS_H # define HEADER_APPS_H -# include "internal/nelem.h" # include "e_os.h" +# include "internal/nelem.h" # if defined(__unix) || defined(__unix__) # include /* struct timeval for DTLS */ # endif diff --git a/apps/s_client.c b/apps/s_client.c index 5f7b31c9dc..5a4a2f65e7 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -8,12 +8,12 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include #include #include -#include "e_os.h" #include #ifndef OPENSSL_NO_SOCK diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 9fa47600c9..e34382c557 100644 --- a/crypto/bio/bss_bio.c +++ b/crypto/bio/bss_bio.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -15,6 +15,7 @@ * See ssl/ssltest.c for some hints on how this can be used. */ +#include "e_os.h" #include #include #include @@ -24,8 +25,6 @@ #include #include -#include "e_os.h" - static int bio_new(BIO *bio); static int bio_free(BIO *bio); static int bio_read(BIO *bio, char *buf, int size); diff --git a/crypto/blake2/blake2b.c b/crypto/blake2/blake2b.c index e77bd9ac16..829ba5b50a 100644 --- a/crypto/blake2/blake2b.c +++ b/crypto/blake2/blake2b.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,7 +17,6 @@ #include #include #include -#include "e_os.h" #include "blake2_locl.h" #include "blake2_impl.h" diff --git a/crypto/blake2/blake2s.c b/crypto/blake2/blake2s.c index 7451b14f5a..8211374d12 100644 --- a/crypto/blake2/blake2s.c +++ b/crypto/blake2/blake2s.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,7 +17,6 @@ #include #include #include -#include "e_os.h" #include "blake2_locl.h" #include "blake2_impl.h" diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index 6026dca928..6f8947df2c 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -9,11 +9,11 @@ /* Part of the code in here was originally in conf.c, which is now removed */ +#include "e_os.h" #include #include #include #include -#include "e_os.h" static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf); static void value_free_stack_doall(CONF_VALUE *a); diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index 74759c56d5..06bb3f7ff1 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -7,6 +7,7 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include "internal/conf.h" @@ -15,7 +16,6 @@ #include #include #include -#include "e_os.h" static CONF_METHOD *default_CONF_method = NULL; diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index da591cba63..7622d8e1f3 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -7,11 +7,10 @@ * https://www.openssl.org/source/license.html */ +#include "internal/cryptlib.h" #include #include #include -#include "internal/cryptlib.h" -#include "e_os.h" #include "internal/conf.h" #include "internal/dso.h" #include diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index bafcaab966..6e45b0d8ba 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -8,8 +8,8 @@ * https://www.openssl.org/source/license.html */ -#include "internal/cryptlib_int.h" #include "e_os.h" +#include "internal/cryptlib_int.h" #include #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c index 7017fd96ff..21943f6143 100644 --- a/crypto/des/cfb64ede.c +++ b/crypto/des/cfb64ede.c @@ -8,7 +8,6 @@ */ #include "des_locl.h" -#include "e_os.h" /* * The input and output encrypted as though 64bit cfb mode is being used. diff --git a/crypto/dllmain.c b/crypto/dllmain.c index 376a34165a..b0459c2e73 100644 --- a/crypto/dllmain.c +++ b/crypto/dllmain.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include "internal/cryptlib_int.h" #include "e_os.h" +#include "internal/cryptlib_int.h" #if defined(_WIN32) || defined(__CYGWIN__) # ifdef __CYGWIN__ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c index 19781b8ab0..f2196b4e54 100644 --- a/crypto/engine/eng_devcrypto.c +++ b/crypto/engine/eng_devcrypto.c @@ -7,6 +7,7 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include @@ -15,8 +16,6 @@ #include #include -#include "e_os.h" - #include #include #include diff --git a/crypto/engine/eng_init.c b/crypto/engine/eng_init.c index 3d5eaa14e4..7c235fc472 100644 --- a/crypto/engine/eng_init.c +++ b/crypto/engine/eng_init.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include "eng_int.h" #include "e_os.h" +#include "eng_int.h" /* * Initialise a engine type for use (or up its functional reference count if diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index 51998340a9..c060a5d6ac 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include "eng_int.h" #include "e_os.h" +#include "eng_int.h" #include #include "internal/refcount.h" diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index ca3727e902..bc6e91ccab 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include "eng_int.h" #include "e_os.h" +#include "eng_int.h" #include #include "internal/asn1_int.h" diff --git a/crypto/init.c b/crypto/init.c index fa68a29b2c..074e683cc0 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -7,6 +7,7 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include "internal/cryptlib_int.h" #include #include "internal/rand_int.h" @@ -25,7 +26,6 @@ #include "internal/thread_once.h" #include "internal/dso.h" #include "internal/store.h" -#include "e_os.h" static int stopped = 0; diff --git a/crypto/mem.c b/crypto/mem.c index 2713b833c0..c171ae486c 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -7,13 +7,13 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" +#include "internal/cryptlib.h" +#include "internal/cryptlib_int.h" #include #include #include #include -#include "e_os.h" -#include "internal/cryptlib.h" -#include "internal/cryptlib_int.h" #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # include #endif diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c index 703ddad5e5..f8470249c3 100644 --- a/crypto/mem_sec.c +++ b/crypto/mem_sec.c @@ -15,8 +15,8 @@ * For details on that implementation, see below (look for uppercase * "SECURE HEAP IMPLEMENTATION"). */ -#include #include "e_os.h" +#include #include diff --git a/crypto/o_dir.c b/crypto/o_dir.c index 459ce9c1e1..fca9c75e05 100644 --- a/crypto/o_dir.c +++ b/crypto/o_dir.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include #include "e_os.h" +#include /* * The routines really come from the Levitte Programming, so to make life diff --git a/crypto/o_str.c b/crypto/o_str.c index be130ce804..cf098fc90a 100644 --- a/crypto/o_str.c +++ b/crypto/o_str.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include #include "e_os.h" +#include #include #include "internal/cryptlib.h" #include "internal/o_str.h" diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c index ef84a2d4c9..42c3686431 100644 --- a/crypto/ocsp/ocsp_ht.c +++ b/crypto/ocsp/ocsp_ht.c @@ -7,11 +7,11 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include "internal/ctype.h" #include -#include "e_os.h" #include #include #include diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index 4f01e8aad5..08ea55fbb9 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -7,9 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include - #include "e_os.h" +#include #include "internal/cryptlib.h" #include #include "rand_lcl.h" diff --git a/crypto/store/loader_file.c b/crypto/store/loader_file.c index f6cb928ae3..1c794ef826 100644 --- a/crypto/store/loader_file.c +++ b/crypto/store/loader_file.c @@ -7,6 +7,7 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include @@ -29,8 +30,6 @@ #include "internal/store_int.h" #include "store_locl.h" -#include "e_os.h" - #ifdef _WIN32 # define stat _stat #endif diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c index 6f789eb79c..2cc247d12e 100644 --- a/crypto/store/store_lib.c +++ b/crypto/store/store_lib.c @@ -7,11 +7,9 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include - -#include "e_os.h" - #include #include #include diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c index cff1a840ab..3b74e6b7e4 100644 --- a/crypto/ui/ui_openssl.c +++ b/crypto/ui/ui_openssl.c @@ -7,10 +7,10 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include -#include "e_os.h" #ifndef OPENSSL_NO_UI_CONSOLE /* diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 335c3b3dda..8476f0025e 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -7,14 +7,13 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" +#include "internal/cryptlib.h" #include #include #include #include -#include "internal/cryptlib.h" -#include "e_os.h" - #ifndef OPENSSL_NO_POSIX_IO # include #endif diff --git a/crypto/x509v3/v3_ncons.c b/crypto/x509v3/v3_ncons.c index 3b9145b15e..7731bacd04 100644 --- a/crypto/x509v3/v3_ncons.c +++ b/crypto/x509v3/v3_ncons.c @@ -8,9 +8,8 @@ */ #include "e_os.h" /* for strncasecmp */ -#include #include "internal/cryptlib.h" -#include "e_os.h" +#include #include "internal/asn1_int.h" #include #include diff --git a/crypto/x509v3/v3_tlsf.c b/crypto/x509v3/v3_tlsf.c index 8e5daf9d15..5f2d5d2cf8 100644 --- a/crypto/x509v3/v3_tlsf.c +++ b/crypto/x509v3/v3_tlsf.c @@ -7,9 +7,9 @@ * https://www.openssl.org/source/license.html */ -#include -#include "internal/cryptlib.h" #include "e_os.h" +#include "internal/cryptlib.h" +#include #include "internal/o_str.h" #include #include diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index b58fac5fd0..8bba5a67d2 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -9,10 +9,10 @@ /* X509 v3 extension utilities */ +#include "e_os.h" +#include "internal/cryptlib.h" #include #include "internal/ctype.h" -#include "internal/cryptlib.h" -#include "e_os.h" #include #include #include "internal/x509_int.h" diff --git a/e_os.h b/e_os.h index 14089f5655..bf317ce6c0 100644 --- a/e_os.h +++ b/e_os.h @@ -10,6 +10,7 @@ #ifndef HEADER_E_OS_H # define HEADER_E_OS_H +# include # include # include diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index e4abe92ac1..6c594a2686 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -7,11 +7,11 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include #include #include #include "ssl_locl.h" -#include "e_os.h" #if defined(OPENSSL_SYS_VXWORKS) # include diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 1a5c3f76b8..c9371af9c9 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -13,7 +13,6 @@ #include #include "internal/nelem.h" #include "ssl_locl.h" -#include "e_os.h" #include #include #include diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index bbffce0f93..ba5fb653fe 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -12,10 +12,6 @@ #include #include "internal/nelem.h" -#ifndef NO_SYS_TYPES_H -# include -#endif - #include "internal/o_dir.h" #include #include diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 72f48752e9..f3fc5bc25a 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -11,12 +11,12 @@ #ifndef HEADER_SSL_LOCL_H # define HEADER_SSL_LOCL_H +# include "e_os.h" /* struct timeval for Windows */ # include # include # include # include -# include "e_os.h" /* struct timeval for Windows */ # if defined(__unix) || defined(__unix__) # include /* struct timeval for DTLS */ # endif diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index fd48f666c0..d171ece2a0 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -7,8 +7,8 @@ * https://www.openssl.org/source/license.html */ -#include #include "e_os.h" +#include #include "../ssl_locl.h" #include "statem_locl.h" diff --git a/test/bntest.c b/test/bntest.c index 667cba67a7..6f1f5d7cd9 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -6,6 +6,7 @@ * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ +#include "../e_os.h" #include #include #include @@ -13,7 +14,6 @@ #include #include "internal/nelem.h" -#include "../e_os.h" #include "internal/numbers.h" #include #include diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c index d4642e78ac..0be68c7e3c 100644 --- a/test/ssl_test_ctx.c +++ b/test/ssl_test_ctx.c @@ -7,13 +7,13 @@ * https://www.openssl.org/source/license.html */ +#include "../e_os.h" #include #include #include #include "internal/nelem.h" -#include "../e_os.h" #include "ssl_test_ctx.h" #include "testutil.h" diff --git a/test/ssltest_old.c b/test/ssltest_old.c index faabc2dff0..ebe052f55c 100644 --- a/test/ssltest_old.c +++ b/test/ssltest_old.c @@ -9,6 +9,8 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" + /* Or gethostname won't be declared properly on Linux and GNU platforms. */ #ifndef _BSD_SOURCE # define _BSD_SOURCE 1 @@ -27,8 +29,6 @@ #include "internal/nelem.h" -#include "e_os.h" - #ifdef OPENSSL_SYS_VMS /* * Or isascii won't be declared properly on VMS (at least with DECompHP C). diff --git a/test/v3nametest.c b/test/v3nametest.c index a4ba775b5c..0d55f81ba3 100644 --- a/test/v3nametest.c +++ b/test/v3nametest.c @@ -7,9 +7,9 @@ * https://www.openssl.org/source/license.html */ +#include "../e_os.h" #include #include "internal/nelem.h" -#include "../e_os.h" #include #include #include "testutil.h" -- 2.34.1