Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1093383d
Commit
1093383d
authored
Oct 11, 2012
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
random_seed: Support using CryptGenRandom on windows
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
26b3fde6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
configure
configure
+2
-0
random_seed.c
libavutil/random_seed.c
+15
-0
No files found.
configure
View file @
1093383d
...
...
@@ -1139,6 +1139,7 @@ HAVE_LIST="
closesocket
cmov
cpunop
CryptGenRandom
dcbzl
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
...
...
@@ -3202,6 +3203,7 @@ check_func sysctl
check_func usleep
check_func_headers io.h setmode
check_lib2
"windows.h shellapi.h"
CommandLineToArgvW
-lshell32
check_lib2
"windows.h wincrypt.h"
CryptGenRandom
-ladvapi32
check_lib2
"windows.h psapi.h"
GetProcessMemoryInfo
-lpsapi
check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes
...
...
libavutil/random_seed.c
View file @
1093383d
...
...
@@ -23,6 +23,10 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_CRYPTGENRANDOM
#include <windows.h>
#include <wincrypt.h>
#endif
#include <fcntl.h>
#include <math.h>
#include <time.h>
...
...
@@ -82,6 +86,17 @@ uint32_t av_get_random_seed(void)
{
uint32_t
seed
;
#if HAVE_CRYPTGENRANDOM
HCRYPTPROV
provider
;
if
(
CryptAcquireContext
(
&
provider
,
NULL
,
NULL
,
PROV_RSA_FULL
,
CRYPT_VERIFYCONTEXT
|
CRYPT_SILENT
))
{
BOOL
ret
=
CryptGenRandom
(
provider
,
sizeof
(
seed
),
(
PBYTE
)
&
seed
);
CryptReleaseContext
(
provider
,
0
);
if
(
ret
)
return
seed
;
}
#endif
if
(
read_random
(
&
seed
,
"/dev/urandom"
)
==
sizeof
(
seed
))
return
seed
;
if
(
read_random
(
&
seed
,
"/dev/random"
)
==
sizeof
(
seed
))
...
...
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