ec_ameth.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
  2. * project 2006.
  3. */
  4. /* ====================================================================
  5. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. *
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. *
  19. * 3. All advertising materials mentioning features or use of this
  20. * software must display the following acknowledgment:
  21. * "This product includes software developed by the OpenSSL Project
  22. * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  23. *
  24. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  25. * endorse or promote products derived from this software without
  26. * prior written permission. For written permission, please contact
  27. * licensing@OpenSSL.org.
  28. *
  29. * 5. Products derived from this software may not be called "OpenSSL"
  30. * nor may "OpenSSL" appear in their names without prior written
  31. * permission of the OpenSSL Project.
  32. *
  33. * 6. Redistributions of any form whatsoever must retain the following
  34. * acknowledgment:
  35. * "This product includes software developed by the OpenSSL Project
  36. * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  37. *
  38. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  39. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  40. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  41. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  42. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  43. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  44. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  45. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  46. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  47. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  48. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  49. * OF THE POSSIBILITY OF SUCH DAMAGE.
  50. * ====================================================================
  51. *
  52. * This product includes cryptographic software written by Eric Young
  53. * (eay@cryptsoft.com). This product includes software written by Tim
  54. * Hudson (tjh@cryptsoft.com).
  55. *
  56. */
  57. #include <stdio.h>
  58. #include "cryptlib.h"
  59. #include <openssl/x509.h>
  60. #include <openssl/ec.h>
  61. #include "asn1_locl.h"
  62. static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
  63. {
  64. const EC_GROUP *group;
  65. int nid;
  66. if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL)
  67. {
  68. ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
  69. return 0;
  70. }
  71. if (EC_GROUP_get_asn1_flag(group)
  72. && (nid = EC_GROUP_get_curve_name(group)))
  73. /* we have a 'named curve' => just set the OID */
  74. {
  75. *ppval = OBJ_nid2obj(nid);
  76. *pptype = V_ASN1_OBJECT;
  77. }
  78. else /* explicit parameters */
  79. {
  80. ASN1_STRING *pstr = NULL;
  81. pstr = ASN1_STRING_new();
  82. if (!pstr)
  83. return 0;
  84. pstr->length = i2d_ECParameters(ec_key, &pstr->data);
  85. if (pstr->length < 0)
  86. {
  87. ASN1_STRING_free(pstr);
  88. ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);
  89. return 0;
  90. }
  91. *ppval = pstr;
  92. *pptype = V_ASN1_SEQUENCE;
  93. }
  94. return 1;
  95. }
  96. static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
  97. {
  98. EC_KEY *ec_key = pkey->pkey.ec;
  99. void *pval = NULL;
  100. int ptype;
  101. unsigned char *penc = NULL, *p;
  102. int penclen;
  103. if (!eckey_param2type(&ptype, &pval, ec_key))
  104. {
  105. ECerr(EC_F_ECKEY_PUB_ENCODE, ERR_R_EC_LIB);
  106. return 0;
  107. }
  108. penclen = i2o_ECPublicKey(ec_key, NULL);
  109. if (penclen <= 0)
  110. goto err;
  111. penc = OPENSSL_malloc(penclen);
  112. if (!penc)
  113. goto err;
  114. p = penc;
  115. penclen = i2o_ECPublicKey(ec_key, &p);
  116. if (penclen <= 0)
  117. goto err;
  118. if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_EC),
  119. ptype, pval, penc, penclen))
  120. return 1;
  121. err:
  122. if (ptype == V_ASN1_OBJECT)
  123. ASN1_OBJECT_free(pval);
  124. else
  125. ASN1_STRING_free(pval);
  126. if (penc)
  127. OPENSSL_free(penc);
  128. return 0;
  129. }
  130. static EC_KEY *eckey_type2param(int ptype, void *pval)
  131. {
  132. EC_KEY *eckey = NULL;
  133. if (ptype == V_ASN1_SEQUENCE)
  134. {
  135. ASN1_STRING *pstr = pval;
  136. const unsigned char *pm = NULL;
  137. int pmlen;
  138. pm = pstr->data;
  139. pmlen = pstr->length;
  140. if (!(eckey = d2i_ECParameters(NULL, &pm, pmlen)))
  141. {
  142. ECerr(EC_F_ECKEY_TYPE2PARAM, EC_R_DECODE_ERROR);
  143. goto ecerr;
  144. }
  145. }
  146. else if (ptype == V_ASN1_OBJECT)
  147. {
  148. ASN1_OBJECT *poid = pval;
  149. EC_GROUP *group;
  150. /* type == V_ASN1_OBJECT => the parameters are given
  151. * by an asn1 OID
  152. */
  153. if ((eckey = EC_KEY_new()) == NULL)
  154. {
  155. ECerr(EC_F_ECKEY_TYPE2PARAM, ERR_R_MALLOC_FAILURE);
  156. goto ecerr;
  157. }
  158. group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(poid));
  159. if (group == NULL)
  160. goto ecerr;
  161. EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
  162. if (EC_KEY_set_group(eckey, group) == 0)
  163. goto ecerr;
  164. EC_GROUP_free(group);
  165. }
  166. else
  167. {
  168. ECerr(EC_F_ECKEY_TYPE2PARAM, EC_R_DECODE_ERROR);
  169. goto ecerr;
  170. }
  171. return eckey;
  172. ecerr:
  173. if (eckey)
  174. EC_KEY_free(eckey);
  175. return NULL;
  176. }
  177. static int eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
  178. {
  179. const unsigned char *p = NULL;
  180. void *pval;
  181. int ptype, pklen;
  182. EC_KEY *eckey = NULL;
  183. X509_ALGOR *palg;
  184. if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  185. return 0;
  186. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  187. eckey = eckey_type2param(ptype, pval);
  188. if (!eckey)
  189. {
  190. ECerr(EC_F_ECKEY_PUB_DECODE, ERR_R_EC_LIB);
  191. return 0;
  192. }
  193. /* We have parameters now set public key */
  194. if (!o2i_ECPublicKey(&eckey, &p, pklen))
  195. {
  196. ECerr(EC_F_ECKEY_PUB_DECODE, EC_R_DECODE_ERROR);
  197. goto ecerr;
  198. }
  199. EVP_PKEY_assign_EC_KEY(pkey, eckey);
  200. return 1;
  201. ecerr:
  202. if (eckey)
  203. EC_KEY_free(eckey);
  204. return 0;
  205. }
  206. static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
  207. {
  208. int r;
  209. const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec);
  210. const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec),
  211. *pb = EC_KEY_get0_public_key(b->pkey.ec);
  212. r = EC_POINT_cmp(group, pa, pb, NULL);
  213. if (r == 0)
  214. return 1;
  215. if (r == 1)
  216. return 0;
  217. return -2;
  218. }
  219. static int eckey_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
  220. {
  221. const unsigned char *p = NULL;
  222. void *pval;
  223. int ptype, pklen;
  224. EC_KEY *eckey = NULL;
  225. X509_ALGOR *palg;
  226. if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
  227. return 0;
  228. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  229. eckey = eckey_type2param(ptype, pval);
  230. if (!eckey)
  231. goto ecliberr;
  232. /* We have parameters now set private key */
  233. if (!d2i_ECPrivateKey(&eckey, &p, pklen))
  234. {
  235. ECerr(EC_F_ECKEY_PRIV_DECODE, EC_R_DECODE_ERROR);
  236. goto ecerr;
  237. }
  238. /* calculate public key (if necessary) */
  239. if (EC_KEY_get0_public_key(eckey) == NULL)
  240. {
  241. const BIGNUM *priv_key;
  242. const EC_GROUP *group;
  243. EC_POINT *pub_key;
  244. /* the public key was not included in the SEC1 private
  245. * key => calculate the public key */
  246. group = EC_KEY_get0_group(eckey);
  247. pub_key = EC_POINT_new(group);
  248. if (pub_key == NULL)
  249. {
  250. ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
  251. goto ecliberr;
  252. }
  253. if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group)))
  254. {
  255. EC_POINT_free(pub_key);
  256. ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
  257. goto ecliberr;
  258. }
  259. priv_key = EC_KEY_get0_private_key(eckey);
  260. if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, NULL))
  261. {
  262. EC_POINT_free(pub_key);
  263. ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
  264. goto ecliberr;
  265. }
  266. if (EC_KEY_set_public_key(eckey, pub_key) == 0)
  267. {
  268. EC_POINT_free(pub_key);
  269. ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
  270. goto ecliberr;
  271. }
  272. EC_POINT_free(pub_key);
  273. }
  274. EVP_PKEY_assign_EC_KEY(pkey, eckey);
  275. return 1;
  276. ecliberr:
  277. ECerr(EC_F_ECKEY_PRIV_DECODE, ERR_R_EC_LIB);
  278. ecerr:
  279. if (eckey)
  280. EC_KEY_free(eckey);
  281. return 0;
  282. }
  283. static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
  284. {
  285. EC_KEY *ec_key;
  286. unsigned char *ep, *p;
  287. int eplen, ptype;
  288. void *pval;
  289. unsigned int tmp_flags, old_flags;
  290. ec_key = pkey->pkey.ec;
  291. if (!eckey_param2type(&ptype, &pval, ec_key))
  292. {
  293. ECerr(EC_F_ECKEY_PRIV_ENCODE, EC_R_DECODE_ERROR);
  294. return 0;
  295. }
  296. /* set the private key */
  297. /* do not include the parameters in the SEC1 private key
  298. * see PKCS#11 12.11 */
  299. old_flags = EC_KEY_get_enc_flags(ec_key);
  300. tmp_flags = old_flags | EC_PKEY_NO_PARAMETERS;
  301. EC_KEY_set_enc_flags(ec_key, tmp_flags);
  302. eplen = i2d_ECPrivateKey(ec_key, NULL);
  303. if (!eplen)
  304. {
  305. EC_KEY_set_enc_flags(ec_key, old_flags);
  306. ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
  307. return 0;
  308. }
  309. ep = (unsigned char *) OPENSSL_malloc(eplen);
  310. if (!ep)
  311. {
  312. EC_KEY_set_enc_flags(ec_key, old_flags);
  313. ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
  314. return 0;
  315. }
  316. p = ep;
  317. if (!i2d_ECPrivateKey(ec_key, &p))
  318. {
  319. EC_KEY_set_enc_flags(ec_key, old_flags);
  320. OPENSSL_free(ep);
  321. ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
  322. }
  323. /* restore old encoding flags */
  324. EC_KEY_set_enc_flags(ec_key, old_flags);
  325. if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0,
  326. ptype, pval, ep, eplen))
  327. return 0;
  328. return 1;
  329. }
  330. static int int_ec_size(const EVP_PKEY *pkey)
  331. {
  332. return ECDSA_size(pkey->pkey.ec);
  333. }
  334. static int ec_bits(const EVP_PKEY *pkey)
  335. {
  336. BIGNUM *order = BN_new();
  337. const EC_GROUP *group;
  338. int ret;
  339. if (!order)
  340. {
  341. ERR_clear_error();
  342. return 0;
  343. }
  344. group = EC_KEY_get0_group(pkey->pkey.ec);
  345. if (!EC_GROUP_get_order(group, order, NULL))
  346. {
  347. ERR_clear_error();
  348. return 0;
  349. }
  350. ret = BN_num_bits(order);
  351. BN_free(order);
  352. return ret;
  353. }
  354. static int ec_missing_parameters(const EVP_PKEY *pkey)
  355. {
  356. if (EC_KEY_get0_group(pkey->pkey.ec) == NULL)
  357. return 1;
  358. return 0;
  359. }
  360. static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  361. {
  362. EC_GROUP *group = EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec));
  363. if (group == NULL)
  364. return 0;
  365. if (EC_KEY_set_group(to->pkey.ec, group) == 0)
  366. return 0;
  367. EC_GROUP_free(group);
  368. return 1;
  369. }
  370. static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
  371. {
  372. const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec),
  373. *group_b = EC_KEY_get0_group(b->pkey.ec);
  374. if (EC_GROUP_cmp(group_a, group_b, NULL))
  375. return 0;
  376. else
  377. return 1;
  378. }
  379. static void int_ec_free(EVP_PKEY *pkey)
  380. {
  381. EC_KEY_free(pkey->pkey.ec);
  382. }
  383. static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
  384. {
  385. unsigned char *buffer=NULL;
  386. const char *ecstr;
  387. size_t buf_len=0, i;
  388. int ret=0, reason=ERR_R_BIO_LIB;
  389. BIGNUM *pub_key=NULL, *order=NULL;
  390. BN_CTX *ctx=NULL;
  391. const EC_GROUP *group;
  392. const EC_POINT *public_key;
  393. const BIGNUM *priv_key;
  394. if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL)
  395. {
  396. reason = ERR_R_PASSED_NULL_PARAMETER;
  397. goto err;
  398. }
  399. ctx = BN_CTX_new();
  400. if (ctx == NULL)
  401. {
  402. reason = ERR_R_MALLOC_FAILURE;
  403. goto err;
  404. }
  405. if (ktype > 0)
  406. {
  407. public_key = EC_KEY_get0_public_key(x);
  408. if ((pub_key = EC_POINT_point2bn(group, public_key,
  409. EC_KEY_get_conv_form(x), NULL, ctx)) == NULL)
  410. {
  411. reason = ERR_R_EC_LIB;
  412. goto err;
  413. }
  414. if (pub_key)
  415. buf_len = (size_t)BN_num_bytes(pub_key);
  416. }
  417. if (ktype == 2)
  418. {
  419. priv_key = EC_KEY_get0_private_key(x);
  420. if (priv_key && (i = (size_t)BN_num_bytes(priv_key)) > buf_len)
  421. buf_len = i;
  422. }
  423. else
  424. priv_key = NULL;
  425. if (ktype > 0)
  426. {
  427. buf_len += 10;
  428. if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
  429. {
  430. reason = ERR_R_MALLOC_FAILURE;
  431. goto err;
  432. }
  433. }
  434. if (ktype == 2)
  435. ecstr = "Private-Key";
  436. else if (ktype == 1)
  437. ecstr = "Public-Key";
  438. else
  439. ecstr = "ECDSA-Parameters";
  440. if (!BIO_indent(bp, off, 128))
  441. goto err;
  442. if ((order = BN_new()) == NULL)
  443. goto err;
  444. if (!EC_GROUP_get_order(group, order, NULL))
  445. goto err;
  446. if (BIO_printf(bp, "%s: (%d bit)\n", ecstr,
  447. BN_num_bits(order)) <= 0) goto err;
  448. if ((priv_key != NULL) && !ASN1_bn_print(bp, "priv:", priv_key,
  449. buffer, off))
  450. goto err;
  451. if ((pub_key != NULL) && !ASN1_bn_print(bp, "pub: ", pub_key,
  452. buffer, off))
  453. goto err;
  454. if (!ECPKParameters_print(bp, group, off))
  455. goto err;
  456. ret=1;
  457. err:
  458. if (!ret)
  459. ECerr(EC_F_EC_KEY_PRINT, reason);
  460. if (pub_key)
  461. BN_free(pub_key);
  462. if (order)
  463. BN_free(order);
  464. if (ctx)
  465. BN_CTX_free(ctx);
  466. if (buffer != NULL)
  467. OPENSSL_free(buffer);
  468. return(ret);
  469. }
  470. static int eckey_param_decode(EVP_PKEY *pkey,
  471. const unsigned char **pder, int derlen)
  472. {
  473. EC_KEY *eckey;
  474. if (!(eckey = d2i_ECParameters(NULL, pder, derlen)))
  475. {
  476. ECerr(EC_F_ECKEY_PARAM_DECODE, ERR_R_EC_LIB);
  477. return 0;
  478. }
  479. EVP_PKEY_assign_EC_KEY(pkey, eckey);
  480. return 1;
  481. }
  482. static int eckey_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
  483. {
  484. return i2d_ECParameters(pkey->pkey.ec, pder);
  485. }
  486. static int eckey_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  487. ASN1_PCTX *ctx)
  488. {
  489. return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0);
  490. }
  491. static int eckey_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  492. ASN1_PCTX *ctx)
  493. {
  494. return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 1);
  495. }
  496. static int eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  497. ASN1_PCTX *ctx)
  498. {
  499. return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2);
  500. }
  501. static int old_ec_priv_decode(EVP_PKEY *pkey,
  502. const unsigned char **pder, int derlen)
  503. {
  504. EC_KEY *ec;
  505. if (!(ec = d2i_ECPrivateKey (NULL, pder, derlen)))
  506. {
  507. ECerr(EC_F_ECKEY_PRIV_DECODE, EC_R_DECODE_ERROR);
  508. return 0;
  509. }
  510. EVP_PKEY_assign_EC_KEY(pkey, ec);
  511. return 1;
  512. }
  513. static int old_ec_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
  514. {
  515. return i2d_ECPrivateKey(pkey->pkey.ec, pder);
  516. }
  517. static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
  518. {
  519. switch (op)
  520. {
  521. case ASN1_PKEY_CTRL_PKCS7_SIGN:
  522. if (arg1 == 0)
  523. {
  524. X509_ALGOR *alg1, *alg2;
  525. PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
  526. X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_sha1),
  527. V_ASN1_NULL, 0);
  528. X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_ecdsa_with_SHA1),
  529. V_ASN1_NULL, 0);
  530. }
  531. return 1;
  532. case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
  533. *(int *)arg2 = NID_sha1;
  534. return 2;
  535. default:
  536. return -2;
  537. }
  538. }
  539. EVP_PKEY_ASN1_METHOD eckey_asn1_meth =
  540. {
  541. EVP_PKEY_EC,
  542. EVP_PKEY_EC,
  543. 0,
  544. "EC",
  545. "OpenSSL EC algorithm",
  546. eckey_pub_decode,
  547. eckey_pub_encode,
  548. eckey_pub_cmp,
  549. eckey_pub_print,
  550. eckey_priv_decode,
  551. eckey_priv_encode,
  552. eckey_priv_print,
  553. int_ec_size,
  554. ec_bits,
  555. eckey_param_decode,
  556. eckey_param_encode,
  557. ec_missing_parameters,
  558. ec_copy_parameters,
  559. ec_cmp_parameters,
  560. eckey_param_print,
  561. int_ec_free,
  562. ec_pkey_ctrl,
  563. old_ec_priv_decode,
  564. old_ec_priv_encode
  565. };