some system-specific adjustments for RNG routines
move some system-specific seed-related stuff from hacklib.c to a system-specific source file and #define SYS_RANDOM_SEED to utilize it during build. Windows changes for random seed generation using crypto next gen (CNG) api routines. Corresponding vms changes due to disentangling of VMS and unix when the unix seed bits got moved (untested).
This commit is contained in:
@@ -2106,6 +2106,7 @@ E void FDECL(genl_outrip, (winid, int, time_t));
|
||||
|
||||
#ifdef USE_ISAAC64
|
||||
E void FDECL(init_isaac64, (unsigned long));
|
||||
E long NDECL(nhrand);
|
||||
#endif
|
||||
E int FDECL(rn2, (int));
|
||||
E int FDECL(rnl, (int));
|
||||
|
||||
@@ -8,37 +8,46 @@
|
||||
#define INTEGER_H
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ >= 199101L
|
||||
|
||||
/* The compiler claims to conform to C99. Use stdint.h */
|
||||
#include <stdint.h>
|
||||
#define SKIP_STDINT_WORKAROUND
|
||||
#else
|
||||
# if defined(HAS_STDINT_H)
|
||||
/* Some compilers have stdint.h but don't conform to all of C99. */
|
||||
#include <stdint.h>
|
||||
#define SKIP_STDINT_WORKAROUND
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SKIP_STDINT_WORKAROUND /* !C99 */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
#if defined(__WATCOMC__) && !defined(__386__)
|
||||
/* Open Watcom providing a 16 bit build for MS-DOS or OS/2 */
|
||||
/* int is 16 bits; use long for 32 bits */
|
||||
typedef long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
#else
|
||||
/* Otherwise, assume either a 32- or 64-bit compiler */
|
||||
/* long may be 64 bits; use int for 32 bits */
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#endif
|
||||
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
#endif /* !C99 */
|
||||
|
||||
/* Provide uint8, int16, uint16, int32, uint32, int64 and uint64 */
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
#else /* !C99 */
|
||||
|
||||
/* Provide uint8, int16, uint16, int32 and uint32 */
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
|
||||
#if defined(__WATCOMC__) && !defined(__386__)
|
||||
/* Open Watcom providing a 16 bit build for MS-DOS or OS/2 */
|
||||
/* int is 16 bits; use long for 32 bits */
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
#else
|
||||
/* Otherwise, assume either a 32- or 64-bit compiler */
|
||||
/* long may be 64 bits; use int for 32 bits */
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
typedef unsigned long uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
#endif /* !C99 */
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
#endif /* INTEGER_H */
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
/* #define SHELL */ /* nt use of pcsys routines caused a hang */
|
||||
|
||||
#define RANDOM /* have Berkeley random(3) */
|
||||
/* #define RANDOM */ /* have Berkeley random(3) */
|
||||
#define USE_ISAAC64
|
||||
|
||||
#define TEXTCOLOR /* Color text */
|
||||
|
||||
#define EXEPATH /* Allow .exe location to be used as HACKDIR */
|
||||
@@ -25,8 +27,7 @@
|
||||
game */
|
||||
|
||||
#define SYSCF /* Use a global configuration */
|
||||
#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration \
|
||||
*/
|
||||
#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */
|
||||
|
||||
#define DUMPLOG /* Enable dumplog files */
|
||||
/*#define DUMPLOG_FILE "nethack-%n-%d.log"*/
|
||||
@@ -35,9 +36,9 @@
|
||||
#define USER_SOUNDS
|
||||
|
||||
/*#define CHANGE_COLOR*/ /* allow palette changes */
|
||||
#define SELECTSAVED /* Provide menu of saved games to choose from at start \
|
||||
*/
|
||||
#define SELECTSAVED /* Provide menu of saved games to choose from at start */
|
||||
|
||||
#define SYS_RANDOM_SEED /* Use random seed derived from CNG */
|
||||
/*
|
||||
* -----------------------------------------------------------------
|
||||
* The remaining code shouldn't need modification.
|
||||
@@ -131,6 +132,7 @@ extern void FDECL(interject, (int));
|
||||
/* suppress a warning in cppregex.cpp */
|
||||
#pragma warning(disable : 4101) /* unreferenced local variable */
|
||||
#endif
|
||||
#define HAS_STDINT_H /* force include of stdint.h in integer.h */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* The following is needed for prototypes of certain functions */
|
||||
|
||||
@@ -420,6 +420,7 @@
|
||||
# define DEV_RANDOM "/dev/random"
|
||||
# endif
|
||||
#endif
|
||||
#define SYS_RANDOM_SEED
|
||||
|
||||
#endif /* UNIXCONF_H */
|
||||
#endif /* UNIX */
|
||||
|
||||
@@ -255,6 +255,7 @@ typedef __mode_t mode_t;
|
||||
#else
|
||||
#define Rand() rand()
|
||||
#endif
|
||||
#define SYS_RANDOM_SEED
|
||||
|
||||
#ifndef __GNUC__
|
||||
#ifndef bcopy
|
||||
|
||||
Reference in New Issue
Block a user