maint: update deps
This commit is contained in:
49
deps/libtommath/doc/bn.tex
vendored
49
deps/libtommath/doc/bn.tex
vendored
@ -51,7 +51,7 @@
|
||||
\begin{document}
|
||||
\frontmatter
|
||||
\pagestyle{empty}
|
||||
\title{LibTomMath User Manual \\ v1.2.1}
|
||||
\title{LibTomMath User Manual \\ v1.3.0}
|
||||
\author{LibTom Projects \\ www.libtom.net}
|
||||
\maketitle
|
||||
This text, the library and the accompanying textbook are all hereby placed in the public domain.
|
||||
@ -352,6 +352,16 @@ which means they are to be defined only if \texttt{LTM\_LAST} has been defined.
|
||||
\end{center}
|
||||
\end{small}
|
||||
|
||||
\subsection{Small-Stack option}
|
||||
\label{ch:SMALL_STACK_INTRO}
|
||||
The library can be compiled with the symbol \texttt{MP\_SMALL\_STACK\_SIZE} defined, which results in
|
||||
the temporary \texttt{MP\_WARRAY}-sized stack buffers being put on the heap.
|
||||
This comes with one problem, namely: formerly promised thread-safety isn't given anymore.
|
||||
Therefore if the Small-Stack option is enabled while doing multi threading, one shall always initialize
|
||||
the library by calling \texttt{mp\_warray\_init()} once with the correct number of threads.
|
||||
|
||||
C.f. \ref{ch:SMALL_STACK_API} for the API description and further details.
|
||||
|
||||
\section{Purpose of LibTomMath}
|
||||
Unlike GNU MP (GMP) Library, LIP, OpenSSL or various other commercial kits (Miracl), LibTomMath
|
||||
was not written with bleeding edge performance in mind. First and foremost LibTomMath was written
|
||||
@ -428,7 +438,11 @@ environments. Fast RSA for example can be performed with as little as 8 Kibibyt
|
||||
\section{Building Programs}
|
||||
In order to use LibTomMath you must include ``tommath.h'' and link against the appropriate library
|
||||
file (typically
|
||||
libtommath.a). There is no library initialization required and the entire library is thread safe.
|
||||
libtommath.a). There is no library initialization required and the entire library is thread safe
|
||||
if it is used in its default configuration. The small-stack option makes use of atomic operations
|
||||
to maintain its internal state and therefore does not require locking, but it MUST be initialized
|
||||
if used from multiple threads. For further information see \ref{ch:SMALL_STACK_INTRO} resp.
|
||||
\ref{ch:SMALL_STACK_API}.
|
||||
|
||||
\section{Return Codes}
|
||||
There are five possible return codes a function may return.
|
||||
@ -813,6 +827,37 @@ int main(void)
|
||||
\end{alltt}
|
||||
\end{small}
|
||||
|
||||
\section{Small-Stack option}
|
||||
\label{ch:SMALL_STACK_API}
|
||||
|
||||
In case the \texttt{MP\_SMALL\_STACK\_SIZE} symbol is defined the following functions
|
||||
can be useful.
|
||||
|
||||
To initialize the internal structure the following function shall be called.
|
||||
|
||||
\index{mp\_warray\_init}
|
||||
\begin{alltt}
|
||||
mp_err mp_warray_init(size_t n_alloc, bool preallocate);
|
||||
\end{alltt}
|
||||
|
||||
The flag \texttt{preallocate} controls whether the internal buffers --
|
||||
\texttt{n\_alloc} buffers of size \texttt{MP\_WARRAY} -- will be allocated when
|
||||
\texttt{mp\_warray\_init()} is called, or whether they will be allocated when required.
|
||||
|
||||
To free the internally allocated memory the following function shall be called.
|
||||
|
||||
\index{mp\_warray\_free}
|
||||
\begin{alltt}
|
||||
int mp_warray_free(void);
|
||||
\end{alltt}
|
||||
|
||||
|
||||
Those two API functions are always available, even if the \texttt{MP\_SMALL\_STACK\_SIZE} option
|
||||
has been disabled at compile time.
|
||||
In that case \texttt{mp\_warray\_init()} will return \texttt{MP\_ERR} and \texttt{mp\_warray\_free()}
|
||||
will return $-1$.
|
||||
|
||||
|
||||
\chapter{Basic Operations}
|
||||
\section{Copying}
|
||||
|
||||
|
Reference in New Issue
Block a user