Skip to content

Commit b30c270

Browse files
committed
new names: ecc_find_curve, ecc_set_curve
1 parent 415c19b commit b30c270

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

doc/crypt.tex

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5028,10 +5028,10 @@ \chapter{Elliptic Curve Cryptography}
50285028
\subsection{Using Built--in Curves}
50295029

50305030
First a function is provided to look up curve name or OID of built--in curves:
5031-
\index{ecc\_get\_curve()}
5031+
\index{ecc\_find\_curve()}
50325032
\begin{verbatim}
5033-
int ecc_get_curve(const char *name_or_oid,
5034-
const ltc_ecc_curve **cu);
5033+
int ecc_find_curve(const char *name_or_oid,
5034+
const ltc_ecc_curve **cu);
50355035
\end{verbatim}
50365036

50375037
The \textit{name\_or\_oid} argument will search by name, alternative name or OID as mentioned in Table \ref{fig:builtincurves}.
@@ -5059,7 +5059,7 @@ \subsection{Using Built--in Curves}
50595059
if (register_all_prngs() != CRYPT_OK) return -1;
50605060
wprng = find_prng("yarrow");
50615061
if (rng_make_prng(128, wprng, &prng, NULL) != CRYPT_OK) return -1;
5062-
if (ecc_get_curve("nistp256", &cu) != CRYPT_OK) return -1;
5062+
if (ecc_find_curve("nistp256", &cu) != CRYPT_OK) return -1;
50635063
if (ecc_make_key_ex(&prng, wprng, &key, cu) != CRYPT_OK) return -1;
50645064
\end{verbatim}
50655065
\end{small}
@@ -5101,14 +5101,13 @@ \subsection{Extended Key Generation}
51015101

51025102
The curve must be of the form $y^2 = x^3 - a \cdot x + b$, and all of the \textit{const char*} parameters have to be encoded in hexadecimal format.
51035103

5104-
% FIXME/XXX: shouldn't this be called ecc_set_curve()?
5105-
\index{ecc\_set\_dp()}
5104+
\index{ecc\_set\_curve()}
51065105
\begin{verbatim}
5107-
int ecc_set_dp(const ltc_ecc_curve *cu,
5108-
ecc_key *key);
5106+
int ecc_set_curve(const ltc_ecc_curve *cu,
5107+
ecc_key *key);
51095108
\end{verbatim}
51105109

5111-
The function \textit{ecc\_set\_dp} initializes the \textit{key} structure with the curve parameters passed via \textit{cu}.
5110+
The function \textit{ecc\_set\_curve} initializes the \textit{key} structure with the curve parameters passed via \textit{cu}.
51125111

51135112
\index{ecc\_generate\_key()}
51145113
\begin{verbatim}
@@ -5123,15 +5122,15 @@ \subsection{Extended Key Generation}
51235122
% FIXME/XXX: I'd say either we leave ecc_make_key_ex() in and don't tell about its origin or we remove it if we already
51245123
% say that it's just a wrapper and only there for backwards compat...
51255124
For backwards compatibility the function \textit{ecc\_make\_key\_ex} is provided, which is just a wrapper
5126-
around \textit{ecc\_set\_dp} and \textit{ecc\_generate\_key}.
5125+
around \textit{ecc\_set\_curve} and \textit{ecc\_generate\_key}.
51275126

51285127
Advanced example of creating an ECC key:
51295128
\begin{small}
51305129
\begin{verbatim}
51315130
prng_state prng;
51325131
int wprng;
51335132
ecc_key key;
5134-
const ltc_ecc_curve custom_dp = {
5133+
const ltc_ecc_curve custom_curve = {
51355134
"FFFFFFFFFFFFFFFFFFFFFFFFFDE7", /* prime */
51365135
"0000000000000000000000000000", /* A */
51375136
"0000000000000000000000000003", /* B */
@@ -5145,7 +5144,7 @@ \subsection{Extended Key Generation}
51455144
if (register_all_prngs() != CRYPT_OK) return -1;
51465145
wprng = find_prng("yarrow");
51475146
if (rng_make_prng(128, wprng, &prng, NULL) != CRYPT_OK) return -1;
5148-
if (ecc_set_dp(&custom_dp, &key) != CRYPT_OK) return -1;
5147+
if (ecc_set_curve(&custom_curve, &key) != CRYPT_OK) return -1;
51495148
if (ecc_generate_key(&prng, wprng, &key) != CRYPT_OK) return -1;
51505149
\end{verbatim}
51515150
\end{small}
@@ -5182,12 +5181,12 @@ \subsection{Legacy Key Generation}
51825181
\label{fig:legacy-curve-names}
51835182
\end{table}
51845183

5185-
It is also possible to use a combination of \textit{ecc\_set\_dp\_by\_size} (similar to \textit{ecc\_set\_dp}) and \textit{ecc\_generate\_key}.
5184+
It is also possible to use a combination of \textit{ecc\_set\_curve\_by\_size} (similar to \textit{ecc\_set\_curve}) and \textit{ecc\_generate\_key}.
51865185

5187-
\index{ecc\_set\_dp\_by\_size}
5186+
\index{ecc\_set\_curve\_by\_size}
51885187
\begin{verbatim}
5189-
int ecc_set_dp_by_size( int keysize,
5190-
ecc_key *key);
5188+
int ecc_set_curve_by_size( int keysize,
5189+
ecc_key *key);
51915190
\end{verbatim}
51925191

51935192
The \textit{keysize} maps to the specific curve according to table \ref{fig:legacy-curve-names}.
@@ -5271,10 +5270,10 @@ \subsection{Import Raw Key}
52715270
\begin{small}
52725271
\begin{verbatim}
52735272
ecc_key key;
5274-
const ltc_ecc_curve* dp;
5273+
const ltc_ecc_curve* cu;
52755274
5276-
if (ecc_get_curve("nistp256", &dp) != CRYPT_OK) return -1;
5277-
if (ecc_set_dp(dp, &key) != CRYPT_OK) return -1;
5275+
if (ecc_find_curve("nistp256", &cu) != CRYPT_OK) return -1;
5276+
if (ecc_set_curve(cu, &key) != CRYPT_OK) return -1;
52785277
if (ecc_set_key(keybuf, keylen, PK_PRIVATE, &key) != CRYPT_OK) return -1;
52795278
\end{verbatim}
52805279
\end{small}

0 commit comments

Comments
 (0)