Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b3043ce1
Unverified
Commit
b3043ce1
authored
Jul 28, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize VRND_RandomCrypto()
Try to read into the buffer in one go. closes #3366
parent
10a22348
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
vrnd.c
lib/libvarnish/vrnd.c
+6
-4
No files found.
lib/libvarnish/vrnd.c
View file @
b3043ce1
...
...
@@ -168,17 +168,19 @@ int
VRND_RandomCrypto
(
void
*
ptr
,
size_t
len
)
{
int
fd
;
char
*
p
;
char
*
p
=
ptr
;
ssize_t
l
;
AN
(
ptr
);
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd
<
0
)
return
(
-
1
);
for
(
p
=
ptr
;
len
>
0
;
len
--
,
p
++
)
{
l
=
read
(
fd
,
p
,
1
);
if
(
l
!=
1
)
while
(
len
>
0
)
{
l
=
read
(
fd
,
p
,
len
);
if
(
l
<
0
)
break
;
p
+=
l
;
len
-=
l
;
}
closefd
(
&
fd
);
return
(
len
==
0
?
0
:
-
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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