Skip to content

Commit e8e678e

Browse files
committed
improve MPI providers section in documentation
.. also add a checkbox regarding MPI providers to the issue template This closes #605 Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent e10c62e commit e8e678e

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This is a very generic template, remove items that do not apply. For completed i
1010

1111
* [ ] Checked the developer manual
1212
* [ ] Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=repo%3Alibtom%2Flibtomcrypt
13+
* [ ] Checked that your issue isn't due to the fact that you're using asymmetric cryptography and you forgot linking in and/or setting an MPI provider (usually this causes either random crashes or runtime errors like `LTC_ARGCHK 'ltc_mp.name != NULL' failure ...`). c.f. Ch. "Math Descriptors" of the developer manual.
1314
* [ ] Checked that your issue isn't related to TomsFastMath's limitation that PK operations can by default only be done with max. 2048bit keys
1415

1516
### Description

doc/crypt.tex

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7744,18 +7744,6 @@ \subsection{Radix to binary conversion}
77447744
where each name and value is separated by a comma, the pairs are separated
77457745
by newlines, and the list is null terminated.
77467746

7747-
\index{crypt\_mp\_init()}
7748-
\begin{verbatim}
7749-
int crypt_mp_init(const char* mpi);
7750-
\end{verbatim}
7751-
7752-
To ease the setup of a specific math descriptor, in cases where the library was compiled with support for multiple MPI libraries,
7753-
the function \textit{crypt\_mp\_init()} is provided.
7754-
It takes a string to the desired MPI library to use as an argument.
7755-
The three default MPI libraries are identified as follows, \textit{LibTomMath} as \texttt{"ltm"}, \textit{TomsFastmath} as \texttt{"tfm"}
7756-
and the \textit{GNU Multi Precision Arithmetic Library} as \texttt{"gmp"}.
7757-
The identification happens case-insensitive and only on the first character.
7758-
77597747
Here is a Python program demonstrating how to call various LTC dynamic
77607748
language support functions.
77617749

@@ -8293,6 +8281,40 @@ \subsection{Math Descriptors}
82938281

82948282
That will build and install the library with all descriptors (and link against all), but only use TomsFastMath in the timing demo.
82958283

8284+
To avoid random crashes and run--time errors in the form \texttt{LTC\_ARGCHK 'ltc\_mp.name != NULL' failure ...}, one has to
8285+
initialise the \texttt{ltc\_mp} struct. This can be done in multiple ways as shown below.
8286+
8287+
\index{crypt\_mp\_init()}
8288+
\begin{verbatim}
8289+
int crypt_mp_init(const char* mpi);
8290+
\end{verbatim}
8291+
8292+
To ease the setup of a specific math descriptor, in cases where the library was compiled with support for multiple MPI libraries,
8293+
the function \textit{crypt\_mp\_init()} is provided.
8294+
It takes a string to the desired MPI library to use as an argument.
8295+
The three default MPI libraries are identified as follows, \textit{LibTomMath} as \texttt{"ltm"}, \textit{TomsFastmath} as \texttt{"tfm"}
8296+
and the \textit{GNU Multi Precision Arithmetic Library} as \texttt{"gmp"}.
8297+
The identification happens case-insensitive and only on the first character.
8298+
8299+
8300+
\begin{verbatim}
8301+
#include <tomcrypt.h>
8302+
8303+
int main(void)
8304+
{
8305+
/* set it by hand */
8306+
ltc_mp = gmp_desc;
8307+
ltc_mp = ltm_desc;
8308+
ltc_mp = tfm_desc;
8309+
8310+
/* use the provided API */
8311+
crypt_mp_init("GMP");
8312+
crypt_mp_init("LibTomMath");
8313+
crypt_mp_init("TomsFastMath");
8314+
}
8315+
\end{verbatim}
8316+
8317+
82968318
\chapter{Optimizations}
82978319
\mysection{Introduction}
82988320
The entire API was designed with plug and play in mind at the low level. That is you can swap out any cipher, hash, PRNG or bignum library and the dependent API will not

0 commit comments

Comments
 (0)