[FFmpeg-devel] WinRT API support patch
Jesse Jiang
jessejiang0214 at outlook.com
Fri Nov 21 07:44:57 CET 2014
Now, I find a function get_generic_seed()
So, I use this function will work fine?
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 HAVE_WINRTAPI return get_generic_seed();#endif
if (read_random(&seed, "/dev/urandom") == sizeof(seed)) return seed; if (read_random(&seed, "/dev/random") == sizeof(seed)) return seed; return get_generic_seed();}
> From: jessejiang0214 at outlook.com
> To: ffmpeg-devel at ffmpeg.org
> Date: Fri, 21 Nov 2014 03:51:12 +0000
> Subject: Re: [FFmpeg-devel] WinRT API support patch
>
> Hi All,
> I did some research, rand() is pseudo random. CryptGenRandom is the system-wide seed, but it cannot be used in Windows RT.
> I try to use CryptographicBuffer, which is Windows RT API, but there is a problem. This API needs to link Windows.winmd. The Windows.winmd just like a DLL, but it may different from Windows RT and Windows Phone. First, the SDKs are in the different PATH,Second, the files are also different.
> It means that developer need to choice platform first, and then compiler for different library.
> I hope ffmpeg only depends on support win32 apis and CRT apis.
> So is there any way to instead of srand(time(0)); rand(); ? How about c++11 <random> or Mersenne twister Algorithmic
> Best regards,Jesse
> Date: Fri, 21 Nov 2014 02:49:59 +0100
> From: michaelni at gmx.at
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] WinRT API support patch
>
> On Fri, Nov 21, 2014 at 01:43:29AM +0000, Jesse Jiang wrote:
> > Do you mean that we can use rand() instead of CryptGenRandom in ffmpeg?
>
> rand() is completely wrong
> its not even doing the correct operation
>
> rand() is pseudo random
> the code requires a strong (and non pseudo) random value
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> When you are offended at any man's fault, turn to yourself and study your
> own failings. Then you will forget your anger. -- Epictetus
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list