/*
- silcrng.h
+ silcrng.h
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2002 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
/****s* silccrypt/SilcRNGAPI/SilcRng
*
* NAME
- *
+ *
* typedef struct SilcRngStruct *SilcRng;
*
* DESCRIPTION
* DESCRIPTION
*
* Returns random string in HEX form of the length of `len' bytes.
- * The caller must free returned data buffer.
+ * The caller must free returned data buffer. It is guaranteed the
+ * data string goes not include any zero (0x00) bytes.
*
***/
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.
+ * 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
*
*
* DESCRIPTION
*
- * Add the data buffer indicated by `buffer' of length of `len' bytes
+ * Add the data buffer indicated by `buffer' of length of `len' bytes
* as noise to the random number generator. The random number generator
* is restirred (reseeded) when this function is called.
*
*
* SYNOPSIS
*
- * bool silc_rng_global_init(SilcRng rng);
+ * SilcBool silc_rng_global_init(SilcRng rng);
*
* DESCRIPTION
*
* 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
*
* 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
*
* DESCRIPTION
*
* Returns random string in HEX form of the length of `len' bytes.
- * The caller must free returned data buffer.
+ * The caller must free returned data buffer. It is guaranteed the
+ * data string goes not include any zero (0x00) bytes.
*
***/
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.
+ * 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
*
*
* DESCRIPTION
*
- * Add the data buffer indicated by `buffer' of length of `len' bytes
+ * Add the data buffer indicated by `buffer' of length of `len' bytes
* as noise to the random number generator. The random number generator
* is restirred (reseeded) when this function is called.
*