Added SILC Thread Queue API
[silc.git] / lib / silccrypt / silcrng.h
index 4ae6b7d8891fd089160a9d4e91c0e2dba308ef9f..bf32fd8fcac2e9d9802613331b7559f03e86e49c 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2003 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -184,16 +184,18 @@ unsigned char *silc_rng_get_rn_string(SilcRng rng, SilcUInt32 len);
  *
  * SYNOPSIS
  *
- *    unsigned char *silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len);
+ *    SilcBool silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len,
+ *                                  unsigned char *buf, SilcUInt32 buf_size);
  *
  * DESCRIPTION
  *
- *    Returns random binary data of the length of `len' bytes.  The
- *    caller must free returned data buffer.  It is guaranteed the data
- *    buffer does not include any zero (0x00) bytes.
+ *    Returns random binary data of the length of `len' bytes to the `buf'
+ *    of maximum size of `buf_size'.  It is guaranteed the data buffer does
+ *    not include any zero (0x00) bytes.
  *
  ***/
-unsigned char *silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len);
+SilcBool silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len,
+                             unsigned char *buf, SilcUInt32 buf_size);
 
 /****f* silccrypt/SilcRNGAPI/silc_rng_add_noise
  *
@@ -214,7 +216,7 @@ void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, SilcUInt32 len);
  *
  * SYNOPSIS
  *
- *    bool silc_rng_global_init(SilcRng rng);
+ *    SilcBool silc_rng_global_init(SilcRng rng);
  *
  * DESCRIPTION
  *
@@ -234,13 +236,13 @@ void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, SilcUInt32 len);
  *    the RNG as argument.
  *
  ***/
-bool silc_rng_global_init(SilcRng rng);
+SilcBool silc_rng_global_init(SilcRng rng);
 
 /****f* silccrypt/SilcRNGAPI/silc_rng_global_uninit
  *
  * SYNOPSIS
  *
- *    bool silc_rng_global_uninit(void);
+ *    SilcBool silc_rng_global_uninit(void);
  *
  * DESCRIPTION
  *
@@ -248,7 +250,7 @@ bool silc_rng_global_init(SilcRng rng);
  *    be called if silc_rng_global_init was called with non-NULL RNG.
  *
  ***/
-bool silc_rng_global_uninit(void);
+SilcBool silc_rng_global_uninit(void);
 
 /****f* silccrypt/SilcRNGAPI/silc_rng_global_get_byte
  *
@@ -329,16 +331,19 @@ unsigned char *silc_rng_global_get_rn_string(SilcUInt32 len);
  *
  * SYNOPSIS
  *
- *    unsigned char *silc_rng_global_get_rn_data(SilcUInt32 len);
+ *    SilcBool silc_rng_global_get_rn_data(SilcRng rng, SilcUInt32 len,
+ *                                         unsigned char *buf,
+ *                                         SilcUInt32 buf_size);
  *
  * DESCRIPTION
  *
- *    Returns random binary data of the length of `len' bytes.  The
- *    caller must free returned data buffer.  It is guaranteed the data
- *    buffer does not include any zero (0x00) bytes.
+ *    Returns random binary data of the length of `len' bytes to the `buf'
+ *    of maximum size of `buf_size'.  It is guaranteed the data buffer does
+ *    not include any zero (0x00) bytes.
  *
  ***/
-unsigned char *silc_rng_global_get_rn_data(SilcUInt32 len);
+SilcBool silc_rng_global_get_rn_data(SilcRng rng, SilcUInt32 len,
+                                    unsigned char *buf, SilcUInt32 buf_size);
 
 /****f* silccrypt/SilcRNGAPI/silc_rng_global_add_noise
  *