[Mono-dev] Help Finding this Function?

Miguel de Icaza miguel at xamarin.com
Thu Jun 26 15:10:10 UTC 2014


rand.c has several implementations, the CryptAcquireContext is part of the
Win32 support, and is a Win32 API call.

There is also a Native client implementation and a Unix one.

Miguel


On Thu, Jun 26, 2014 at 10:11 AM, Edward Ned Harvey (mono) <
edward.harvey.mono at clevertrove.com> wrote:

> I wanted to understand where mono RNGCryptoServiceProvider gets random
> data.  So I read its source, I see it uses "extern RngInitialize," so when
> I search for "RngInitialize," it leads me to
> "ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize"
> in rand.c
>
> When I read rand.c, I see that it uses CryptAcquireContext.  (First tries
> to use Intel PIII RNG, and falls back to RSA CSP).  But I can't seem to
> find the definition for CryptAcquireContext.  Anybody help?
>
> I search the entire source tree for CryptAcquireContext:
>         $ grep -lr CryptAcquireContext .
>         ./mcs/class/lib/net_2_0/Mono.Security.Win32.dll
>         ./mcs/class/lib/net_4_0/Mono.Security.Win32.dll
>         ./mcs/class/lib/net_4_5/Mono.Security.Win32.dll
>
> ./mcs/class/Mono.Security.Win32/Mono.Security.Cryptography/CapiContext.cs
>
> ./mcs/class/Mono.Security.Win32/Mono.Security.Cryptography/CryptoAPI.cs
>         ./mono/metadata/rand.c
>
> I suppose CapiContext.cs and CryptoAPI.cs get built to make
> Mono.Security.Win32.dll.  So that explains having the phrase
> "CryptAcquireContext" in all 5 of those files ...  But none of them, as far
> as I can tell, supply the definition for the function called in rand.c.
>  Looking in CapiContext.cs and CryptoAPI.cs, I see they both contain the
> phrase "CryptAcquireContextA" which does not appear to be the same thing as
> "CryptAcquireContext" which is called by rand.c
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140626/a8768942/attachment.html>


More information about the Mono-devel-list mailing list