dsa.c 18 KB

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