Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
241799c9
Commit
241799c9
authored
Oct 27, 1999
by
Kurt Zeilenga
Browse files
Make sure rdata differs for each program.
parent
9e0958d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblutil/entropy.c
View file @
241799c9
...
...
@@ -49,8 +49,12 @@ int lutil_entropy( char *buf, int nbytes )
static
int
counter
=
0
;
int
n
;
struct
{
struct
rdata_s
{
int
counter
;
char
*
buf
;
struct
rdata_s
*
stack
;
pid_t
pid
;
#ifdef HAVE_GETTIMEOFDAY
...
...
@@ -61,18 +65,25 @@ int lutil_entropy( char *buf, int nbytes )
unsigned
long
junk
;
}
rdata
;
/* make sure rdata differs for each process */
rdata
.
pid
=
getpid
();
/* make sure rdata differs for each program */
rdata
.
buf
=
buf
;
rdata
.
stack
=
&
rdata
;
for
(
n
=
0
;
n
<
nbytes
;
n
+=
16
)
{
struct
lutil_MD5Context
ctx
;
char
digest
[
16
];
/* hopefully has good resolution */
#ifdef HAVE_GETTIMEOFDAY
(
void
)
gettimeofday
(
&
rdata
.
tv
,
sizeof
(
rdata
.
tv
)
);
#else
(
void
)
time
(
&
rdata
.
time
);
#endif
/* make sure rdata differs */
rdata
.
counter
=
++
counter
;
rdata
.
pid
++
;
rdata
.
junk
++
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment