@@ -5036,17 +5036,23 @@ \subsection{Using Built--in Curves}
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 }.
5038
5038
5039
- Next a function is provided to generate the key:
5040
- \index {ecc\_ make\_ key\_ ex()}
5039
+ \index {ecc\_ set\_ curve()}
5041
5040
\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,
5043
5050
int wprng,
5044
- ecc_key *key,
5045
- const ltc_ecc_curve *cu);
5051
+ ecc_key *key);
5046
5052
\end {verbatim }
5047
5053
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.
5050
5056
5051
5057
Example of creating an ECC key:
5052
5058
\begin {small }
@@ -5060,7 +5066,8 @@ \subsection{Using Built--in Curves}
5060
5066
wprng = find_prng("yarrow");
5061
5067
if (rng_make_prng(128, wprng, &prng, NULL) != CRYPT_OK) return -1;
5062
5068
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;
5064
5071
\end {verbatim }
5065
5072
\end {small }
5066
5073
@@ -5101,29 +5108,6 @@ \subsection{Extended Key Generation}
5101
5108
5102
5109
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
5110
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
-
5127
5111
Advanced example of creating an ECC key:
5128
5112
\begin {small }
5129
5113
\begin {verbatim }
@@ -5181,6 +5165,19 @@ \subsection{Legacy Key Generation}
5181
5165
\label {fig:legacy-curve-names }
5182
5166
\end {table }
5183
5167
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
+
5184
5181
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 }.
5185
5182
5186
5183
\index {ecc\_ set\_ curve\_ by\_ size}
0 commit comments