@@ -5028,10 +5028,10 @@ \chapter{Elliptic Curve Cryptography}
5028
5028
\subsection {Using Built--in Curves }
5029
5029
5030
5030
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()}
5032
5032
\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);
5035
5035
\end {verbatim }
5036
5036
5037
5037
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}
5059
5059
if (register_all_prngs() != CRYPT_OK) return -1;
5060
5060
wprng = find_prng("yarrow");
5061
5061
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;
5063
5063
if (ecc_make_key_ex(&prng, wprng, &key, cu) != CRYPT_OK) return -1;
5064
5064
\end {verbatim }
5065
5065
\end {small }
@@ -5101,14 +5101,13 @@ \subsection{Extended Key Generation}
5101
5101
5102
5102
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.
5103
5103
5104
- % FIXME/XXX: shouldn't this be called ecc_set_curve()?
5105
- \index {ecc\_ set\_ dp()}
5104
+ \index {ecc\_ set\_ curve()}
5106
5105
\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);
5109
5108
\end {verbatim }
5110
5109
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 }.
5112
5111
5113
5112
\index {ecc\_ generate\_ key()}
5114
5113
\begin {verbatim }
@@ -5123,15 +5122,15 @@ \subsection{Extended Key Generation}
5123
5122
% 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
5124
5123
% say that it's just a wrapper and only there for backwards compat...
5125
5124
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 }.
5127
5126
5128
5127
Advanced example of creating an ECC key:
5129
5128
\begin {small }
5130
5129
\begin {verbatim }
5131
5130
prng_state prng;
5132
5131
int wprng;
5133
5132
ecc_key key;
5134
- const ltc_ecc_curve custom_dp = {
5133
+ const ltc_ecc_curve custom_curve = {
5135
5134
"FFFFFFFFFFFFFFFFFFFFFFFFFDE7", /* prime */
5136
5135
"0000000000000000000000000000", /* A */
5137
5136
"0000000000000000000000000003", /* B */
@@ -5145,7 +5144,7 @@ \subsection{Extended Key Generation}
5145
5144
if (register_all_prngs() != CRYPT_OK) return -1;
5146
5145
wprng = find_prng("yarrow");
5147
5146
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;
5149
5148
if (ecc_generate_key(&prng, wprng, &key) != CRYPT_OK) return -1;
5150
5149
\end {verbatim }
5151
5150
\end {small }
@@ -5182,12 +5181,12 @@ \subsection{Legacy Key Generation}
5182
5181
\label {fig:legacy-curve-names }
5183
5182
\end {table }
5184
5183
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 }.
5186
5185
5187
- \index {ecc\_ set\_ dp \_ by\_ size}
5186
+ \index {ecc\_ set\_ curve \_ by\_ size}
5188
5187
\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);
5191
5190
\end {verbatim }
5192
5191
5193
5192
The \textit {keysize } maps to the specific curve according to table \ref {fig:legacy-curve-names }.
@@ -5271,10 +5270,10 @@ \subsection{Import Raw Key}
5271
5270
\begin {small }
5272
5271
\begin {verbatim }
5273
5272
ecc_key key;
5274
- const ltc_ecc_curve* dp ;
5273
+ const ltc_ecc_curve* cu ;
5275
5274
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;
5278
5277
if (ecc_set_key(keybuf, keylen, PK_PRIVATE, &key) != CRYPT_OK) return -1;
5279
5278
\end {verbatim }
5280
5279
\end {small }
0 commit comments