Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
695931cf
Commit
695931cf
authored
11 years ago
by
Patrick Monnerat
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:bagder/curl
Merge for resync
parents
964a7600
d4492f95
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/sslgen.c
+29
-31
29 additions, 31 deletions
lib/sslgen.c
with
29 additions
and
31 deletions
lib/sslgen.c
+
29
−
31
View file @
695931cf
...
...
@@ -187,45 +187,43 @@ unsigned int Curl_rand(struct SessionHandle *data)
{
unsigned
int
r
;
static
unsigned
int
randseed
;
static
bool
seeded
;
static
bool
seeded
=
FALSE
;
#ifdef have_curlssl_random
if
(
!
data
)
{
#ifndef have_curlssl_random
(
void
)
data
;
#else
if
(
data
)
{
Curl_ssl_random
(
data
,
(
unsigned
char
*
)
&
r
,
sizeof
(
r
));
return
r
;
}
#endif
if
(
!
seeded
)
{
#ifdef RANDOM_FILE
/* if there's a random file to read a seed from, use it */
int
fd
=
open
(
RANDOM_FILE
,
O_RDONLY
);
seeded
=
TRUE
;
if
(
fd
>
-
1
)
{
/* read random data into the randseed variable */
read
(
fd
,
&
randseed
,
sizeof
(
randseed
));
close
(
fd
);
}
else
#endif
/* RANDOM_FILE */
{
struct
timeval
now
=
curlx_tvnow
();
randseed
+=
(
unsigned
int
)
now
.
tv_usec
+
(
unsigned
int
)
now
.
tv_sec
;
randseed
=
randseed
*
1103515245
+
12345
;
randseed
=
randseed
*
1103515245
+
12345
;
randseed
=
randseed
*
1103515245
+
12345
;
if
(
!
seeded
)
{
/* if there's a random file to read a seed from, use it */
int
fd
=
open
(
RANDOM_FILE
,
O_RDONLY
);
if
(
fd
>
-
1
)
{
/* read random data into the randseed variable */
ssize_t
nread
=
read
(
fd
,
&
randseed
,
sizeof
(
randseed
));
if
(
nread
==
sizeof
(
randseed
))
seeded
=
TRUE
;
}
close
(
fd
);
}
/* Return an unsigned 32-bit pseudo-random number. */
r
=
randseed
=
randseed
*
1103515245
+
12345
;
return
(
r
<<
16
)
|
((
r
>>
16
)
&
0xFFFF
);
#ifdef have_curlssl_random
}
else
{
Curl_ssl_random
(
data
,
(
unsigned
char
*
)
&
r
,
sizeof
(
r
));
return
r
;
}
#endif
if
(
!
seeded
)
{
struct
timeval
now
=
curlx_tvnow
();
randseed
+=
(
unsigned
int
)
now
.
tv_usec
+
(
unsigned
int
)
now
.
tv_sec
;
randseed
=
randseed
*
1103515245
+
12345
;
randseed
=
randseed
*
1103515245
+
12345
;
randseed
=
randseed
*
1103515245
+
12345
;
seeded
=
TRUE
;
}
/* Return an unsigned 32-bit pseudo-random number. */
r
=
randseed
=
randseed
*
1103515245
+
12345
;
return
(
r
<<
16
)
|
((
r
>>
16
)
&
0xFFFF
);
}
#ifdef USE_SSL
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment