diff --git a/crypto/cast/cast_lcl.h b/crypto/cast/cast_lcl.h
index f11e3b3ee..37f41cc6a 100644
--- a/crypto/cast/cast_lcl.h
+++ b/crypto/cast/cast_lcl.h
@@ -56,13 +56,14 @@
  * [including the GNU Public Licence.]
  */
 
+
+#include "e_os.h"
+
 #ifdef OPENSSL_SYS_WIN32
 #include <stdlib.h>
 #endif
 
 
-#include "e_os.h" /* OPENSSL_EXTERN */
-
 #ifdef OPENSSL_BUILD_SHLIBCRYPTO
 # undef OPENSSL_EXTERN
 # define OPENSSL_EXTERN OPENSSL_EXPORT
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index a382d9377..dc54e5fa1 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -54,6 +54,7 @@
  *
  */
 
+#include <openssl/e_os2.h>
 #include <openssl/rand.h>
 
 /*