|
47 | 47 | \def\gap{\vspace{0.5ex}} |
48 | 48 | \makeindex |
49 | 49 | \begin{document} |
50 | | -\title{LibTomCrypt \\ Version 1.11} |
| 50 | +\title{LibTomCrypt \\ Version 1.12} |
51 | 51 | \author{Tom St Denis \\ |
52 | 52 | \\ |
53 | 53 | tomstdenis@gmail.com \\ |
@@ -2909,6 +2909,40 @@ \section{Background} |
2909 | 2909 | range in order from $\approx 2^{192}$ points to $\approx 2^{521}$. According to the source document any key size greater |
2910 | 2910 | than or equal to 256-bits is sufficient for long term security. |
2911 | 2911 |
|
| 2912 | +\section{Fixed Point Optimizations} |
| 2913 | +\index{Fixed Point ECC} |
| 2914 | +As of v1.12 of LibTomCrypt, support for Fixed Point ECC point multiplication has been added. It is a generic optimization that is |
| 2915 | +supported by any conformant math plugin. It is enabled by defining \textbf{MECC\_FP} during the build, such as |
| 2916 | + |
| 2917 | +\begin{verbatim} |
| 2918 | +CFLAGS="-DTFM_DESC -DMECC_FP" make |
| 2919 | +\end{verbatim} |
| 2920 | + |
| 2921 | +which will build LTC using the TFM math library and enabling this new feature. The feature is not enabled by default as it is \textbf{NOT} thread |
| 2922 | +safe (by default). It supports the LTC locking macros (such as by enabling LTC\_PTHREAD), but by default is not locked. |
| 2923 | + |
| 2924 | +\index{FP\_ENTRIES} |
| 2925 | +The optimization works by using a Fixed Point point multiplier on any base point you use twice or more in a short period of time. It has a limited size |
| 2926 | +cache (of FP\_ENTRIES entries) which it uses to hold recent bases passed to ltc\_ecc\_mulmod(). Any base detected to be used twice is sent through the |
| 2927 | +pre--computation phase and then the fixed point algorithm can be used. For example, if you use a NIST base point twice in a row, the 2nd and |
| 2928 | +all subsequence point multiplications with that point will use the faster algorithm. |
| 2929 | + |
| 2930 | +\index{FP\_LUT} |
| 2931 | +The optimization uses a window on the multiplicand of FP\_LUT bits (default: 8, min: 2, max: 12) and controls the memory/time tradeoff. The larger the |
| 2932 | +value the faster the algorithm will be but the more memory it will take. The memory usage is $3 \cdot 2^{FP\_LUT}$ integers which by default |
| 2933 | +with TFM amounts to about 400kB of memory. Tuning TFM (by changing FP\_SIZE) can decrease the usage by a fair amount. Memory is only used by a cache entry |
| 2934 | +if it is active. Both FP\_ENTRIES and FP\_LUT are definable on the command line if you wish to override them. For instance, |
| 2935 | + |
| 2936 | +\begin{verbatim} |
| 2937 | +CFLAGS="-DTFM_DESC -DMECC_FP -DFP_ENTRIES=8 -DFP_LUT=6" make |
| 2938 | +\end{verbatim} |
| 2939 | + |
| 2940 | +\begin{flushleft} |
| 2941 | +would define a window of 6 bits and limit the cache to 8 entries. Generally it's better to first tune TFM by adjusting FP\_SIZE (from tfm.h). It defaults |
| 2942 | +to 4096 bits (512 bytes) which is way more than what is required by ECC. At most, you need 1152 bits to accommodate ECC--521. If you're only using (say) |
| 2943 | +ECC--256 you will only need 576 bits, which would reduce the memory usage by 700\%. |
| 2944 | +\end{flushleft} |
| 2945 | + |
2912 | 2946 | \section{Key Format} |
2913 | 2947 | LibTomCrypt uses it's own format for ECC public and private keys. While ANSI X9.62 partially specifies key formats (it covers public keys) it does it in a less |
2914 | 2948 | than ideally simple manner. In the case of LibTomCrypt it is meant \textbf{solely} for NIST $GF(p)$ curves. The format of the keys is as follows: |
@@ -3320,6 +3354,7 @@ \section{ASN.1 Formats} |
3320 | 3354 | \begin{tabular}{|l|l|} |
3321 | 3355 | \hline \textbf{Definition} & \textbf{ASN.1 Type} \\ |
3322 | 3356 | \hline LTC\_ASN1\_EOL & End of a ASN.1 list structure. \\ |
| 3357 | +\hline LTC\_ASN1\_BOOLEAN & BOOLEAN type \\ |
3323 | 3358 | \hline LTC\_ASN1\_INTEGER & INTEGER (uses mp\_int) \\ |
3324 | 3359 | \hline LTC\_ASN1\_SHORT\_INTEGER & INTEGER (32--bit using unsigned long) \\ |
3325 | 3360 | \hline LTC\_ASN1\_BIT\_STRING & BIT STRING (one bit per char) \\ |
@@ -4825,6 +4860,12 @@ \section{BigNum Math Descriptors} |
4825 | 4860 | */ |
4826 | 4861 | int (*count_bits)(void * a); |
4827 | 4862 |
|
| 4863 | + /** Count the number of LSB bits which are zero |
| 4864 | + @param a The integer to count |
| 4865 | + @return The number of contiguous zero LSB bits |
| 4866 | + */ |
| 4867 | + int (*count_lsb_bits)(void *a); |
| 4868 | +
|
4828 | 4869 | /** Compute a power of two |
4829 | 4870 | @param a The integer to store the power in |
4830 | 4871 | @param n The power of two you want to store (a = 2^n) |
@@ -5190,5 +5231,5 @@ \subsection{RSA Functions} |
5190 | 5231 | \end{document} |
5191 | 5232 |
|
5192 | 5233 | % $Source: /cvs/libtom/libtomcrypt/crypt.tex,v $ |
5193 | | -% $Revision: 1.67 $ |
5194 | | -% $Date: 2006/03/31 14:16:09 $ |
| 5234 | +% $Revision: 1.71 $ |
| 5235 | +% $Date: 2006/05/29 11:19:08 $ |
0 commit comments