dsa_sig.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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. }
  99. return pdsactx;
  100. }
  101. static int dsa_setup_md(PROV_DSA_CTX *ctx,
  102. const char *mdname, const char *mdprops)
  103. {
  104. if (mdprops == NULL)
  105. mdprops = ctx->propq;
  106. if (mdname != NULL) {
  107. int sha1_allowed = (ctx->operation != EVP_PKEY_OP_SIGN);
  108. WPACKET pkt;
  109. EVP_MD *md = EVP_MD_fetch(ctx->libctx, mdname, mdprops);
  110. int md_nid = ossl_digest_get_approved_nid_with_sha1(ctx->libctx, md,
  111. sha1_allowed);
  112. size_t mdname_len = strlen(mdname);
  113. if (md == NULL || md_nid < 0) {
  114. if (md == NULL)
  115. ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
  116. "%s could not be fetched", mdname);
  117. if (md_nid < 0)
  118. ERR_raise_data(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED,
  119. "digest=%s", mdname);
  120. if (mdname_len >= sizeof(ctx->mdname))
  121. ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
  122. "%s exceeds name buffer length", mdname);
  123. EVP_MD_free(md);
  124. return 0;
  125. }
  126. if (!ctx->flag_allow_md) {
  127. if (ctx->mdname[0] != '\0' && !EVP_MD_is_a(md, ctx->mdname)) {
  128. ERR_raise_data(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED,
  129. "digest %s != %s", mdname, ctx->mdname);
  130. EVP_MD_free(md);
  131. return 0;
  132. }
  133. EVP_MD_free(md);
  134. return 1;
  135. }
  136. EVP_MD_CTX_free(ctx->mdctx);
  137. EVP_MD_free(ctx->md);
  138. /*
  139. * We do not care about DER writing errors.
  140. * All it really means is that for some reason, there's no
  141. * AlgorithmIdentifier to be had, but the operation itself is
  142. * still valid, just as long as it's not used to construct
  143. * anything that needs an AlgorithmIdentifier.
  144. */
  145. ctx->aid_len = 0;
  146. if (WPACKET_init_der(&pkt, ctx->aid_buf, sizeof(ctx->aid_buf))
  147. && ossl_DER_w_algorithmIdentifier_DSA_with_MD(&pkt, -1, ctx->dsa,
  148. md_nid)
  149. && WPACKET_finish(&pkt)) {
  150. WPACKET_get_total_written(&pkt, &ctx->aid_len);
  151. ctx->aid = WPACKET_get_curr(&pkt);
  152. }
  153. WPACKET_cleanup(&pkt);
  154. ctx->mdctx = NULL;
  155. ctx->md = md;
  156. OPENSSL_strlcpy(ctx->mdname, mdname, sizeof(ctx->mdname));
  157. }
  158. return 1;
  159. }
  160. static int dsa_signverify_init(void *vpdsactx, void *vdsa,
  161. const OSSL_PARAM params[], int operation)
  162. {
  163. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  164. if (!ossl_prov_is_running()
  165. || pdsactx == NULL)
  166. return 0;
  167. if (vdsa == NULL && pdsactx->dsa == NULL) {
  168. ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
  169. return 0;
  170. }
  171. if (vdsa != NULL) {
  172. if (!ossl_dsa_check_key(pdsactx->libctx, vdsa,
  173. operation == EVP_PKEY_OP_SIGN)) {
  174. ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
  175. return 0;
  176. }
  177. if (!DSA_up_ref(vdsa))
  178. return 0;
  179. DSA_free(pdsactx->dsa);
  180. pdsactx->dsa = vdsa;
  181. }
  182. pdsactx->operation = operation;
  183. if (!dsa_set_ctx_params(pdsactx, params))
  184. return 0;
  185. return 1;
  186. }
  187. static int dsa_sign_init(void *vpdsactx, void *vdsa, const OSSL_PARAM params[])
  188. {
  189. return dsa_signverify_init(vpdsactx, vdsa, params, EVP_PKEY_OP_SIGN);
  190. }
  191. static int dsa_verify_init(void *vpdsactx, void *vdsa,
  192. const OSSL_PARAM params[])
  193. {
  194. return dsa_signverify_init(vpdsactx, vdsa, params, EVP_PKEY_OP_VERIFY);
  195. }
  196. static int dsa_sign(void *vpdsactx, unsigned char *sig, size_t *siglen,
  197. size_t sigsize, const unsigned char *tbs, size_t tbslen)
  198. {
  199. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  200. int ret;
  201. unsigned int sltmp;
  202. size_t dsasize = DSA_size(pdsactx->dsa);
  203. size_t mdsize = dsa_get_md_size(pdsactx);
  204. if (!ossl_prov_is_running())
  205. return 0;
  206. if (sig == NULL) {
  207. *siglen = dsasize;
  208. return 1;
  209. }
  210. if (sigsize < (size_t)dsasize)
  211. return 0;
  212. if (mdsize != 0 && tbslen != mdsize)
  213. return 0;
  214. ret = ossl_dsa_sign_int(0, tbs, tbslen, sig, &sltmp, pdsactx->dsa);
  215. if (ret <= 0)
  216. return 0;
  217. *siglen = sltmp;
  218. return 1;
  219. }
  220. static int dsa_verify(void *vpdsactx, const unsigned char *sig, size_t siglen,
  221. const unsigned char *tbs, size_t tbslen)
  222. {
  223. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  224. size_t mdsize = dsa_get_md_size(pdsactx);
  225. if (!ossl_prov_is_running() || (mdsize != 0 && tbslen != mdsize))
  226. return 0;
  227. return DSA_verify(0, tbs, tbslen, sig, siglen, pdsactx->dsa);
  228. }
  229. static int dsa_digest_signverify_init(void *vpdsactx, const char *mdname,
  230. void *vdsa, const OSSL_PARAM params[],
  231. int operation)
  232. {
  233. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  234. if (!ossl_prov_is_running())
  235. return 0;
  236. if (!dsa_signverify_init(vpdsactx, vdsa, params, operation))
  237. return 0;
  238. if (!dsa_setup_md(pdsactx, mdname, NULL))
  239. return 0;
  240. pdsactx->flag_allow_md = 0;
  241. if (pdsactx->mdctx == NULL) {
  242. pdsactx->mdctx = EVP_MD_CTX_new();
  243. if (pdsactx->mdctx == NULL)
  244. goto error;
  245. }
  246. if (!EVP_DigestInit_ex2(pdsactx->mdctx, pdsactx->md, params))
  247. goto error;
  248. return 1;
  249. error:
  250. EVP_MD_CTX_free(pdsactx->mdctx);
  251. pdsactx->mdctx = NULL;
  252. return 0;
  253. }
  254. static int dsa_digest_sign_init(void *vpdsactx, const char *mdname,
  255. void *vdsa, const OSSL_PARAM params[])
  256. {
  257. return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, params,
  258. EVP_PKEY_OP_SIGN);
  259. }
  260. static int dsa_digest_verify_init(void *vpdsactx, const char *mdname,
  261. void *vdsa, const OSSL_PARAM params[])
  262. {
  263. return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, params,
  264. EVP_PKEY_OP_VERIFY);
  265. }
  266. int dsa_digest_signverify_update(void *vpdsactx, const unsigned char *data,
  267. size_t datalen)
  268. {
  269. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  270. if (pdsactx == NULL || pdsactx->mdctx == NULL)
  271. return 0;
  272. return EVP_DigestUpdate(pdsactx->mdctx, data, datalen);
  273. }
  274. int dsa_digest_sign_final(void *vpdsactx, unsigned char *sig, size_t *siglen,
  275. size_t sigsize)
  276. {
  277. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  278. unsigned char digest[EVP_MAX_MD_SIZE];
  279. unsigned int dlen = 0;
  280. if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
  281. return 0;
  282. /*
  283. * If sig is NULL then we're just finding out the sig size. Other fields
  284. * are ignored. Defer to dsa_sign.
  285. */
  286. if (sig != NULL) {
  287. /*
  288. * There is the possibility that some externally provided
  289. * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
  290. * but that problem is much larger than just in DSA.
  291. */
  292. if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
  293. return 0;
  294. }
  295. pdsactx->flag_allow_md = 1;
  296. return dsa_sign(vpdsactx, sig, siglen, sigsize, digest, (size_t)dlen);
  297. }
  298. int dsa_digest_verify_final(void *vpdsactx, const unsigned char *sig,
  299. size_t siglen)
  300. {
  301. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  302. unsigned char digest[EVP_MAX_MD_SIZE];
  303. unsigned int dlen = 0;
  304. if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
  305. return 0;
  306. /*
  307. * There is the possibility that some externally provided
  308. * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
  309. * but that problem is much larger than just in DSA.
  310. */
  311. if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
  312. return 0;
  313. pdsactx->flag_allow_md = 1;
  314. return dsa_verify(vpdsactx, sig, siglen, digest, (size_t)dlen);
  315. }
  316. static void dsa_freectx(void *vpdsactx)
  317. {
  318. PROV_DSA_CTX *ctx = (PROV_DSA_CTX *)vpdsactx;
  319. OPENSSL_free(ctx->propq);
  320. EVP_MD_CTX_free(ctx->mdctx);
  321. EVP_MD_free(ctx->md);
  322. ctx->propq = NULL;
  323. ctx->mdctx = NULL;
  324. ctx->md = NULL;
  325. DSA_free(ctx->dsa);
  326. OPENSSL_free(ctx);
  327. }
  328. static void *dsa_dupctx(void *vpdsactx)
  329. {
  330. PROV_DSA_CTX *srcctx = (PROV_DSA_CTX *)vpdsactx;
  331. PROV_DSA_CTX *dstctx;
  332. if (!ossl_prov_is_running())
  333. return NULL;
  334. dstctx = OPENSSL_zalloc(sizeof(*srcctx));
  335. if (dstctx == NULL)
  336. return NULL;
  337. *dstctx = *srcctx;
  338. dstctx->dsa = NULL;
  339. dstctx->md = NULL;
  340. dstctx->mdctx = NULL;
  341. dstctx->propq = NULL;
  342. if (srcctx->dsa != NULL && !DSA_up_ref(srcctx->dsa))
  343. goto err;
  344. dstctx->dsa = srcctx->dsa;
  345. if (srcctx->md != NULL && !EVP_MD_up_ref(srcctx->md))
  346. goto err;
  347. dstctx->md = srcctx->md;
  348. if (srcctx->mdctx != NULL) {
  349. dstctx->mdctx = EVP_MD_CTX_new();
  350. if (dstctx->mdctx == NULL
  351. || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
  352. goto err;
  353. }
  354. if (srcctx->propq != NULL) {
  355. dstctx->propq = OPENSSL_strdup(srcctx->propq);
  356. if (dstctx->propq == NULL)
  357. goto err;
  358. }
  359. return dstctx;
  360. err:
  361. dsa_freectx(dstctx);
  362. return NULL;
  363. }
  364. static int dsa_get_ctx_params(void *vpdsactx, OSSL_PARAM *params)
  365. {
  366. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  367. OSSL_PARAM *p;
  368. if (pdsactx == NULL)
  369. return 0;
  370. p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_ALGORITHM_ID);
  371. if (p != NULL
  372. && !OSSL_PARAM_set_octet_string(p, pdsactx->aid, pdsactx->aid_len))
  373. return 0;
  374. p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST);
  375. if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pdsactx->mdname))
  376. return 0;
  377. return 1;
  378. }
  379. static const OSSL_PARAM known_gettable_ctx_params[] = {
  380. OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0),
  381. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
  382. OSSL_PARAM_END
  383. };
  384. static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx,
  385. ossl_unused void *provctx)
  386. {
  387. return known_gettable_ctx_params;
  388. }
  389. static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[])
  390. {
  391. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  392. const OSSL_PARAM *p;
  393. if (pdsactx == NULL)
  394. return 0;
  395. if (params == NULL)
  396. return 1;
  397. p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST);
  398. if (p != NULL) {
  399. char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname;
  400. char mdprops[OSSL_MAX_PROPQUERY_SIZE] = "", *pmdprops = mdprops;
  401. const OSSL_PARAM *propsp =
  402. OSSL_PARAM_locate_const(params,
  403. OSSL_SIGNATURE_PARAM_PROPERTIES);
  404. if (!OSSL_PARAM_get_utf8_string(p, &pmdname, sizeof(mdname)))
  405. return 0;
  406. if (propsp != NULL
  407. && !OSSL_PARAM_get_utf8_string(propsp, &pmdprops, sizeof(mdprops)))
  408. return 0;
  409. if (!dsa_setup_md(pdsactx, mdname, mdprops))
  410. return 0;
  411. }
  412. return 1;
  413. }
  414. static const OSSL_PARAM settable_ctx_params[] = {
  415. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
  416. OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
  417. OSSL_PARAM_END
  418. };
  419. static const OSSL_PARAM settable_ctx_params_no_digest[] = {
  420. OSSL_PARAM_END
  421. };
  422. static const OSSL_PARAM *dsa_settable_ctx_params(void *vpdsactx,
  423. ossl_unused void *provctx)
  424. {
  425. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  426. if (pdsactx != NULL && !pdsactx->flag_allow_md)
  427. return settable_ctx_params_no_digest;
  428. return settable_ctx_params;
  429. }
  430. static int dsa_get_ctx_md_params(void *vpdsactx, OSSL_PARAM *params)
  431. {
  432. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  433. if (pdsactx->mdctx == NULL)
  434. return 0;
  435. return EVP_MD_CTX_get_params(pdsactx->mdctx, params);
  436. }
  437. static const OSSL_PARAM *dsa_gettable_ctx_md_params(void *vpdsactx)
  438. {
  439. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  440. if (pdsactx->md == NULL)
  441. return 0;
  442. return EVP_MD_gettable_ctx_params(pdsactx->md);
  443. }
  444. static int dsa_set_ctx_md_params(void *vpdsactx, const OSSL_PARAM params[])
  445. {
  446. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  447. if (pdsactx->mdctx == NULL)
  448. return 0;
  449. return EVP_MD_CTX_set_params(pdsactx->mdctx, params);
  450. }
  451. static const OSSL_PARAM *dsa_settable_ctx_md_params(void *vpdsactx)
  452. {
  453. PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
  454. if (pdsactx->md == NULL)
  455. return 0;
  456. return EVP_MD_settable_ctx_params(pdsactx->md);
  457. }
  458. const OSSL_DISPATCH ossl_dsa_signature_functions[] = {
  459. { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))dsa_newctx },
  460. { OSSL_FUNC_SIGNATURE_SIGN_INIT, (void (*)(void))dsa_sign_init },
  461. { OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))dsa_sign },
  462. { OSSL_FUNC_SIGNATURE_VERIFY_INIT, (void (*)(void))dsa_verify_init },
  463. { OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))dsa_verify },
  464. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT,
  465. (void (*)(void))dsa_digest_sign_init },
  466. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE,
  467. (void (*)(void))dsa_digest_signverify_update },
  468. { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL,
  469. (void (*)(void))dsa_digest_sign_final },
  470. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT,
  471. (void (*)(void))dsa_digest_verify_init },
  472. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE,
  473. (void (*)(void))dsa_digest_signverify_update },
  474. { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL,
  475. (void (*)(void))dsa_digest_verify_final },
  476. { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))dsa_freectx },
  477. { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))dsa_dupctx },
  478. { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, (void (*)(void))dsa_get_ctx_params },
  479. { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS,
  480. (void (*)(void))dsa_gettable_ctx_params },
  481. { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, (void (*)(void))dsa_set_ctx_params },
  482. { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS,
  483. (void (*)(void))dsa_settable_ctx_params },
  484. { OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS,
  485. (void (*)(void))dsa_get_ctx_md_params },
  486. { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS,
  487. (void (*)(void))dsa_gettable_ctx_md_params },
  488. { OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS,
  489. (void (*)(void))dsa_set_ctx_md_params },
  490. { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS,
  491. (void (*)(void))dsa_settable_ctx_md_params },
  492. { 0, NULL }
  493. };