updates.
[silc.git] / lib / silccrypt / silcrng.h
index 9640b8b33fd211e2dd0d07e7abd1da0f523c4810..ef52b03a49f9a31e620dba153ee7208ca34419e3 100644 (file)
@@ -1,24 +1,26 @@
-/****h* silccrypt/silcrng.h
- *
- * NAME
- *
- * silcSilcRng.h
- *
- * COPYRIGHT
- *
- * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
- *
- * Copyright (C) 1997 - 2001 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+/*
+
+  silcrng.h
+  COPYRIGHT
+  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+  Copyright (C) 1997 - 2001 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
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+*/
+
+/****h* silccrypt/SilcRNGAPI
  *
  * DESCRIPTION
  *
  * Every time data is acquired from any source, the pool is stirred. The
  * stirring process performs an CFB (cipher feedback) encryption with SHA1
  * algorithm to the entire random pool. First it acquires an IV (Initial
- * Vector) from the constant location of the pool and performs the first CFB
- * pass. Then it acquires a new encryption key from variable location of the
- * pool and performs the second CFB pass. The encryption key thus is always
- * acquired from unguessable data.
+ * Vector) from the constant (random) location of the pool and performs
+ * the first CFB pass. Then it acquires a new encryption key from variable
+ * location of the pool and performs the second CFB pass. The encryption
+ * key thus is always acquired from unguessable data.
  *
  * The encryption process to the entire random pool assures that it is
  * impossible to learn the input data to the random pool without breaking the
@@ -87,7 +89,7 @@
  *
  * The second threshhold gets hard noise from system and stirs the random
  * pool. The threshhold is reached after 160 bits of random output. After the
- * noise is acquired (from /dev/random) the random pool is stirred and the
+ * noise is acquired (from /dev/urandom) the random pool is stirred and the
  * threshholds are set to zero. The process is repeated again after 64 bits of
  * output for first threshhold and after 160 bits of output for the second
  * threshhold.
  * random data for future initializing. This is important and must be
  * implemented in the future.
  *
+ * The caller must be cautios when using this RNG with native WIN32 system.
+ * The RNG most likely is impossible to set in unguessable state just by
+ * using the RNG's input data sources.  On WIN32 it is stronly suggested
+ * that caller would add more random noise after the initialization of the
+ * RNG using the silc_rng_add_noise function.  For example, random mouse
+ * movements may be used.
+ *
  ***/
 
 #ifndef SILCRNG_H
@@ -182,6 +191,7 @@ void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, uint32 len);
 int silc_rng_global_init(SilcRng rng);
 int silc_rng_global_uninit();
 unsigned char silc_rng_global_get_byte();
+unsigned char silc_rng_global_get_byte_fast();
 uint16 silc_rng_global_get_rn16();
 uint32 silc_rng_global_get_rn32();
 unsigned char *silc_rng_global_get_rn_string(uint32 len);