dsa_ameth.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /*
  2. * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <stdio.h>
  10. #include <openssl/x509.h>
  11. #include <openssl/asn1.h>
  12. #include <openssl/bn.h>
  13. #include <openssl/cms.h>
  14. #include <openssl/core_names.h>
  15. #include "internal/cryptlib.h"
  16. #include "crypto/asn1.h"
  17. #include "crypto/evp.h"
  18. #include "internal/param_build.h"
  19. #include "dsa_local.h"
  20. static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
  21. {
  22. const unsigned char *p, *pm;
  23. int pklen, pmlen;
  24. int ptype;
  25. const void *pval;
  26. const ASN1_STRING *pstr;
  27. X509_ALGOR *palg;
  28. ASN1_INTEGER *public_key = NULL;
  29. DSA *dsa = NULL;
  30. if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
  31. return 0;
  32. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  33. if (ptype == V_ASN1_SEQUENCE) {
  34. pstr = pval;
  35. pm = pstr->data;
  36. pmlen = pstr->length;
  37. if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL) {
  38. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
  39. goto err;
  40. }
  41. } else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) {
  42. if ((dsa = DSA_new()) == NULL) {
  43. DSAerr(DSA_F_DSA_PUB_DECODE, ERR_R_MALLOC_FAILURE);
  44. goto err;
  45. }
  46. } else {
  47. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_PARAMETER_ENCODING_ERROR);
  48. goto err;
  49. }
  50. if ((public_key = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL) {
  51. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
  52. goto err;
  53. }
  54. if ((dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
  55. DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_BN_DECODE_ERROR);
  56. goto err;
  57. }
  58. dsa->dirty_cnt++;
  59. ASN1_INTEGER_free(public_key);
  60. EVP_PKEY_assign_DSA(pkey, dsa);
  61. return 1;
  62. err:
  63. ASN1_INTEGER_free(public_key);
  64. DSA_free(dsa);
  65. return 0;
  66. }
  67. static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
  68. {
  69. DSA *dsa;
  70. int ptype;
  71. unsigned char *penc = NULL;
  72. int penclen;
  73. ASN1_STRING *str = NULL;
  74. ASN1_INTEGER *pubint = NULL;
  75. ASN1_OBJECT *aobj;
  76. dsa = pkey->pkey.dsa;
  77. if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) {
  78. str = ASN1_STRING_new();
  79. if (str == NULL) {
  80. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  81. goto err;
  82. }
  83. str->length = i2d_DSAparams(dsa, &str->data);
  84. if (str->length <= 0) {
  85. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  86. goto err;
  87. }
  88. ptype = V_ASN1_SEQUENCE;
  89. } else
  90. ptype = V_ASN1_UNDEF;
  91. pubint = BN_to_ASN1_INTEGER(dsa->pub_key, NULL);
  92. if (pubint == NULL) {
  93. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  94. goto err;
  95. }
  96. penclen = i2d_ASN1_INTEGER(pubint, &penc);
  97. ASN1_INTEGER_free(pubint);
  98. if (penclen <= 0) {
  99. DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
  100. goto err;
  101. }
  102. aobj = OBJ_nid2obj(EVP_PKEY_DSA);
  103. if (aobj == NULL)
  104. goto err;
  105. if (X509_PUBKEY_set0_param(pk, aobj, ptype, str, penc, penclen))
  106. return 1;
  107. err:
  108. OPENSSL_free(penc);
  109. ASN1_STRING_free(str);
  110. return 0;
  111. }
  112. /*
  113. * In PKCS#8 DSA: you just get a private key integer and parameters in the
  114. * AlgorithmIdentifier the pubkey must be recalculated.
  115. */
  116. static int dsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
  117. {
  118. const unsigned char *p, *pm;
  119. int pklen, pmlen;
  120. int ptype;
  121. const void *pval;
  122. const ASN1_STRING *pstr;
  123. const X509_ALGOR *palg;
  124. ASN1_INTEGER *privkey = NULL;
  125. BN_CTX *ctx = NULL;
  126. DSA *dsa = NULL;
  127. int ret = 0;
  128. if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
  129. return 0;
  130. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
  131. if ((privkey = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL)
  132. goto decerr;
  133. if (privkey->type == V_ASN1_NEG_INTEGER || ptype != V_ASN1_SEQUENCE)
  134. goto decerr;
  135. pstr = pval;
  136. pm = pstr->data;
  137. pmlen = pstr->length;
  138. if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL)
  139. goto decerr;
  140. /* We have parameters now set private key */
  141. if ((dsa->priv_key = BN_secure_new()) == NULL
  142. || !ASN1_INTEGER_to_BN(privkey, dsa->priv_key)) {
  143. DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
  144. goto dsaerr;
  145. }
  146. /* Calculate public key */
  147. if ((dsa->pub_key = BN_new()) == NULL) {
  148. DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
  149. goto dsaerr;
  150. }
  151. if ((ctx = BN_CTX_new()) == NULL) {
  152. DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
  153. goto dsaerr;
  154. }
  155. BN_set_flags(dsa->priv_key, BN_FLG_CONSTTIME);
  156. if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) {
  157. DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
  158. goto dsaerr;
  159. }
  160. dsa->dirty_cnt++;
  161. EVP_PKEY_assign_DSA(pkey, dsa);
  162. ret = 1;
  163. goto done;
  164. decerr:
  165. DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_DECODE_ERROR);
  166. dsaerr:
  167. DSA_free(dsa);
  168. done:
  169. BN_CTX_free(ctx);
  170. ASN1_STRING_clear_free(privkey);
  171. return ret;
  172. }
  173. static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
  174. {
  175. ASN1_STRING *params = NULL;
  176. ASN1_INTEGER *prkey = NULL;
  177. unsigned char *dp = NULL;
  178. int dplen;
  179. if (pkey->pkey.dsa == NULL|| pkey->pkey.dsa->priv_key == NULL) {
  180. DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_MISSING_PARAMETERS);
  181. goto err;
  182. }
  183. params = ASN1_STRING_new();
  184. if (params == NULL) {
  185. DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
  186. goto err;
  187. }
  188. params->length = i2d_DSAparams(pkey->pkey.dsa, &params->data);
  189. if (params->length <= 0) {
  190. DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
  191. goto err;
  192. }
  193. params->type = V_ASN1_SEQUENCE;
  194. /* Get private key into integer */
  195. prkey = BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, NULL);
  196. if (prkey == NULL) {
  197. DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_BN_ERROR);
  198. goto err;
  199. }
  200. dplen = i2d_ASN1_INTEGER(prkey, &dp);
  201. ASN1_STRING_clear_free(prkey);
  202. prkey = NULL;
  203. if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0,
  204. V_ASN1_SEQUENCE, params, dp, dplen))
  205. goto err;
  206. return 1;
  207. err:
  208. OPENSSL_free(dp);
  209. ASN1_STRING_free(params);
  210. ASN1_STRING_clear_free(prkey);
  211. return 0;
  212. }
  213. static int int_dsa_size(const EVP_PKEY *pkey)
  214. {
  215. return DSA_size(pkey->pkey.dsa);
  216. }
  217. static int dsa_bits(const EVP_PKEY *pkey)
  218. {
  219. return DSA_bits(pkey->pkey.dsa);
  220. }
  221. static int dsa_security_bits(const EVP_PKEY *pkey)
  222. {
  223. return DSA_security_bits(pkey->pkey.dsa);
  224. }
  225. static int dsa_missing_parameters(const EVP_PKEY *pkey)
  226. {
  227. DSA *dsa;
  228. dsa = pkey->pkey.dsa;
  229. if (dsa == NULL || dsa->p == NULL || dsa->q == NULL || dsa->g == NULL)
  230. return 1;
  231. return 0;
  232. }
  233. static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  234. {
  235. BIGNUM *a;
  236. if (to->pkey.dsa == NULL) {
  237. to->pkey.dsa = DSA_new();
  238. if (to->pkey.dsa == NULL)
  239. return 0;
  240. }
  241. if ((a = BN_dup(from->pkey.dsa->p)) == NULL)
  242. return 0;
  243. BN_free(to->pkey.dsa->p);
  244. to->pkey.dsa->p = a;
  245. if ((a = BN_dup(from->pkey.dsa->q)) == NULL)
  246. return 0;
  247. BN_free(to->pkey.dsa->q);
  248. to->pkey.dsa->q = a;
  249. if ((a = BN_dup(from->pkey.dsa->g)) == NULL)
  250. return 0;
  251. BN_free(to->pkey.dsa->g);
  252. to->pkey.dsa->g = a;
  253. to->pkey.dsa->dirty_cnt++;
  254. return 1;
  255. }
  256. static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
  257. {
  258. if (BN_cmp(a->pkey.dsa->p, b->pkey.dsa->p) ||
  259. BN_cmp(a->pkey.dsa->q, b->pkey.dsa->q) ||
  260. BN_cmp(a->pkey.dsa->g, b->pkey.dsa->g))
  261. return 0;
  262. else
  263. return 1;
  264. }
  265. static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
  266. {
  267. if (BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) != 0)
  268. return 0;
  269. else
  270. return 1;
  271. }
  272. static void int_dsa_free(EVP_PKEY *pkey)
  273. {
  274. DSA_free(pkey->pkey.dsa);
  275. }
  276. static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
  277. {
  278. int ret = 0;
  279. const char *ktype = NULL;
  280. const BIGNUM *priv_key, *pub_key;
  281. int mod_len = 0;
  282. if (x->p != NULL)
  283. mod_len = BN_num_bits(x->p);
  284. if (ptype == 2)
  285. priv_key = x->priv_key;
  286. else
  287. priv_key = NULL;
  288. if (ptype > 0)
  289. pub_key = x->pub_key;
  290. else
  291. pub_key = NULL;
  292. if (ptype == 2)
  293. ktype = "Private-Key";
  294. else if (ptype == 1)
  295. ktype = "Public-Key";
  296. else
  297. ktype = "DSA-Parameters";
  298. if (priv_key) {
  299. if (!BIO_indent(bp, off, 128))
  300. goto err;
  301. if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p))
  302. <= 0)
  303. goto err;
  304. } else {
  305. if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0)
  306. goto err;
  307. }
  308. if (!ASN1_bn_print(bp, "priv:", priv_key, NULL, off))
  309. goto err;
  310. if (!ASN1_bn_print(bp, "pub: ", pub_key, NULL, off))
  311. goto err;
  312. if (!ASN1_bn_print(bp, "P: ", x->p, NULL, off))
  313. goto err;
  314. if (!ASN1_bn_print(bp, "Q: ", x->q, NULL, off))
  315. goto err;
  316. if (!ASN1_bn_print(bp, "G: ", x->g, NULL, off))
  317. goto err;
  318. ret = 1;
  319. err:
  320. return ret;
  321. }
  322. static int dsa_param_decode(EVP_PKEY *pkey,
  323. const unsigned char **pder, int derlen)
  324. {
  325. DSA *dsa;
  326. if ((dsa = d2i_DSAparams(NULL, pder, derlen)) == NULL) {
  327. DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB);
  328. return 0;
  329. }
  330. dsa->dirty_cnt++;
  331. EVP_PKEY_assign_DSA(pkey, dsa);
  332. return 1;
  333. }
  334. static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
  335. {
  336. return i2d_DSAparams(pkey->pkey.dsa, pder);
  337. }
  338. static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  339. ASN1_PCTX *ctx)
  340. {
  341. return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);
  342. }
  343. static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  344. ASN1_PCTX *ctx)
  345. {
  346. return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);
  347. }
  348. static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
  349. ASN1_PCTX *ctx)
  350. {
  351. return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);
  352. }
  353. static int old_dsa_priv_decode(EVP_PKEY *pkey,
  354. const unsigned char **pder, int derlen)
  355. {
  356. DSA *dsa;
  357. if ((dsa = d2i_DSAPrivateKey(NULL, pder, derlen)) == NULL) {
  358. DSAerr(DSA_F_OLD_DSA_PRIV_DECODE, ERR_R_DSA_LIB);
  359. return 0;
  360. }
  361. dsa->dirty_cnt++;
  362. EVP_PKEY_assign_DSA(pkey, dsa);
  363. return 1;
  364. }
  365. static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
  366. {
  367. return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);
  368. }
  369. static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
  370. const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx)
  371. {
  372. DSA_SIG *dsa_sig;
  373. const unsigned char *p;
  374. if (!sig) {
  375. if (BIO_puts(bp, "\n") <= 0)
  376. return 0;
  377. else
  378. return 1;
  379. }
  380. p = sig->data;
  381. dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length);
  382. if (dsa_sig) {
  383. int rv = 0;
  384. const BIGNUM *r, *s;
  385. DSA_SIG_get0(dsa_sig, &r, &s);
  386. if (BIO_write(bp, "\n", 1) != 1)
  387. goto err;
  388. if (!ASN1_bn_print(bp, "r: ", r, NULL, indent))
  389. goto err;
  390. if (!ASN1_bn_print(bp, "s: ", s, NULL, indent))
  391. goto err;
  392. rv = 1;
  393. err:
  394. DSA_SIG_free(dsa_sig);
  395. return rv;
  396. }
  397. if (BIO_puts(bp, "\n") <= 0)
  398. return 0;
  399. return X509_signature_dump(bp, sig, indent);
  400. }
  401. static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
  402. {
  403. switch (op) {
  404. case ASN1_PKEY_CTRL_PKCS7_SIGN:
  405. if (arg1 == 0) {
  406. int snid, hnid;
  407. X509_ALGOR *alg1, *alg2;
  408. PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
  409. if (alg1 == NULL || alg1->algorithm == NULL)
  410. return -1;
  411. hnid = OBJ_obj2nid(alg1->algorithm);
  412. if (hnid == NID_undef)
  413. return -1;
  414. if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
  415. return -1;
  416. X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
  417. }
  418. return 1;
  419. #ifndef OPENSSL_NO_CMS
  420. case ASN1_PKEY_CTRL_CMS_SIGN:
  421. if (arg1 == 0) {
  422. int snid, hnid;
  423. X509_ALGOR *alg1, *alg2;
  424. CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2);
  425. if (alg1 == NULL || alg1->algorithm == NULL)
  426. return -1;
  427. hnid = OBJ_obj2nid(alg1->algorithm);
  428. if (hnid == NID_undef)
  429. return -1;
  430. if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
  431. return -1;
  432. X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
  433. }
  434. return 1;
  435. case ASN1_PKEY_CTRL_CMS_RI_TYPE:
  436. *(int *)arg2 = CMS_RECIPINFO_NONE;
  437. return 1;
  438. #endif
  439. case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
  440. *(int *)arg2 = NID_sha256;
  441. return 1;
  442. default:
  443. return -2;
  444. }
  445. }
  446. static size_t dsa_pkey_dirty_cnt(const EVP_PKEY *pkey)
  447. {
  448. return pkey->pkey.dsa->dirty_cnt;
  449. }
  450. static void *dsa_pkey_export_to(const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
  451. int want_domainparams)
  452. {
  453. DSA *dsa = pk->pkey.dsa;
  454. OSSL_PARAM_BLD tmpl;
  455. const BIGNUM *p = DSA_get0_p(dsa), *g = DSA_get0_g(dsa);
  456. const BIGNUM *q = DSA_get0_q(dsa), *pub_key = DSA_get0_pub_key(dsa);
  457. const BIGNUM *priv_key = DSA_get0_priv_key(dsa);
  458. OSSL_PARAM *params;
  459. void *provdata = NULL;
  460. if (p == NULL || q == NULL || g == NULL)
  461. return NULL;
  462. ossl_param_bld_init(&tmpl);
  463. if (!ossl_param_bld_push_BN(&tmpl, OSSL_PKEY_PARAM_FFC_P, p)
  464. || !ossl_param_bld_push_BN(&tmpl, OSSL_PKEY_PARAM_FFC_Q, q)
  465. || !ossl_param_bld_push_BN(&tmpl, OSSL_PKEY_PARAM_FFC_G, g))
  466. return NULL;
  467. if (!want_domainparams) {
  468. /* A key must at least have a public part. */
  469. if (!ossl_param_bld_push_BN(&tmpl, OSSL_PKEY_PARAM_DSA_PUB_KEY,
  470. pub_key))
  471. return NULL;
  472. if (priv_key != NULL) {
  473. if (!ossl_param_bld_push_BN(&tmpl, OSSL_PKEY_PARAM_DSA_PRIV_KEY,
  474. priv_key))
  475. return NULL;
  476. }
  477. }
  478. params = ossl_param_bld_to_param(&tmpl);
  479. /* We export, the provider imports */
  480. provdata = want_domainparams
  481. ? evp_keymgmt_importdomparams(keymgmt, params)
  482. : evp_keymgmt_importkey(keymgmt, params);
  483. ossl_param_bld_free(params);
  484. return provdata;
  485. }
  486. /* NB these are sorted in pkey_id order, lowest first */
  487. const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5] = {
  488. {
  489. EVP_PKEY_DSA2,
  490. EVP_PKEY_DSA,
  491. ASN1_PKEY_ALIAS},
  492. {
  493. EVP_PKEY_DSA1,
  494. EVP_PKEY_DSA,
  495. ASN1_PKEY_ALIAS},
  496. {
  497. EVP_PKEY_DSA4,
  498. EVP_PKEY_DSA,
  499. ASN1_PKEY_ALIAS},
  500. {
  501. EVP_PKEY_DSA3,
  502. EVP_PKEY_DSA,
  503. ASN1_PKEY_ALIAS},
  504. {
  505. EVP_PKEY_DSA,
  506. EVP_PKEY_DSA,
  507. 0,
  508. "DSA",
  509. "OpenSSL DSA method",
  510. dsa_pub_decode,
  511. dsa_pub_encode,
  512. dsa_pub_cmp,
  513. dsa_pub_print,
  514. dsa_priv_decode,
  515. dsa_priv_encode,
  516. dsa_priv_print,
  517. int_dsa_size,
  518. dsa_bits,
  519. dsa_security_bits,
  520. dsa_param_decode,
  521. dsa_param_encode,
  522. dsa_missing_parameters,
  523. dsa_copy_parameters,
  524. dsa_cmp_parameters,
  525. dsa_param_print,
  526. dsa_sig_print,
  527. int_dsa_free,
  528. dsa_pkey_ctrl,
  529. old_dsa_priv_decode,
  530. old_dsa_priv_encode,
  531. NULL, NULL, NULL,
  532. NULL, NULL, NULL,
  533. NULL, NULL, NULL, NULL,
  534. dsa_pkey_dirty_cnt,
  535. dsa_pkey_export_to
  536. }
  537. };