Put sys-specific files in build.info
authorRich Salz <rsalz@akamai.com>
Thu, 5 Mar 2020 17:58:00 +0000 (12:58 -0500)
committerRichard Levitte <levitte@openssl.org>
Thu, 16 Apr 2020 11:52:23 +0000 (13:52 +0200)
Don't wrap whole files in if[n]def, test in build.info if they
should be compiled.  rand_win isn't done as there are multiple
ways to say "this is windows."

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11263)

crypto/rand/build.info
crypto/rand/rand_vms.c
crypto/rand/rand_vxworks.c

index 80f5710..c4e7476 100644 (file)
@@ -1,10 +1,16 @@
 LIBS=../../libcrypto
 
-$COMMON=rand_lib.c rand_crng_test.c rand_win.c rand_unix.c  rand_vms.c \
-        drbg_lib.c drbg_ctr.c rand_vxworks.c drbg_hash.c drbg_hmac.c
+$COMMON=rand_lib.c rand_crng_test.c rand_unix.c rand_win.c \
+        drbg_lib.c drbg_ctr.c drbg_hash.c drbg_hmac.c
 IF[{- !$disabled{'egd'} -}]
   $COMMON=$COMMON rand_egd.c
 ENDIF
+IF[{- $config{target} =~ /vxworks/i -}]
+  $COMMON=$COMMON rand_vxworks.c
+ENDIF
+IF[{- $config{target} =~ /vms/i -}]
+  $COMMON=$COMMON rand_vms.c
+ENDIF
 
 SOURCE[../../libcrypto]=$COMMON randfile.c rand_err.c
 SOURCE[../../providers/libfips.a]=$COMMON
index 13d913b..d798f55 100644 (file)
@@ -9,34 +9,33 @@
 
 #include "e_os.h"
 
-#if defined(OPENSSL_SYS_VMS)
-# define __NEW_STARLET 1         /* New starlet definitions since VMS 7.0 */
-# include <unistd.h>
-# include "internal/cryptlib.h"
-# include <openssl/rand.h>
-# include "crypto/rand.h"
-# include "rand_local.h"
-# include <descrip.h>
-# include <dvidef.h>
-# include <jpidef.h>
-# include <rmidef.h>
-# include <syidef.h>
-# include <ssdef.h>
-# include <starlet.h>
-# include <efndef.h>
-# include <gen64def.h>
-# include <iosbdef.h>
-# include <iledef.h>
-# include <lib$routines.h>
-# ifdef __DECC
-#  pragma message disable DOLLARID
-# endif
-
-# include <dlfcn.h>              /* SYS$GET_ENTROPY presence */
-
-# ifndef OPENSSL_RAND_SEED_OS
-#  error "Unsupported seeding method configured; must be os"
-# endif
+#define __NEW_STARLET 1         /* New starlet definitions since VMS 7.0 */
+#include <unistd.h>
+#include "internal/cryptlib.h"
+#include <openssl/rand.h>
+#include "crypto/rand.h"
+#include "rand_local.h"
+#include <descrip.h>
+#include <dvidef.h>
+#include <jpidef.h>
+#include <rmidef.h>
+#include <syidef.h>
+#include <ssdef.h>
+#include <starlet.h>
+#include <efndef.h>
+#include <gen64def.h>
+#include <iosbdef.h>
+#include <iledef.h>
+#include <lib$routines.h>
+#ifdef __DECC
+# pragma message disable DOLLARID
+#endif
+
+#include <dlfcn.h>              /* SYS$GET_ENTROPY presence */
+
+#ifndef OPENSSL_RAND_SEED_OS
+# error "Unsupported seeding method configured; must be os"
+#endif
 
 /*
  * DATA COLLECTION METHOD
  */
 
 /* We need to make sure we have the right size pointer in some cases */
-# if __INITIAL_POINTER_SIZE == 64
-#  pragma pointer_size save
-#  pragma pointer_size 32
-# endif
+#if __INITIAL_POINTER_SIZE == 64
+# pragma pointer_size save
+# pragma pointer_size 32
+#endif
 typedef uint32_t *uint32_t__ptr32;
-# if __INITIAL_POINTER_SIZE == 64
-#  pragma pointer_size restore
-# endif
+#if __INITIAL_POINTER_SIZE == 64
+# pragma pointer_size restore
+#endif
 
 struct item_st {
     short length, code;         /* length is number of bytes */
@@ -613,5 +612,3 @@ void rand_pool_cleanup(void)
 void rand_pool_keep_random_devices_open(int keep)
 {
 }
-
-#endif
index d674698..bb0dcb8 100644 (file)
@@ -9,35 +9,32 @@
 
 #include <openssl/opensslconf.h>
 
-#ifndef OPENSSL_SYS_VXWORKS
-NON_EMPTY_TRANSLATION_UNIT
-#else
-# include <openssl/rand.h>
-# include "rand_local.h"
-# include "crypto/rand.h"
-# include "internal/cryptlib.h"
-# include <version.h>
-# include <taskLib.h>
-
-# if defined(OPENSSL_RAND_SEED_NONE)
+#include <openssl/rand.h>
+#include "rand_local.h"
+#include "crypto/rand.h"
+#include "internal/cryptlib.h"
+#include <version.h>
+#include <taskLib.h>
+
+#if defined(OPENSSL_RAND_SEED_NONE)
 /* none means none */
-#  undef OPENSSL_RAND_SEED_OS
-# endif
+# undef OPENSSL_RAND_SEED_OS
+#endif
 
-# if defined(OPENSSL_RAND_SEED_OS)
-#  if _WRS_VXWORKS_MAJOR >= 7
-#    define RAND_SEED_VXRANDLIB
-#  else
-#    error "VxWorks <7 only support RAND_SEED_NONE"
-#  endif
+#if defined(OPENSSL_RAND_SEED_OS)
+# if _WRS_VXWORKS_MAJOR >= 7
+#   define RAND_SEED_VXRANDLIB
+# else
+#   error "VxWorks <7 only support RAND_SEED_NONE"
 # endif
+#endif
 
-# if defined(RAND_SEED_VXRANDLIB)
-#  include <randomNumGen.h>
-# endif
+#if defined(RAND_SEED_VXRANDLIB)
+# include <randomNumGen.h>
+#endif
 
 /* Macro to convert two thirty two bit values into a sixty four bit one */
-# define TWO32TO64(a, b) ((((uint64_t)(a)) << 32) + (b))
+#define TWO32TO64(a, b) ((((uint64_t)(a)) << 32) + (b))
 
 static uint64_t get_time_stamp(void)
 {
@@ -122,7 +119,7 @@ int rand_pool_add_nonce_data(RAND_POOL *pool)
 
 size_t rand_pool_acquire_entropy(RAND_POOL *pool)
 {
-# if defined(RAND_SEED_VXRANDLIB)
+#if defined(RAND_SEED_VXRANDLIB)
     /* vxRandLib based entropy method */
     size_t bytes_needed;
 
@@ -159,13 +156,11 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
         }
     }
     return rand_pool_entropy_available(pool);
-# else
+#else
     /*
      * SEED_NONE means none, without randlib we dont have entropy and
      * rely on it being added externally
      */
     return rand_pool_entropy_available(pool);
-# endif /* defined(RAND_SEED_VXRANDLIB) */
+#endif /* defined(RAND_SEED_VXRANDLIB) */
 }
-
-#endif /* OPENSSL_SYS_VXWORKS */