Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
bdf786c9
Commit
bdf786c9
authored
Sep 01, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use HMAC-MD5 rather than plain MD5
parent
f73343dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
src/misc/rand.c
src/misc/rand.c
+16
-12
No files found.
src/misc/rand.c
View file @
bdf786c9
...
...
@@ -80,12 +80,12 @@ void vlc_rand_bytes (void *buf, size_t len)
static
pthread_mutex_t
lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
uint64_t
counter
=
0
;
struct
md5_s
md
;
uint64_t
stamp
=
NTPtime64
();
while
(
len
>
0
)
{
uint64_t
val
;
struct
md5_s
mdi
,
mdo
;
pthread_mutex_lock
(
&
lock
);
if
(
counter
==
0
)
...
...
@@ -93,21 +93,25 @@ void vlc_rand_bytes (void *buf, size_t len)
val
=
counter
++
;
pthread_mutex_unlock
(
&
lock
);
InitMD5
(
&
md
);
AddMD5
(
&
md
,
ikey
,
sizeof
(
ikey
));
AddMD5
(
&
md
,
&
stamp
,
sizeof
(
stamp
));
AddMD5
(
&
md
,
&
val
,
sizeof
(
val
));
EndMD5
(
&
md
);
if
(
len
<
sizeof
(
md
.
p_digest
))
InitMD5
(
&
mdi
);
AddMD5
(
&
mdi
,
ikey
,
sizeof
(
ikey
));
AddMD5
(
&
mdi
,
&
stamp
,
sizeof
(
stamp
));
AddMD5
(
&
mdi
,
&
val
,
sizeof
(
val
));
EndMD5
(
&
mdi
);
InitMD5
(
&
mdo
);
AddMD5
(
&
mdo
,
okey
,
sizeof
(
okey
));
AddMD5
(
&
mdo
,
mdi
.
p_digest
,
sizeof
(
mdi
.
p_digest
));
EndMD5
(
&
mdo
);
if
(
len
<
sizeof
(
mdo
.
p_digest
))
{
memcpy
(
buf
,
md
.
p_digest
,
len
);
memcpy
(
buf
,
md
o
.
p_digest
,
len
);
break
;
}
memcpy
(
buf
,
md
.
p_digest
,
sizeof
(
md
.
p_digest
));
len
-=
sizeof
(
md
.
p_digest
);
buf
=
((
uint8_t
*
)
buf
)
+
sizeof
(
md
.
p_digest
);
memcpy
(
buf
,
md
o
.
p_digest
,
sizeof
(
mdo
.
p_digest
));
len
-=
sizeof
(
md
o
.
p_digest
);
buf
=
((
uint8_t
*
)
buf
)
+
sizeof
(
md
o
.
p_digest
);
}
}
...
...
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