From 4cff10dcbfbd979d1557cc8b7e3fa2f19525deb0 Mon Sep 17 00:00:00 2001 From: Pauli Date: Fri, 1 Sep 2017 08:50:03 +1000 Subject: [PATCH] struct timeval include guards Move struct timeval includes into e_os.h (where the Windows ones were). Enaure that the include is guarded canonically. Refer #4271 Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/4312) --- apps/apps.h | 5 +---- crypto/bio/bss_dgram.c | 6 +----- crypto/ts/ts_rsp_sign.c | 7 ++----- e_os.h | 6 ++++++ ssl/d1_lib.c | 6 ------ ssl/ssl_locl.h | 7 ++----- test/ossl_shim/packeted_bio.h | 12 ++---------- 7 files changed, 14 insertions(+), 35 deletions(-) diff --git a/apps/apps.h b/apps/apps.h index c208c1999d..6984f166e8 100644 --- a/apps/apps.h +++ b/apps/apps.h @@ -10,11 +10,8 @@ #ifndef HEADER_APPS_H # define HEADER_APPS_H -# include "e_os.h" +# include "e_os.h" /* struct timeval for DTLS */ # include "internal/nelem.h" -# if defined(__unix) || defined(__unix__) -# include /* struct timeval for DTLS */ -# endif # include # include diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index 4070f205bf..f886b07333 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2005-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 @@ -13,10 +13,6 @@ #include "bio_lcl.h" #ifndef OPENSSL_NO_DGRAM -# if !defined(_WIN32) -# include -# endif - # ifndef OPENSSL_NO_SCTP # include # include diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c index 76011ada59..6569956285 100644 --- a/crypto/ts/ts_rsp_sign.c +++ b/crypto/ts/ts_rsp_sign.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-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 @@ -7,12 +7,9 @@ * https://www.openssl.org/source/license.html */ +#include "e_os.h" #include "internal/cryptlib.h" -#if defined(OPENSSL_SYS_UNIX) -# include -#endif - #include #include #include diff --git a/e_os.h b/e_os.h index c1b9350d62..e76fb43a4d 100644 --- a/e_os.h +++ b/e_os.h @@ -234,6 +234,12 @@ extern FILE *_imp___iob; # else /* The non-microsoft world */ +# if defined(OPENSSL_SYS_VXWORKS) +# include +# else +# include +# endif + # ifdef OPENSSL_SYS_VMS # define VMS 1 /* diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index 6c594a2686..d839e1ab72 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -13,12 +13,6 @@ #include #include "ssl_locl.h" -#if defined(OPENSSL_SYS_VXWORKS) -# include -#elif !defined(OPENSSL_SYS_WIN32) -# include -#endif - static void get_current_time(struct timeval *t); static int dtls1_handshake_write(SSL *s); static size_t dtls1_link_min_mtu(void); diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 7caec67d24..a0127cf6a0 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -11,16 +11,13 @@ #ifndef HEADER_SSL_LOCL_H # define HEADER_SSL_LOCL_H -# include "e_os.h" /* struct timeval for Windows */ + +# include "e_os.h" /* struct timeval for DTLS */ # include # include # include # include -# if defined(__unix) || defined(__unix__) -# include /* struct timeval for DTLS */ -# endif - # include # include # include diff --git a/test/ossl_shim/packeted_bio.h b/test/ossl_shim/packeted_bio.h index afdba1300a..9b4fb1d4d2 100644 --- a/test/ossl_shim/packeted_bio.h +++ b/test/ossl_shim/packeted_bio.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-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 @@ -10,18 +10,10 @@ #ifndef HEADER_PACKETED_BIO #define HEADER_PACKETED_BIO +#include "e_os.h" #include #include -#if defined(OPENSSL_SYS_WINDOWS) -OPENSSL_MSVC_PRAGMA(warning(push, 3)) -#include -OPENSSL_MSVC_PRAGMA(warning(pop)) -#else -#include -#endif - - // PacketedBioCreate creates a filter BIO which implements a reliable in-order // blocking datagram socket. It internally maintains a clock and honors // |BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT| based on it. -- 2.25.1