public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_4-branch] Cygwin: random: drop unused function srandomdev()
@ 2023-11-13 19:03 Corinna Vinschen
  2023-11-13 20:40 ` 1dakotaxi
  0 siblings, 1 reply; 2+ messages in thread
From: Corinna Vinschen @ 2023-11-13 19:03 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ea980c5d418fc7092d3b9efdc652fd591def1cd4

commit ea980c5d418fc7092d3b9efdc652fd591def1cd4
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Nov 13 19:37:56 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Nov 13 19:54:59 2023 +0100

    Cygwin: random: drop unused function srandomdev()
    
    Also drop includes only required for srandomdev().
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/random.cc | 44 --------------------------------------------
 1 file changed, 44 deletions(-)

diff --git a/winsup/cygwin/random.cc b/winsup/cygwin/random.cc
index b38fdc078189..51f5a6e963e0 100644
--- a/winsup/cygwin/random.cc
+++ b/winsup/cygwin/random.cc
@@ -44,11 +44,7 @@ static char sccsid[] = "@(#)random.c	8.2 (Berkeley) 5/19/95";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $");
 
-#include <sys/time.h>          /* for srandomdev() */
-#include <fcntl.h>             /* for srandomdev() */
 #include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>            /* for srandomdev() */
 
 /*
  * random.c:
@@ -297,46 +293,6 @@ srandom(unsigned x)
 	__random_unlock();
 }
 
-/*
- * srandomdev:
- *
- * Many programs choose the seed value in a totally predictable manner.
- * This often causes problems.  We seed the generator using the much more
- * secure random(4) interface.  Note that this particular seeding
- * procedure can generate states which are impossible to reproduce by
- * calling srandom() with any value, since the succeeding terms in the
- * state buffer are no longer derived from the LC algorithm applied to
- * a fixed seed.
- */
-void
-srandomdev()
-{
-	size_t len;
-
-	if (rand_type == TYPE_0)
-		len = sizeof state[0];
-	else
-		len = rand_deg * sizeof state[0];
-
-	if (getentropy ((void *) state, len)) {
-		struct timeval tv;
-		unsigned long junk;
-
-		gettimeofday(&tv, NULL);
-		/* Avoid a compiler warning when we really want to get at the
-		   junk in an uninitialized variable. */
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-		srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
-#pragma GCC diagnostic pop
-		return;
-	}
-
-	if (rand_type != TYPE_0) {
-		fptr = &state[rand_sep];
-		rptr = &state[0];
-	}
-}
-
 /*
  * initstate:
  *

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [newlib-cygwin/cygwin-3_4-branch] Cygwin: random: drop unused function srandomdev()
  2023-11-13 19:03 [newlib-cygwin/cygwin-3_4-branch] Cygwin: random: drop unused function srandomdev() Corinna Vinschen
@ 2023-11-13 20:40 ` 1dakotaxi
  0 siblings, 0 replies; 2+ messages in thread
From: 1dakotaxi @ 2023-11-13 20:40 UTC (permalink / raw)
  To: Corinna Vinschen, cygwin-cvs

[-- Attachment #1: Type: text/plain, Size: 2678 bytes --]

Stop Sent from my T-Mobile 5G Device
-------- Original message --------From: Corinna Vinschen via Cygwin-cvs <cygwin-cvs@cygwin.com> Date: 11/13/23  11:03 AM  (GMT-08:00) To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_4-branch] Cygwin: random: drop unused function srandomdev() https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ea980c5d418fc7092d3b9efdc652fd591def1cd4commit ea980c5d418fc7092d3b9efdc652fd591def1cd4Author:     Corinna Vinschen <corinna@vinschen.de>AuthorDate: Mon Nov 13 19:37:56 2023 +0100Commit:     Corinna Vinschen <corinna@vinschen.de>CommitDate: Mon Nov 13 19:54:59 2023 +0100    Cygwin: random: drop unused function srandomdev()        Also drop includes only required for srandomdev().        Signed-off-by: Corinna Vinschen <corinna@vinschen.de>Diff:--- winsup/cygwin/random.cc | 44 -------------------------------------------- 1 file changed, 44 deletions(-)diff --git a/winsup/cygwin/random.cc b/winsup/cygwin/random.ccindex b38fdc078189..51f5a6e963e0 100644--- a/winsup/cygwin/random.cc+++ b/winsup/cygwin/random.cc@@ -44,11 +44,7 @@ static char sccsid[] = "@(#)random.c	8.2 (Berkeley) 5/19/95"; #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $"); -#include <sys/time.h>          /* for srandomdev() */-#include <fcntl.h>             /* for srandomdev() */ #include <stdio.h>-#include <stdlib.h>-#include <unistd.h>            /* for srandomdev() */  /*  * random.c:@@ -297,46 +293,6 @@ srandom(unsigned x) 	__random_unlock(); } -/*- * srandomdev:- *- * Many programs choose the seed value in a totally predictable manner.- * This often causes problems.  We seed the generator using the much more- * secure random(4) interface.  Note that this particular seeding- * procedure can generate states which are impossible to reproduce by- * calling srandom() with any value, since the succeeding terms in the- * state buffer are no longer derived from the LC algorithm applied to- * a fixed seed.- */-void-srandomdev()-{-	size_t len;--	if (rand_type == TYPE_0)-		len = sizeof state[0];-	else-		len = rand_deg * sizeof state[0];--	if (getentropy ((void *) state, len)) {-		struct timeval tv;-		unsigned long junk;--		gettimeofday(&tv, NULL);-		/* Avoid a compiler warning when we really want to get at the-		   junk in an uninitialized variable. */-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"-		srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);-#pragma GCC diagnostic pop-		return;-	}--	if (rand_type != TYPE_0) {-		fptr = &state[rand_sep];-		rptr = &state[0];-	}-}- /*  * initstate:  *

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-13 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 19:03 [newlib-cygwin/cygwin-3_4-branch] Cygwin: random: drop unused function srandomdev() Corinna Vinschen
2023-11-13 20:40 ` 1dakotaxi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).