Skip to content

Commit b59f066

Browse files
committed
update prng section in doc
1 parent ac6fb72 commit b59f066

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

doc/crypt.tex

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,9 +3016,9 @@ \subsection{Example}
30163016
30173017
void (*done)(prng_state *);
30183018
3019-
int (*export)(unsigned char *, unsigned long *, prng_state *);
3019+
int (*pexport)(unsigned char *, unsigned long *, prng_state *);
30203020
3021-
int (*import)(const unsigned char *, unsigned long, prng_state *);
3021+
int (*pimport)(const unsigned char *, unsigned long, prng_state *);
30223022
30233023
int (*test)(void);
30243024
};
@@ -3050,10 +3050,12 @@ \subsection{PRNGs Provided}
30503050
\begin{small}
30513051
\begin{tabular}{|c|c|l|}
30523052
\hline \textbf{Name} & \textbf{Descriptor} & \textbf{Usage} \\
3053+
\hline ChaCha20 & chacha20\_prng\_desc & Stream Cipher PRNG (recommended, fast) \\
3054+
\hline Fortuna & fortuna\_desc & Fast long-term PRNG (recommended, secure) \\
3055+
\hline RC4 & rc4\_desc & Stream Cipher PRNG \\
3056+
\hline SOBER-128 & sober128\_desc & Stream Cipher PRNG \\
3057+
\hline sprng & sprng\_desc & Secure PRNG using the System RNG \\
30533058
\hline Yarrow & yarrow\_desc & Fast short-term PRNG \\
3054-
\hline Fortuna & fortuna\_desc & Fast long-term PRNG (recommended) \\
3055-
\hline RC4 & rc4\_desc & Stream Cipher \\
3056-
\hline SOBER-128 & sober128\_desc & Stream Cipher (also very fast PRNG) \\
30573059
\hline
30583060
\end{tabular}
30593061
\end{small}
@@ -3066,7 +3068,7 @@ \subsubsection{Yarrow}
30663068
(keyboard, mouse, interrupts, etc), and produce an unbounded string of random bytes.
30673069

30683070
\textit{Note:} This PRNG is still secure for most tasks but is no longer recommended. Users
3069-
should use Fortuna instead.
3071+
should use Fortuna or ChaCha20 instead.
30703072

30713073
\subsubsection{Fortuna}
30723074

@@ -3089,14 +3091,9 @@ \subsubsection{Fortuna}
30893091
\subsubsection{RC4}
30903092

30913093
RC4 is an old stream cipher that can also double duty as a PRNG in a pinch. You key RC4 by
3092-
calling add\_entropy(), and setup the key by calling ready(). You can only add up to 256 bytes via
3093-
add\_entropy().
3094+
calling add\_entropy(), and setup the key by calling ready().
30943095

3095-
When you read from RC4, the output is XOR'ed against your buffer you provide. In this manner, you can use rc4\_read()
3096-
as an encrypt (and decrypt) function.
3097-
3098-
You really should not use RC4. This is not because RC4 is weak, (though biases are known to exist) but simply due to
3099-
the fact that faster alternatives exist.
3096+
You really should not use RC4 for cryptographical purposes, it's broken.
31003097

31013098
\subsubsection{SOBER-128}
31023099

@@ -3114,10 +3111,17 @@ \subsubsection{SOBER-128}
31143111
Like RC4, the output of SOBER--128 is XOR'ed against the buffer you provide it. In this manner, you can use
31153112
sober128\_read() as an encrypt (and decrypt) function.
31163113

3117-
Since SOBER-128 has a fixed keying scheme, and is very fast (faster than RC4) the ideal usage of SOBER-128 is to
3114+
Since SOBER--128 has a fixed keying scheme, and is very fast (faster than RC4) the ideal usage of SOBER-128 is to
31183115
key it from the output of Fortuna (or Yarrow), and use it to encrypt messages. It is also ideal for
31193116
simulations which need a high quality (and fast) stream of bytes.
31203117

3118+
\subsubsection{ChaCha20}
3119+
3120+
ChaCha20 is a fast stream cipher built on a pseudorandom function designed by Daniel J. Bernstein.
3121+
It can also double duty as a PRNG.
3122+
3123+
The implementation supports adding entropy via the add\_entropy() function while already being operational.
3124+
31213125
\subsubsection{Example Usage}
31223126
\begin{small}
31233127
\begin{verbatim}
@@ -3225,6 +3229,7 @@ \subsubsection{Example Usage}
32253229
\end{small}
32263230

32273231
\subsection{The Secure PRNG Interface}
3232+
\index{sprng\_desc}
32283233
It is possible to access the secure RNG through the PRNG interface, and in turn use it within dependent functions such
32293234
as the PK API. This simplifies the cryptosystem on platforms where the secure RNG is fast. The secure PRNG never
32303235
requires to be started, that is you need not call the start, add\_entropy, or ready functions. For example, consider

0 commit comments

Comments
 (0)