From: Adriaan de Jong Date: Thu, 23 Jun 2011 15:44:35 +0000 (+0200) Subject: Added PRNG doxygen X-Git-Tag: v2.3-alpha1~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=279a308eed40d756cf6644c5a1a82f2aecda8dd8;p=thirdparty%2Fopenvpn.git Added PRNG doxygen Signed-off-by: Adriaan de Jong Acked-by: David Sommerseth Signed-off-by: David Sommerseth --- diff --git a/crypto.h b/crypto.h index 0a6d7e053..1d19d2a67 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);