public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/13595] New: missing details about how to use BSD random number function APIs
@ 2012-01-14 17:19 bruno at clisp dot org
  2014-06-27 11:11 ` [Bug manual/13595] " fweimer at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: bruno at clisp dot org @ 2012-01-14 17:19 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13595

             Bug #: 13595
           Summary: missing details about how to use BSD random number
                    function APIs
           Product: glibc
           Version: 2.14
            Status: NEW
          Severity: normal
          Priority: P2
         Component: manual
        AssignedTo: roland@gnu.org
        ReportedBy: bruno@clisp.org
    Classification: Unclassified


3 problems with the documentation, node "BSD Random",
title "BSD Random Number Functions":

1) The doc says that the prototype of the 'initstate' function is
void * initstate (unsigned int SEED, void *STATE, size_t SIZE)
But in reality, in <stdlib.h>, it is
char * initstate (unsigned int SEED, char *STATE, size_t SIZE)

2) It is unclear whether the function initstate() has to be called once
before the first call to random(). The doc should say whether it needs to
be called first or not.

3) It is unclear whether the function initstate_r() has to be called once,
to initialize a 'struct random_data', before the first call to random_r() on
this random-number generator. Also, it is unclear whether the memory area
of the 'struct random_data' has to be cleared first, using memset(), before
the first use of initstate_r() on it. Currently GNU recutils 1.5 uses the
initialization sequence

  char random_state[128];
  struct random_data random_data;

  memset (&random_data, 0, sizeof (random_data));
  initstate_r (time(NULL), (char *) &random_state, 128, &random_data);

The doc should say whether memset() is needed first, and whether initstate_r()
is needed then.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug manual/13595] missing details about how to use BSD random number function APIs
  2012-01-14 17:19 [Bug manual/13595] New: missing details about how to use BSD random number function APIs bruno at clisp dot org
@ 2014-06-27 11:11 ` fweimer at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 11:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=13595

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-27 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14 17:19 [Bug manual/13595] New: missing details about how to use BSD random number function APIs bruno at clisp dot org
2014-06-27 11:11 ` [Bug manual/13595] " fweimer at redhat dot com

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).