소스 검색

add rand_bn_X() doc

Steffen Jaeckel 8 년 전
부모
커밋
ce68fa34ee
1개의 변경된 파일26개의 추가작업 그리고 0개의 파일을 삭제
  1. 26 0
      doc/crypt.tex

+ 26 - 0
doc/crypt.tex

@@ -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