dsa_sig.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /*
  2. * Copyright 2019-2021 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 <string.h>
  15. #include <openssl/crypto.h>
  16. #include <openssl/core_dispatch.h>
  17. #include <openssl/core_names.h>
  18. #include <openssl/err.h>
  19. #include <openssl/dsa.h>
  20. #include <openssl/params.h>
  21. #include <openssl/evp.h>
  22. #include <openssl/proverr.h>
  23. #include "internal/nelem.h"
  24. #include "internal/sizes.h"
  25. #include "internal/cryptlib.h"
  26. #include "prov/providercommon.h"
  27. #include "prov/implementations.h"
  28. #include "prov/provider_ctx.h"
  29. #include "prov/securitycheck.h"
  30. #include "crypto/dsa.h"
  31. #include "prov/der_dsa.h"
  32. static OSSL_FUNC_signature_newctx_fn dsa_newctx;
  33. static OSSL_FUNC_signature_sign_init_fn dsa_sign_init;
  34. static OSSL_FUNC_signature_verify_init_fn dsa_verify_init;
  35. static OSSL_FUNC_signature_sign_fn dsa_sign;
  36. static OSSL_FUNC_signature_verify_fn dsa_verify;
  37. static OSSL_FUNC_signature_digest_sign_init_fn dsa_digest_sign_init;
  38. static OSSL_FUNC_signature_digest_sign_update_fn dsa_digest_signverify_update;
  39. static OSSL_FUNC_signature_digest_sign_final_fn dsa_digest_sign_final;
  40. static OSSL_FUNC_signature_digest_verify_init_fn dsa_digest_verify_init;
  41. static OSSL_FUNC_signature_digest_verify_update_fn dsa_digest_signverify_update;
  42. static OSSL_FUNC_signature_digest_verify_final_fn dsa_digest_verify_final;
  43. static OSSL_FUNC_signature_freectx_fn dsa_freectx;
  44. static OSSL_FUNC_signature_dupctx_fn dsa_dupctx;
  45. static OSSL_FUNC_signature_get_ctx_params_fn dsa_get_ctx_params;
  46. static OSSL_FUNC_signature_gettable_ctx_params_fn dsa_gettable_ctx_params;
  47. static OSSL_FUNC_signature_set_ctx_params_fn dsa_set_ctx_params;
  48. static OSSL_FUNC_signature_settable_ctx_params_fn dsa_settable_ctx_params;
  49. static OSSL_FUNC_signature_get_ctx_md_params_fn dsa_get_ctx_md_params;
  50. static OSSL_FUNC_signature_gettable_ctx_md_params_fn dsa_gettable_ctx_md_params;
  51. static OSSL_FUNC_signature_set_ctx_md_params_fn dsa_set_ctx_md_params;
  52. static OSSL_FUNC_signature_settable_ctx_md_params_fn dsa_settable_ctx_md_params;
  53. /*
  54. * What's passed as an actual key is defined by the KEYMGMT interface.
  55. * We happen to know that our KEYMGMT simply passes DSA structures, so
  56. * we use that here too.
  57. */
  58. typedef struct {
  59. OSSL_LIB_CTX *libctx;
  60. char *propq;
  61. DSA *dsa;
  62. /*
  63. * Flag to determine if the hash function can be changed (1) or not (0)
  64. * Because it's dangerous to change during a DigestSign or DigestVerify
  65. * operation, this flag is cleared by their Init function, and set again
  66. * by their Final function.
  67. */
  68. unsigned int flag_allow_md : 1;
  69. char mdname[OSSL_MAX_NAME_SIZE];
  70. /* The Algorithm Identifier of the combined signature algorithm */
  71. unsigned char aid_buf[OSSL_MAX_ALGORITHM_ID_SIZE];
  72. unsigned char *aid;
  73. size_t aid_len;
  74. /* main digest */
  75. EVP_MD *md;
  76. EVP_MD_CTX *mdctx;
  77. int operation;
  78. } PROV_DSA_CTX;
  79. static size_t dsa_get_md_size(const PROV_DSA_CTX *pdsactx)
  80. {
  81. if (pdsactx->md != NULL)
  82. return EVP_MD_get_size(pdsactx->md);
  83. return 0;
  84. }
  85. static void *dsa_newctx(void *provctx, const char *propq)
  86. {
  87. PROV_DSA_CTX *pdsactx;
  88. if (!ossl_prov_is_running())
  89. return NULL;
  90. pdsactx = OPENSSL_zalloc(sizeof(PROV_DSA_CTX));
  91. if (pdsactx == NULL)
  92. return NULL;
  93. pdsactx->libctx = PROV_LIBCTX_OF(provctx);
  94. pdsactx->flag_allow_md = 1;
  95. if (propq != NULL && (pdsactx->propq = OPENSSL_strdup(propq)) == NULL) {
  96. OPENSSL_free(pdsactx);
  97. pdsactx = NULL;
  98. ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
  99. }
  100. return pdsactx;
  101. }
  102. static int dsa_setup_md(PROV_DSA_CTX *ctx,
  103. const char *mdname, const char *mdprops)
  104. {
  105. if (mdprops == NULL)
  106. mdprops = ctx->propq;
  107. if (mdname != NULL) {
  108. int sha1_allowed = (ctx->operation != EVP_PKEY_OP_SIGN);
  109. WPACKET pkt;
  110. EVP_MD *md = EVP_MD_fetch(ctx->libctx, mdname, mdprops);
  111. int md_nid = ossl_digest_get_approved_nid_with_sha1(ctx->libctx, md,
  112. sha1_allowed);
  113. size_t mdname_len = strlen(mdname);
  114. if (md == NULL || md_nid < 0) {
  115. if (md == NULL)
  116. ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
  117. "%s could not be fetched", mdname);
  118. if (md_nid < 0)
  119. ERR_raise_data(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED,
  120. "digest=%s", mdname);
  121. if (mdname_len >= sizeof(ctx->mdname))
  122. ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
  123. "%s exceeds name buffer length", mdname);
  124. EVP_MD_free(md);
  125. return 0;
  126. }
  127. if (!ctx->flag_allow_md) {
  128. if (ctx->mdname[0] != '\0' && !EVP_MD_is_a(md, ctx->mdname)) {
  129. ERR_raise_data(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED,
  130. "digest %s != %s", mdname, ctx->mdname);
  131. EVP_MD_free(md);
  132. return 0;
  133. }
  134. EVP_MD_free(md);
  135. return 1;
  136. }
  137. EVP_MD_CTX_free(ctx->mdctx);
  138. EVP_MD_free(ctx->md);
  139. /*
  140. * We do not care about DER writing errors.
  141. * All it really means is that for some reason, there's no
  142. * AlgorithmIdentifier to be had, but the operation itself is
  143. * still valid, just as long as it's not used to construct
  144. * anything that needs an AlgorithmIdentifier.
  145. */
  146. ctx->aid_len = 0;
  147. if (WPACKET_init_der(&pkt, ctx->aid_buf, sizeof(ctx->aid_buf))
  148. && ossl_DER_w_algorithmIdentifier_DSA_with_MD(&pkt, -1, ctx->dsa,
  149. md_nid)
  150. && WPACKET_finish(&pkt)) {
  151. WPACKET_get_total_written(&pkt, &ctx->aid_len);
  152. ctx->aid = WPACKET_get_curr(&pkt);
  153. }
  154. WPACKET_cleanup(&pkt);
  155. ctx->mdctx = NULL;
  156. ctx->md = md;
  157. OPENSSL_strlcpy(ctx->mdname, mdname, sizeof(ctx->mdname));
  158. }
  159. return 1;
  160. }
  161. static int dsa_signverify_init(void *vpdsactx, void *vdsa,
  162. const OSSL_PARAM params[], int operation)
  163. {
  164. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  165. if (!ossl_prov_is_running()
  166. || pdsactx == NULL)
  167. return 0;
  168. if (vdsa == NULL && pdsactx->dsa == NULL) {
  169. ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
  170. return 0;
  171. }
  172. if (vdsa != NULL) {
  173. if (!ossl_dsa_check_key(pdsactx->libctx, vdsa,
  174. operation == EVP_PKEY_OP_SIGN)) {
  175. ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
  176. return 0;
  177. }
  178. if (!DSA_up_ref(vdsa))
  179. return 0;
  180. DSA_free(pdsactx->dsa);
  181. pdsactx->dsa = vdsa;
  182. }
  183. pdsactx->operation = operation;
  184. if (!dsa_set_ctx_params(pdsactx, params))
  185. return 0;
  186. return 1;
  187. }
  188. static int dsa_sign_init(void *vpdsactx, void *vdsa, const OSSL_PARAM params[])
  189. {
  190. return dsa_signverify_init(vpdsactx, vdsa, params, EVP_PKEY_OP_SIGN);
  191. }
  192. static int dsa_verify_init(void *vpdsactx, void *vdsa,
  193. const OSSL_PARAM params[])
  194. {
  195. return dsa_signverify_init(vpdsactx, vdsa, params, EVP_PKEY_OP_VERIFY);
  196. }
  197. static int dsa_sign(void *vpdsactx, unsigned char *sig, size_t *siglen,
  198. size_t sigsize, const unsigned char *tbs, size_t tbslen)
  199. {
  200. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  201. int ret;
  202. unsigned int sltmp;
  203. size_t dsasize = DSA_size(pdsactx->dsa);
  204. size_t mdsize = dsa_get_md_size(pdsactx);
  205. if (!ossl_prov_is_running())
  206. return 0;
  207. if (sig == NULL) {
  208. *siglen = dsasize;
  209. return 1;
  210. }
  211. if (sigsize < (size_t)dsasize)
  212. return 0;
  213. if (mdsize != 0 && tbslen != mdsize)
  214. return 0;
  215. ret = ossl_dsa_sign_int(0, tbs, tbslen, sig, &sltmp, pdsactx->dsa);
  216. if (ret <= 0)
  217. return 0;
  218. *siglen = sltmp;
  219. return 1;
  220. }
  221. static int dsa_verify(void *vpdsactx, const unsigned char *sig, size_t siglen,
  222. const unsigned char *tbs, size_t tbslen)
  223. {
  224. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  225. size_t mdsize = dsa_get_md_size(pdsactx);
  226. if (!ossl_prov_is_running() || (mdsize != 0 && tbslen != mdsize))
  227. return 0;
  228. return DSA_verify(0, tbs, tbslen, sig, siglen, pdsactx->dsa);
  229. }
  230. static int dsa_digest_signverify_init(void *vpdsactx, const char *mdname,
  231. void *vdsa, const OSSL_PARAM params[],
  232. int operation)
  233. {
  234. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  235. if (!ossl_prov_is_running())
  236. return 0;
  237. if (!dsa_signverify_init(vpdsactx, vdsa, params, operation))
  238. return 0;
  239. if (!dsa_setup_md(pdsactx, mdname, NULL))
  240. return 0;
  241. pdsactx->flag_allow_md = 0;
  242. if (pdsactx->mdctx == NULL) {
  243. pdsactx->mdctx = EVP_MD_CTX_new();
  244. if (pdsactx->mdctx == NULL)
  245. goto error;
  246. }
  247. if (!EVP_DigestInit_ex2(pdsactx->mdctx, pdsactx->md, params))
  248. goto error;
  249. return 1;
  250. error:
  251. EVP_MD_CTX_free(pdsactx->mdctx);
  252. pdsactx->mdctx = NULL;
  253. return 0;
  254. }
  255. static int dsa_digest_sign_init(void *vpdsactx, const char *mdname,
  256. void *vdsa, const OSSL_PARAM params[])
  257. {
  258. return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, params,
  259. EVP_PKEY_OP_SIGN);
  260. }
  261. static int dsa_digest_verify_init(void *vpdsactx, const char *mdname,
  262. void *vdsa, const OSSL_PARAM params[])
  263. {
  264. return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, params,
  265. EVP_PKEY_OP_VERIFY);
  266. }
  267. int dsa_digest_signverify_update(void *vpdsactx, const unsigned char *data,
  268. size_t datalen)
  269. {
  270. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  271. if (pdsactx == NULL || pdsactx->mdctx == NULL)
  272. return 0;
  273. return EVP_DigestUpdate(pdsactx->mdctx, data, datalen);
  274. }
  275. int dsa_digest_sign_final(void *vpdsactx, unsigned char *sig, size_t *siglen,
  276. size_t sigsize)
  277. {
  278. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  279. unsigned char digest[EVP_MAX_MD_SIZE];
  280. unsigned int dlen = 0;
  281. if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
  282. return 0;
  283. /*
  284. * If sig is NULL then we're just finding out the sig size. Other fields
  285. * are ignored. Defer to dsa_sign.
  286. */
  287. if (sig != NULL) {
  288. /*
  289. * There is the possibility that some externally provided
  290. * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
  291. * but that problem is much larger than just in DSA.
  292. */
  293. if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
  294. return 0;
  295. }
  296. pdsactx->flag_allow_md = 1;
  297. return dsa_sign(vpdsactx, sig, siglen, sigsize, digest, (size_t)dlen);
  298. }
  299. int dsa_digest_verify_final(void *vpdsactx, const unsigned char *sig,
  300. size_t siglen)
  301. {
  302. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  303. unsigned char digest[EVP_MAX_MD_SIZE];
  304. unsigned int dlen = 0;
  305. if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
  306. return 0;
  307. /*
  308. * There is the possibility that some externally provided
  309. * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
  310. * but that problem is much larger than just in DSA.
  311. */
  312. if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
  313. return 0;
  314. pdsactx->flag_allow_md = 1;
  315. return dsa_verify(vpdsactx, sig, siglen, digest, (size_t)dlen);
  316. }
  317. static void dsa_freectx(void *vpdsactx)
  318. {
  319. PROV_DSA_CTX *ctx = (PROV_DSA_CTX *)vpdsactx;
  320. OPENSSL_free(ctx->propq);
  321. EVP_MD_CTX_free(ctx->mdctx);
  322. EVP_MD_free(ctx->md);
  323. ctx->propq = NULL;
  324. ctx->mdctx = NULL;
  325. ctx->md = NULL;
  326. DSA_free(ctx->dsa);
  327. OPENSSL_free(ctx);
  328. }
  329. static void *dsa_dupctx(void *vpdsactx)
  330. {
  331. PROV_DSA_CTX *srcctx = (PROV_DSA_CTX *)vpdsactx;
  332. PROV_DSA_CTX *dstctx;
  333. if (!ossl_prov_is_running())
  334. return NULL;
  335. dstctx = OPENSSL_zalloc(sizeof(*srcctx));
  336. if (dstctx == NULL)
  337. return NULL;
  338. *dstctx = *srcctx;
  339. dstctx->dsa = NULL;
  340. dstctx->md = NULL;
  341. dstctx->mdctx = NULL;
  342. dstctx->propq = NULL;
  343. if (srcctx->dsa != NULL && !DSA_up_ref(srcctx->dsa))
  344. goto err;
  345. dstctx->dsa = srcctx->dsa;
  346. if (srcctx->md != NULL && !EVP_MD_up_ref(srcctx->md))
  347. goto err;
  348. dstctx->md = srcctx->md;
  349. if (srcctx->mdctx != NULL) {
  350. dstctx->mdctx = EVP_MD_CTX_new();
  351. if (dstctx->mdctx == NULL
  352. || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
  353. goto err;
  354. }
  355. if (srcctx->propq != NULL) {
  356. dstctx->propq = OPENSSL_strdup(srcctx->propq);
  357. if (dstctx->propq == NULL)
  358. goto err;
  359. }
  360. return dstctx;
  361. err:
  362. dsa_freectx(dstctx);
  363. return NULL;
  364. }
  365. static int dsa_get_ctx_params(void *vpdsactx, OSSL_PARAM *params)
  366. {
  367. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  368. OSSL_PARAM *p;
  369. if (pdsactx == NULL)
  370. return 0;
  371. p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_ALGORITHM_ID);
  372. if (p != NULL
  373. && !OSSL_PARAM_set_octet_string(p, pdsactx->aid, pdsactx->aid_len))
  374. return 0;
  375. p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST);
  376. if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pdsactx->mdname))
  377. return 0;
  378. return 1;
  379. }
  380. static const OSSL_PARAM known_gettable_ctx_params[] = {
  381. OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0),
  382. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
  383. OSSL_PARAM_END
  384. };
  385. static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx,
  386. ossl_unused void *provctx)
  387. {
  388. return known_gettable_ctx_params;
  389. }
  390. static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[])
  391. {
  392. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  393. const OSSL_PARAM *p;
  394. if (pdsactx == NULL)
  395. return 0;
  396. if (params == NULL)
  397. return 1;
  398. p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST);
  399. if (p != NULL) {
  400. char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname;
  401. char mdprops[OSSL_MAX_PROPQUERY_SIZE] = "", *pmdprops = mdprops;
  402. const OSSL_PARAM *propsp =
  403. OSSL_PARAM_locate_const(params,
  404. OSSL_SIGNATURE_PARAM_PROPERTIES);
  405. if (!OSSL_PARAM_get_utf8_string(p, &pmdname, sizeof(mdname)))
  406. return 0;
  407. if (propsp != NULL
  408. && !OSSL_PARAM_get_utf8_string(propsp, &pmdprops, sizeof(mdprops)))
  409. return 0;
  410. if (!dsa_setup_md(pdsactx, mdname, mdprops))
  411. return 0;
  412. }
  413. return 1;
  414. }
  415. static const OSSL_PARAM settable_ctx_params[] = {
  416. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
  417. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
  418. OSSL_PARAM_END
  419. };
  420. static const OSSL_PARAM settable_ctx_params_no_digest[] = {
  421. OSSL_PARAM_END
  422. };
  423. static const OSSL_PARAM *dsa_settable_ctx_params(void *vpdsactx,
  424. ossl_unused void *provctx)
  425. {
  426. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  427. if (pdsactx != NULL && !pdsactx->flag_allow_md)
  428. return settable_ctx_params_no_digest;
  429. return settable_ctx_params;
  430. }
  431. static int dsa_get_ctx_md_params(void *vpdsactx, OSSL_PARAM *params)
  432. {
  433. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  434. if (pdsactx->mdctx == NULL)
  435. return 0;
  436. return EVP_MD_CTX_get_params(pdsactx->mdctx, params);
  437. }
  438. static const OSSL_PARAM *dsa_gettable_ctx_md_params(void *vpdsactx)
  439. {
  440. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  441. if (pdsactx->md == NULL)
  442. return 0;
  443. return EVP_MD_gettable_ctx_params(pdsactx->md);
  444. }
  445. static int dsa_set_ctx_md_params(void *vpdsactx, const OSSL_PARAM params[])
  446. {
  447. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  448. if (pdsactx->mdctx == NULL)
  449. return 0;
  450. return EVP_MD_CTX_set_params(pdsactx->mdctx, params);
  451. }
  452. static const OSSL_PARAM *dsa_settable_ctx_md_params(void *vpdsactx)
  453. {
  454. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  455. if (pdsactx->md == NULL)
  456. return 0;
  457. return EVP_MD_settable_ctx_params(pdsactx->md);
  458. }
  459. const OSSL_DISPATCH ossl_dsa_signature_functions[] = {
  460. { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))dsa_newctx },
  461. { OSSL_FUNC_SIGNATURE_SIGN_INIT, (void (*)(void))dsa_sign_init },
  462. { OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))dsa_sign },
  463. { OSSL_FUNC_SIGNATURE_VERIFY_INIT, (void (*)(void))dsa_verify_init },
  464. { OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))dsa_verify },
  465. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT,
  466. (void (*)(void))dsa_digest_sign_init },
  467. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE,
  468. (void (*)(void))dsa_digest_signverify_update },
  469. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL,
  470. (void (*)(void))dsa_digest_sign_final },
  471. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT,
  472. (void (*)(void))dsa_digest_verify_init },
  473. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE,
  474. (void (*)(void))dsa_digest_signverify_update },
  475. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL,
  476. (void (*)(void))dsa_digest_verify_final },
  477. { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))dsa_freectx },
  478. { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))dsa_dupctx },
  479. { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, (void (*)(void))dsa_get_ctx_params },
  480. { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS,
  481. (void (*)(void))dsa_gettable_ctx_params },
  482. { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, (void (*)(void))dsa_set_ctx_params },
  483. { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS,
  484. (void (*)(void))dsa_settable_ctx_params },
  485. { OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS,
  486. (void (*)(void))dsa_get_ctx_md_params },
  487. { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS,
  488. (void (*)(void))dsa_gettable_ctx_md_params },
  489. { OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS,
  490. (void (*)(void))dsa_set_ctx_md_params },
  491. { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS,
  492. (void (*)(void))dsa_settable_ctx_md_params },
  493. { 0, NULL }
  494. };