[linker] We need to mark nested types even if the declaring type isn't marked.
[mono-project.git] / mono / metadata / rand.c
blob87d2d104790dceb6272299c34f19911ceb362615
1 /*
2 * rand.c: System.Security.Cryptography.RNGCryptoServiceProvider support
4 * Authors:
5 * Mark Crichton (crichton@gimp.org)
6 * Patrik Torstensson (p@rxc.se)
7 * Sebastien Pouliot (sebastien@ximian.com)
9 * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
10 * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
11 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
14 #include <glib.h>
16 #include "object.h"
17 #include "object-internals.h"
18 #include "rand.h"
19 #include "utils/mono-rand.h"
21 MonoBoolean
22 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void)
24 return (MonoBoolean) mono_rand_open ();
27 gpointer
28 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (MonoArray *seed)
31 return mono_rand_init (seed ? mono_array_addr (seed, guchar, 0) : NULL, seed ? mono_array_length (seed) : 0);
34 gpointer
35 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry)
37 MonoError error;
38 g_assert (arry);
39 mono_rand_try_get_bytes (&handle, mono_array_addr (arry, guchar, 0), mono_array_length (arry), &error);
40 mono_error_set_pending_exception (&error);
41 return handle;
44 void
45 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle)
47 mono_rand_close (handle);