|
|
@@ -5595,6 +5595,32 @@ to get a prime of the form $p \equiv 3\mbox{ }(\mbox{mod } 4)$. So if you want
|
|
|
\textit{len = -128} to the function. Upon success it will return {\bf CRYPT\_OK} and \textit{N} will contain an integer which
|
|
|
is very likely prime.
|
|
|
|
|
|
+\mysection{Random MPI Generation}
|
|
|
+\index{Random MPI Generation}
|
|
|
+
|
|
|
+Several Public Key Cryptography algorithms require random MPI's for operations like signature generation.
|
|
|
+The library provides two API functions to generate random MPI's which allow the utilisation of a user-defined PRNG to aquire the random data.
|
|
|
+
|
|
|
+\index{rand\_bn\_bits()}
|
|
|
+\begin{verbatim}
|
|
|
+int rand_bn_bits( void *N,
|
|
|
+ int bits,
|
|
|
+ prng_state *prng,
|
|
|
+ int wprng);
|
|
|
+\end{verbatim}
|
|
|
+
|
|
|
+This sets \textit{N} to a \textit{bits}-long random MPI.
|
|
|
+
|
|
|
+\index{rand\_bn\_upto()}
|
|
|
+\begin{verbatim}
|
|
|
+int rand_bn_upto( void *N,
|
|
|
+ void *limit,
|
|
|
+ prng_state *prng,
|
|
|
+ int wprng);
|
|
|
+\end{verbatim}
|
|
|
+
|
|
|
+This ensures that \textit{N} is set to a random MPI in the range $1 \le N < limit$.
|
|
|
+
|
|
|
\mysection{Dynamic Language Support}
|
|
|
\index{Dynamic Language Support}
|
|
|
Various LibTomCrypt functions require that their callers define a struct
|