diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-22 21:07:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-22 21:07:05 +0000 |
commit | 01ba575a5c837cc682eeec39e1170084766348b4 (patch) | |
tree | 2845395bea77d53f01348c8d3308c0a5db4ffbab /gnu/usr.sbin | |
parent | 4cb8c57181aba96d3b1e0e1a76cdec98ecac3b3a (diff) |
Sendmail didn't buy back the arc4random() changes so just use
srandomdev() which seeds itself from arc4random(). Sendmail doesn't
really need crypto-strength random numbers.
Diffstat (limited to 'gnu/usr.sbin')
-rw-r--r-- | gnu/usr.sbin/sendmail/sendmail/conf.c | 19 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/sendmail/conf.h | 25 |
2 files changed, 15 insertions, 29 deletions
diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.c b/gnu/usr.sbin/sendmail/sendmail/conf.c index 7d92d7235e6..61df3c73013 100644 --- a/gnu/usr.sbin/sendmail/sendmail/conf.c +++ b/gnu/usr.sbin/sendmail/sendmail/conf.c @@ -5153,12 +5153,9 @@ get_num_procs_online() void seed_random() { -#if HASARC4RANDOM - arc4random_stir(); -#else /* HASARC4RANDOM */ -# if HASSRANDOMDEV +#if HASSRANDOMDEV srandomdev(); -# else /* HASSRANDOMDEV */ +#else /* HASSRANDOMDEV */ long seed; struct timeval t; @@ -5166,13 +5163,12 @@ seed_random() if (gettimeofday(&t, NULL) >= 0) seed += t.tv_sec + t.tv_usec; -# if HASRANDOM +# if HASRANDOM (void) srandom(seed); -# else /* HASRANDOM */ +# else /* HASRANDOM */ (void) srand((unsigned int) seed); -# endif /* HASRANDOM */ -# endif /* HASSRANDOMDEV */ -#endif /* HASARC4RANDOM */ +# endif /* HASRANDOM */ +#endif /* HASSRANDOMDEV */ } /* ** SM_SYSLOG -- syslog wrapper to keep messages under SYSLOG_BUFSIZE @@ -5508,9 +5504,6 @@ char *OsCompileOptions[] = #if FAST_PID_RECYCLE "FAST_PID_RECYCLE", #endif /* FAST_PID_RECYCLE */ -#if HASARC4RANDOM - "HASARC4RANDOM", -#endif /* HASARC4RANDOM */ #if HASFCHOWN "HASFCHOWN", #endif /* HASFCHOWN */ diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.h b/gnu/usr.sbin/sendmail/sendmail/conf.h index d3e8de743b9..ab02c1a04f2 100644 --- a/gnu/usr.sbin/sendmail/sendmail/conf.h +++ b/gnu/usr.sbin/sendmail/sendmail/conf.h @@ -954,9 +954,6 @@ typedef int pid_t; # if __FreeBSD_version >= 222000 /* 2.2.2-release and later */ # define HASSETUSERCONTEXT 1 /* BSDI-style login classes */ # endif /* __FreeBSD_version >= 222000 */ -# if __FreeBSD_version >= 226000 /* 2.2.6-release and later */ -# define HASARC4RANDOM 1 /* has arc4random(3) function */ -# endif /* __FreeBSD_version >= 226000 */ # if __FreeBSD_version >= 330000 /* 3.3.0-release and later */ # ifndef HASSTRL # define HASSTRL 1 /* has strlc{py,at}(3) functions */ @@ -974,7 +971,7 @@ typedef int pid_t; # undef SPT_TYPE # define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */ # define HASSETLOGIN 1 /* has setlogin(2) */ -# define HASARC4RANDOM 1 /* has arc4random(3) function */ +# define HASSRANDOMDEV 1 /* has srandomdev(3) */ # if OpenBSD < 199912 # define HASSTRL 0 /* strlcat(3) is broken in 2.5 and earlier */ # else /* OpenBSD < 199912 */ @@ -2679,18 +2676,14 @@ typedef void (*sigfunc_t) __P((int)); /* random routine -- set above using #ifdef _osname_ or in Makefile */ -#if HASARC4RANDOM -# define get_random() (arc4random() & 0x7fffffff) -#else -# if HASRANDOM -# define get_random() random() -# else /* HASRANDOM */ -# define get_random() ((long) rand()) -# ifndef RANDOMSHIFT -# define RANDOMSHIFT 8 -# endif /* RANDOMSHIFT */ -# endif /* HASRANDOM */ -#endif /* HASARC4RANDOM */ +#if HASRANDOM +# define get_random() random() +#else /* HASRANDOM */ +# define get_random() ((long) rand()) +# ifndef RANDOMSHIFT +# define RANDOMSHIFT 8 +# endif /* RANDOMSHIFT */ +#endif /* HASRANDOM */ /* ** Default to using scanf in readcf. |