mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	Check and call arc4random_stir() if present
FreeBSD prior to 10.0 does not automatically stir on fork(). Same with current NetBSD. If arc4random_stir() is present assume is needed and call it instead of srand().
This commit is contained in:
		| @@ -187,9 +187,9 @@ AC_CHECK_FUNCS([ \ | |||||||
|  |  | ||||||
| # Optional functions | # Optional functions | ||||||
| AC_CHECK_FUNCS_ONCE([ \ | AC_CHECK_FUNCS_ONCE([ \ | ||||||
| 	arc4random gai_strerror getaddrinfo getnameinfo inet_aton sigaction \ | 	arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton | ||||||
| 	sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat strtok_r \ | 	sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \ | ||||||
| 	waitpid]) | 	strtok_r waitpid]) | ||||||
|  |  | ||||||
| # -- Configuration options -- | # -- Configuration options -- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -77,6 +77,9 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout | |||||||
| 		return -1; | 		return -1; | ||||||
| 	case 0: | 	case 0: | ||||||
| 		/* New child process: */ | 		/* New child process: */ | ||||||
|  | #ifdef HAVE_ARC4RANDOM_STIR | ||||||
|  | 		arc4random_stir(); | ||||||
|  | #endif | ||||||
| #ifndef HAVE_ARC4RANDOM | #ifndef HAVE_ARC4RANDOM | ||||||
| 		srand(seed ^ (unsigned int)time(NULL) ^ getpid()); | 		srand(seed ^ (unsigned int)time(NULL) ^ getpid()); | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Federico G. Schwindt
					Federico G. Schwindt