summaryrefslogtreecommitdiffstats
path: root/crypto.h
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-23 17:44:35 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-19 22:13:26 +0200
commit279a308eed40d756cf6644c5a1a82f2aecda8dd8 (patch)
tree574a6b684638aa63273c9d3a1ede6ea4af3559a9 /crypto.h
parent485c5f76a15e7f9950a3ee3126dbf50f66f9ef82 (diff)
downloadopenvpn-279a308eed40d756cf6644c5a1a82f2aecda8dd8.tar.gz
openvpn-279a308eed40d756cf6644c5a1a82f2aecda8dd8.tar.xz
openvpn-279a308eed40d756cf6644c5a1a82f2aecda8dd8.zip
Added PRNG doxygen
Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: David Sommerseth <davids@redhat.com> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'crypto.h')
-rw-r--r--crypto.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto.h b/crypto.h
index 0a6d7e0..1d19d2a 100644
--- a/crypto.h
+++ b/crypto.h
@@ -407,10 +407,39 @@ void crypto_adjust_frame_parameters(struct frame *frame,
bool packet_id,
bool packet_id_long_form);
+
+/* Minimum length of the nonce used by the PRNG */
#define NONCE_SECRET_LEN_MIN 16
+
+/* Maximum length of the nonce used by the PRNG */
#define NONCE_SECRET_LEN_MAX 64
+
+/**
+ * Pseudo-random number generator initialisation.
+ * (see \c prng_rand_bytes())
+ *
+ * @param md_name Name of the message digest to use
+ * @param nonce_secret_len_param Length of the nonce to use
+ */
void prng_init (const char *md_name, const int nonce_secret_len_parm);
+
+/*
+ * Message digest-based pseudo random number generator.
+ *
+ * If the PRNG was initialised with a certain message digest, uses the digest
+ * to calculate the next random number, and prevent depletion of the entropy
+ * pool.
+ *
+ * This PRNG is aimed at IV generation and similar miscellaneous tasks. Use
+ * \c rand_bytes() for higher-assurance functionality.
+ *
+ * Retrieves len bytes of pseudo random data, and places it in output.
+ *
+ * @param output Output buffer
+ * @param len Length of the output buffer
+ */
void prng_bytes (uint8_t *output, int len);
+
void prng_uninit ();
void test_crypto (const struct crypto_options *co, struct frame* f);