@@ -5036,17 +5036,23 @@ \subsection{Using Built--in Curves}
50365036
50375037The \textit {name\_ or\_ oid } argument will search by name, alternative name or OID as mentioned in Table \ref {fig:builtincurves }.
50385038
5039- Next a function is provided to generate the key:
5040- \index {ecc\_ make\_ key\_ ex()}
5039+ \index {ecc\_ set\_ curve()}
50415040\begin {verbatim }
5042- int ecc_make_key_ex(prng_state *prng,
5041+ int ecc_set_curve(const ltc_ecc_curve *cu,
5042+ ecc_key *key);
5043+ \end {verbatim }
5044+
5045+ The function \textit {ecc\_ set\_ curve } initializes the \textit {key } structure with the curve parameters passed via \textit {cu }.
5046+
5047+ \index {ecc\_ generate\_ key()}
5048+ \begin {verbatim }
5049+ int ecc_generate_key(prng_state *prng,
50435050 int wprng,
5044- ecc_key *key,
5045- const ltc_ecc_curve *cu);
5051+ ecc_key *key);
50465052\end {verbatim }
50475053
5048- This function generates a random ECC key over the curve specified by the parameters in \textit { cu }.
5049- The function will free any internally allocated resources if there is an error.
5054+ The function \textit { ecc \_ generate \_ key } does the actual key generation. The function will free any internally
5055+ allocated resources if there is an error.
50505056
50515057Example of creating an ECC key:
50525058\begin {small }
@@ -5060,7 +5066,8 @@ \subsection{Using Built--in Curves}
50605066 wprng = find_prng("yarrow");
50615067 if (rng_make_prng(128, wprng, &prng, NULL) != CRYPT_OK) return -1;
50625068 if (ecc_find_curve("nistp256", &cu) != CRYPT_OK) return -1;
5063- if (ecc_make_key_ex(&prng, wprng, &key, cu) != CRYPT_OK) return -1;
5069+ if (ecc_set_curve(cu, &key) != CRYPT_OK) return -1;
5070+ if (ecc_generate_key(&prng, wprng, &key) != CRYPT_OK) return -1;
50645071\end {verbatim }
50655072\end {small }
50665073
@@ -5101,29 +5108,6 @@ \subsection{Extended Key Generation}
51015108
51025109The 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.
51035110
5104- \index {ecc\_ set\_ curve()}
5105- \begin {verbatim }
5106- int ecc_set_curve(const ltc_ecc_curve *cu,
5107- ecc_key *key);
5108- \end {verbatim }
5109-
5110- The function \textit {ecc\_ set\_ curve } initializes the \textit {key } structure with the curve parameters passed via \textit {cu }.
5111-
5112- \index {ecc\_ generate\_ key()}
5113- \begin {verbatim }
5114- int ecc_generate_key(prng_state *prng,
5115- int wprng,
5116- ecc_key *key);
5117- \end {verbatim }
5118-
5119- The function \textit {ecc\_ generate\_ key } does the actual key generation. The function will free any internally
5120- allocated resources if there is an error.
5121-
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
5123- % say that it's just a wrapper and only there for backwards compat...
5124- For backwards compatibility the function \textit {ecc\_ make\_ key\_ ex } is provided, which is just a wrapper
5125- around \textit {ecc\_ set\_ curve } and \textit {ecc\_ generate\_ key }.
5126-
51275111Advanced example of creating an ECC key:
51285112\begin {small }
51295113\begin {verbatim }
@@ -5181,6 +5165,19 @@ \subsection{Legacy Key Generation}
51815165\label {fig:legacy-curve-names }
51825166\end {table }
51835167
5168+ For backwards compatibility the function \textit {ecc\_ make\_ key\_ ex } is provided, which is just a wrapper
5169+ around \textit {ecc\_ set\_ curve } and \textit {ecc\_ generate\_ key }.
5170+
5171+ \index {ecc\_ make\_ key\_ ex()}
5172+ \begin {verbatim }
5173+ int ecc_make_key_ex(prng_state *prng,
5174+ int wprng,
5175+ ecc_key *key,
5176+ const ltc_ecc_curve *cu);
5177+ \end {verbatim }
5178+
5179+ This function generates a random ECC key over the curve specified by the parameters in \textit {cu }.
5180+
51845181It 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 }.
51855182
51865183\index {ecc\_ set\_ curve\_ by\_ size}
0 commit comments