dsa_ameth.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /* Written by Dr Stephen N Henson (steve@openssl.org) 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/asn1.h>
  61. #include <openssl/dsa.h>
  62. #include <openssl/bn.h>
  63. #ifndef OPENSSL_NO_CMS
  64. #include <openssl/cms.h>
  65. #endif
  66. #include "asn1_locl.h"
  67. static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
  68. {
  69. const unsigned char *p, *pm;
  70. int pklen, pmlen;
  71. int ptype;
  72. void *pval;
  73. ASN1_STRING *pstr;
  74. X509_ALGOR *palg;
  75. ASN1_INTEGER *public_key = NULL;
  76. DSA *dsa = NULL;
  77. if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  78. return 0;
  79. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  80. if (ptype == V_ASN1_SEQUENCE)
  81. {
  82. pstr = pval;
  83. pm = pstr->data;
  84. pmlen = pstr->length;
  85. if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen)))
  86. {
  87. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
  88. goto err;
  89. }
  90. }
  91. else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF))
  92. {
  93. if (!(dsa = DSA_new()))
  94. {
  95. DSAerr(DSA_F_DSA_PUB_DECODE, ERR_R_MALLOC_FAILURE);
  96. goto err;
  97. }
  98. }
  99. else
  100. {
  101. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_PARAMETER_ENCODING_ERROR);
  102. goto err;
  103. }
  104. if (!(public_key=d2i_ASN1_INTEGER(NULL, &p, pklen)))
  105. {
  106. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
  107. goto err;
  108. }
  109. if (!(dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)))
  110. {
  111. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_BN_DECODE_ERROR);
  112. goto err;
  113. }
  114. ASN1_INTEGER_free(public_key);
  115. EVP_PKEY_assign_DSA(pkey, dsa);
  116. return 1;
  117. err:
  118. if (public_key)
  119. ASN1_INTEGER_free(public_key);
  120. if (dsa)
  121. DSA_free(dsa);
  122. return 0;
  123. }
  124. static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
  125. {
  126. DSA *dsa;
  127. void *pval = NULL;
  128. int ptype;
  129. unsigned char *penc = NULL;
  130. int penclen;
  131. dsa=pkey->pkey.dsa;
  132. if (pkey->save_parameters && dsa->p && dsa->q && dsa->g)
  133. {
  134. ASN1_STRING *str;
  135. str = ASN1_STRING_new();
  136. str->length = i2d_DSAparams(dsa, &str->data);
  137. if (str->length <= 0)
  138. {
  139. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  140. goto err;
  141. }
  142. pval = str;
  143. ptype = V_ASN1_SEQUENCE;
  144. }
  145. else
  146. ptype = V_ASN1_UNDEF;
  147. dsa->write_params=0;
  148. penclen = i2d_DSAPublicKey(dsa, &penc);
  149. if (penclen <= 0)
  150. {
  151. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  152. goto err;
  153. }
  154. if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA),
  155. ptype, pval, penc, penclen))
  156. return 1;
  157. err:
  158. if (penc)
  159. OPENSSL_free(penc);
  160. if (pval)
  161. ASN1_STRING_free(pval);
  162. return 0;
  163. }
  164. /* In PKCS#8 DSA: you just get a private key integer and parameters in the
  165. * AlgorithmIdentifier the pubkey must be recalculated.
  166. */
  167. static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
  168. {
  169. const unsigned char *p, *pm;
  170. int pklen, pmlen;
  171. int ptype;
  172. void *pval;
  173. ASN1_STRING *pstr;
  174. X509_ALGOR *palg;
  175. ASN1_INTEGER *privkey = NULL;
  176. BN_CTX *ctx = NULL;
  177. STACK_OF(ASN1_TYPE) *ndsa = NULL;
  178. DSA *dsa = NULL;
  179. if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
  180. return 0;
  181. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  182. /* Check for broken DSA PKCS#8, UGH! */
  183. if (*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED))
  184. {
  185. ASN1_TYPE *t1, *t2;
  186. if(!(ndsa = d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen)));
  187. goto decerr;
  188. if (sk_ASN1_TYPE_num(ndsa) != 2)
  189. goto decerr;
  190. /* Handle Two broken types:
  191. * SEQUENCE {parameters, priv_key}
  192. * SEQUENCE {pub_key, priv_key}
  193. */
  194. t1 = sk_ASN1_TYPE_value(ndsa, 0);
  195. t2 = sk_ASN1_TYPE_value(ndsa, 1);
  196. if (t1->type == V_ASN1_SEQUENCE)
  197. {
  198. p8->broken = PKCS8_EMBEDDED_PARAM;
  199. pval = t1->value.ptr;
  200. }
  201. else if (ptype == V_ASN1_SEQUENCE)
  202. p8->broken = PKCS8_NS_DB;
  203. else
  204. goto decerr;
  205. if (t2->type != V_ASN1_INTEGER)
  206. goto decerr;
  207. privkey = t2->value.integer;
  208. }
  209. else
  210. {
  211. if (!(privkey=d2i_ASN1_INTEGER(NULL, &p, pklen)))
  212. goto decerr;
  213. if (ptype != V_ASN1_SEQUENCE)
  214. goto decerr;
  215. }
  216. pstr = pval;
  217. pm = pstr->data;
  218. pmlen = pstr->length;
  219. if (!(dsa = d2i_DSAparams(NULL, &pm, pmlen)))
  220. goto decerr;
  221. /* We have parameters now set private key */
  222. if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL)))
  223. {
  224. DSAerr(DSA_F_DSA_PRIV_DECODE,DSA_R_BN_ERROR);
  225. goto dsaerr;
  226. }
  227. /* Calculate public key */
  228. if (!(dsa->pub_key = BN_new()))
  229. {
  230. DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
  231. goto dsaerr;
  232. }
  233. if (!(ctx = BN_CTX_new()))
  234. {
  235. DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
  236. goto dsaerr;
  237. }
  238. if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx))
  239. {
  240. DSAerr(DSA_F_DSA_PRIV_DECODE,DSA_R_BN_ERROR);
  241. goto dsaerr;
  242. }
  243. EVP_PKEY_assign_DSA(pkey, dsa);
  244. BN_CTX_free (ctx);
  245. if(ndsa)
  246. sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
  247. else
  248. ASN1_INTEGER_free(privkey);
  249. return 1;
  250. decerr:
  251. DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR);
  252. dsaerr:
  253. BN_CTX_free (ctx);
  254. if (privkey)
  255. ASN1_INTEGER_free(privkey);
  256. sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
  257. DSA_free(dsa);
  258. return 0;
  259. }
  260. static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
  261. {
  262. ASN1_STRING *params = NULL;
  263. ASN1_INTEGER *prkey = NULL;
  264. unsigned char *dp = NULL;
  265. int dplen;
  266. params = ASN1_STRING_new();
  267. if (!params)
  268. {
  269. DSAerr(DSA_F_DSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
  270. goto err;
  271. }
  272. params->length = i2d_DSAparams(pkey->pkey.dsa, &params->data);
  273. if (params->length <= 0)
  274. {
  275. DSAerr(DSA_F_DSA_PRIV_ENCODE,ERR_R_MALLOC_FAILURE);
  276. goto err;
  277. }
  278. params->type = V_ASN1_SEQUENCE;
  279. /* Get private key into integer */
  280. prkey = BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, NULL);
  281. if (!prkey)
  282. {
  283. DSAerr(DSA_F_DSA_PRIV_ENCODE,DSA_R_BN_ERROR);
  284. goto err;
  285. }
  286. dplen = i2d_ASN1_INTEGER(prkey, &dp);
  287. ASN1_INTEGER_free(prkey);
  288. if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0,
  289. V_ASN1_SEQUENCE, params, dp, dplen))
  290. goto err;
  291. return 1;
  292. err:
  293. if (dp != NULL)
  294. OPENSSL_free(dp);
  295. if (params != NULL)
  296. ASN1_STRING_free(params);
  297. if (prkey != NULL)
  298. ASN1_INTEGER_free(prkey);
  299. return 0;
  300. }
  301. static int int_dsa_size(const EVP_PKEY *pkey)
  302. {
  303. return(DSA_size(pkey->pkey.dsa));
  304. }
  305. static int dsa_bits(const EVP_PKEY *pkey)
  306. {
  307. return BN_num_bits(pkey->pkey.dsa->p);
  308. }
  309. static int dsa_missing_parameters(const EVP_PKEY *pkey)
  310. {
  311. DSA *dsa;
  312. dsa=pkey->pkey.dsa;
  313. if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
  314. return 1;
  315. return 0;
  316. }
  317. static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  318. {
  319. BIGNUM *a;
  320. if ((a=BN_dup(from->pkey.dsa->p)) == NULL)
  321. return 0;
  322. if (to->pkey.dsa->p != NULL)
  323. BN_free(to->pkey.dsa->p);
  324. to->pkey.dsa->p=a;
  325. if ((a=BN_dup(from->pkey.dsa->q)) == NULL)
  326. return 0;
  327. if (to->pkey.dsa->q != NULL)
  328. BN_free(to->pkey.dsa->q);
  329. to->pkey.dsa->q=a;
  330. if ((a=BN_dup(from->pkey.dsa->g)) == NULL)
  331. return 0;
  332. if (to->pkey.dsa->g != NULL)
  333. BN_free(to->pkey.dsa->g);
  334. to->pkey.dsa->g=a;
  335. return 1;
  336. }
  337. static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
  338. {
  339. if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) ||
  340. BN_cmp(a->pkey.dsa->q,b->pkey.dsa->q) ||
  341. BN_cmp(a->pkey.dsa->g,b->pkey.dsa->g))
  342. return 0;
  343. else
  344. return 1;
  345. }
  346. static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
  347. {
  348. if (BN_cmp(b->pkey.dsa->pub_key,a->pkey.dsa->pub_key) != 0)
  349. return 0;
  350. else
  351. return 1;
  352. }
  353. static void int_dsa_free(EVP_PKEY *pkey)
  354. {
  355. DSA_free(pkey->pkey.dsa);
  356. }
  357. static void update_buflen(const BIGNUM *b, size_t *pbuflen)
  358. {
  359. size_t i;
  360. if (!b)
  361. return;
  362. if (*pbuflen < (i = (size_t)BN_num_bytes(b)))
  363. *pbuflen = i;
  364. }
  365. static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
  366. {
  367. unsigned char *m=NULL;
  368. int ret=0;
  369. size_t buf_len=0;
  370. const char *ktype = NULL;
  371. const BIGNUM *priv_key, *pub_key;
  372. if (ptype == 2)
  373. priv_key = x->priv_key;
  374. else
  375. priv_key = NULL;
  376. if (ptype > 0)
  377. pub_key = x->pub_key;
  378. else
  379. pub_key = NULL;
  380. if (ptype == 2)
  381. ktype = "Private-Key";
  382. else if (ptype == 1)
  383. ktype = "Public-Key";
  384. else
  385. ktype = "DSA-Parameters";
  386. update_buflen(x->p, &buf_len);
  387. update_buflen(x->q, &buf_len);
  388. update_buflen(x->g, &buf_len);
  389. update_buflen(priv_key, &buf_len);
  390. update_buflen(pub_key, &buf_len);
  391. m=(unsigned char *)OPENSSL_malloc(buf_len+10);
  392. if (m == NULL)
  393. {
  394. DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
  395. goto err;
  396. }
  397. if (priv_key)
  398. {
  399. if(!BIO_indent(bp,off,128))
  400. goto err;
  401. if (BIO_printf(bp,"%s: (%d bit)\n",ktype, BN_num_bits(x->p))
  402. <= 0) goto err;
  403. }
  404. if (!ASN1_bn_print(bp,"priv:",priv_key,m,off))
  405. goto err;
  406. if (!ASN1_bn_print(bp,"pub: ",pub_key,m,off))
  407. goto err;
  408. if (!ASN1_bn_print(bp,"P: ",x->p,m,off)) goto err;
  409. if (!ASN1_bn_print(bp,"Q: ",x->q,m,off)) goto err;
  410. if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err;
  411. ret=1;
  412. err:
  413. if (m != NULL) OPENSSL_free(m);
  414. return(ret);
  415. }
  416. static int dsa_param_decode(EVP_PKEY *pkey,
  417. const unsigned char **pder, int derlen)
  418. {
  419. DSA *dsa;
  420. if (!(dsa = d2i_DSAparams(NULL, pder, derlen)))
  421. {
  422. DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB);
  423. return 0;
  424. }
  425. EVP_PKEY_assign_DSA(pkey, dsa);
  426. return 1;
  427. }
  428. static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
  429. {
  430. return i2d_DSAparams(pkey->pkey.dsa, pder);
  431. }
  432. static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  433. ASN1_PCTX *ctx)
  434. {
  435. return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);
  436. }
  437. static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  438. ASN1_PCTX *ctx)
  439. {
  440. return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);
  441. }
  442. static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  443. ASN1_PCTX *ctx)
  444. {
  445. return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);
  446. }
  447. static int old_dsa_priv_decode(EVP_PKEY *pkey,
  448. const unsigned char **pder, int derlen)
  449. {
  450. DSA *dsa;
  451. if (!(dsa = d2i_DSAPrivateKey (NULL, pder, derlen)))
  452. {
  453. DSAerr(DSA_F_OLD_DSA_PRIV_DECODE, ERR_R_DSA_LIB);
  454. return 0;
  455. }
  456. EVP_PKEY_assign_DSA(pkey, dsa);
  457. return 1;
  458. }
  459. static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
  460. {
  461. return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);
  462. }
  463. static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
  464. {
  465. switch (op)
  466. {
  467. case ASN1_PKEY_CTRL_PKCS7_SIGN:
  468. if (arg1 == 0)
  469. {
  470. int snid, hnid;
  471. X509_ALGOR *alg1, *alg2;
  472. PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
  473. if (alg1 == NULL || alg1->algorithm == NULL)
  474. return -1;
  475. hnid = OBJ_obj2nid(alg1->algorithm);
  476. if (hnid == NID_undef)
  477. return -1;
  478. if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
  479. return -1;
  480. X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
  481. }
  482. return 1;
  483. #ifndef OPENSSL_NO_CMS
  484. case ASN1_PKEY_CTRL_CMS_SIGN:
  485. if (arg1 == 0)
  486. {
  487. int snid, hnid;
  488. X509_ALGOR *alg1, *alg2;
  489. CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2);
  490. if (alg1 == NULL || alg1->algorithm == NULL)
  491. return -1;
  492. hnid = OBJ_obj2nid(alg1->algorithm);
  493. if (hnid == NID_undef)
  494. return -1;
  495. if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
  496. return -1;
  497. X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
  498. }
  499. return 1;
  500. #endif
  501. case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
  502. *(int *)arg2 = NID_sha1;
  503. return 2;
  504. default:
  505. return -2;
  506. }
  507. }
  508. /* NB these are sorted in pkey_id order, lowest first */
  509. const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] =
  510. {
  511. {
  512. EVP_PKEY_DSA2,
  513. EVP_PKEY_DSA,
  514. ASN1_PKEY_ALIAS
  515. },
  516. {
  517. EVP_PKEY_DSA1,
  518. EVP_PKEY_DSA,
  519. ASN1_PKEY_ALIAS
  520. },
  521. {
  522. EVP_PKEY_DSA4,
  523. EVP_PKEY_DSA,
  524. ASN1_PKEY_ALIAS
  525. },
  526. {
  527. EVP_PKEY_DSA3,
  528. EVP_PKEY_DSA,
  529. ASN1_PKEY_ALIAS
  530. },
  531. {
  532. EVP_PKEY_DSA,
  533. EVP_PKEY_DSA,
  534. 0,
  535. "DSA",
  536. "OpenSSL DSA method",
  537. dsa_pub_decode,
  538. dsa_pub_encode,
  539. dsa_pub_cmp,
  540. dsa_pub_print,
  541. dsa_priv_decode,
  542. dsa_priv_encode,
  543. dsa_priv_print,
  544. int_dsa_size,
  545. dsa_bits,
  546. dsa_param_decode,
  547. dsa_param_encode,
  548. dsa_missing_parameters,
  549. dsa_copy_parameters,
  550. dsa_cmp_parameters,
  551. dsa_param_print,
  552. int_dsa_free,
  553. dsa_pkey_ctrl,
  554. old_dsa_priv_decode,
  555. old_dsa_priv_encode
  556. }
  557. };