dsa_ameth.c 16 KB

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