summaryrefslogtreecommitdiffstats
path: root/common/randstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/randstr.c')
-rw-r--r--common/randstr.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/randstr.c b/common/randstr.c
index bb4fc1c..42886b1 100644
--- a/common/randstr.c
+++ b/common/randstr.c
@@ -19,6 +19,15 @@
*
*/
+/**
+ * @file randstr.c
+ * @author David Sommerseth <dazo@users.sourceforge.net>
+ * @date 2009-01-10
+ *
+ * @brief Simple functions for gathering random data
+ *
+ */
+
#include <stdio.h>
#include <unistd.h>
#include <openssl/rand.h>
@@ -29,7 +38,16 @@
static int rand_init = 0;
-// Generate some random data and return a string.
+/**
+ * Generate some random data and return a string. This function makes use of OpenSSL's RAND_pseudo_bytes()
+ * function.
+ *
+ * @param ctx eurephiaCTX
+ * @param rndstr Return buffer of the random data
+ * @param len Size of the return buffer
+ *
+ * @return Returns 1 on success, otherwise 0.
+ */
int eurephia_randstring(eurephiaCTX *ctx, void *rndstr, size_t len) {
int attempts = 0;
do {