Add fips checks for dsa signatures
[openssl.git] / providers / implementations / signature / dsa.c
1 /*
2  * Copyright 2019-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 /*
11  * DSA low level APIs are deprecated for public use, but still ok for
12  * internal use.
13  */
14 #include "internal/deprecated.h"
15
16 #include <string.h>
17
18 #include <openssl/crypto.h>
19 #include <openssl/core_dispatch.h>
20 #include <openssl/core_names.h>
21 #include <openssl/err.h>
22 #include <openssl/dsa.h>
23 #include <openssl/params.h>
24 #include <openssl/evp.h>
25 #include <openssl/err.h>
26 #include "internal/nelem.h"
27 #include "internal/sizes.h"
28 #include "internal/cryptlib.h"
29 #include "prov/providercommon.h"
30 #include "prov/implementations.h"
31 #include "prov/providercommonerr.h"
32 #include "prov/provider_ctx.h"
33 #include "prov/provider_util.h"
34 #include "crypto/dsa.h"
35 #include "prov/der_dsa.h"
36
37 static OSSL_FUNC_signature_newctx_fn dsa_newctx;
38 static OSSL_FUNC_signature_sign_init_fn dsa_sign_init;
39 static OSSL_FUNC_signature_verify_init_fn dsa_verify_init;
40 static OSSL_FUNC_signature_sign_fn dsa_sign;
41 static OSSL_FUNC_signature_verify_fn dsa_verify;
42 static OSSL_FUNC_signature_digest_sign_init_fn dsa_digest_sign_init;
43 static OSSL_FUNC_signature_digest_sign_update_fn dsa_digest_signverify_update;
44 static OSSL_FUNC_signature_digest_sign_final_fn dsa_digest_sign_final;
45 static OSSL_FUNC_signature_digest_verify_init_fn dsa_digest_verify_init;
46 static OSSL_FUNC_signature_digest_verify_update_fn dsa_digest_signverify_update;
47 static OSSL_FUNC_signature_digest_verify_final_fn dsa_digest_verify_final;
48 static OSSL_FUNC_signature_freectx_fn dsa_freectx;
49 static OSSL_FUNC_signature_dupctx_fn dsa_dupctx;
50 static OSSL_FUNC_signature_get_ctx_params_fn dsa_get_ctx_params;
51 static OSSL_FUNC_signature_gettable_ctx_params_fn dsa_gettable_ctx_params;
52 static OSSL_FUNC_signature_set_ctx_params_fn dsa_set_ctx_params;
53 static OSSL_FUNC_signature_settable_ctx_params_fn dsa_settable_ctx_params;
54 static OSSL_FUNC_signature_get_ctx_md_params_fn dsa_get_ctx_md_params;
55 static OSSL_FUNC_signature_gettable_ctx_md_params_fn dsa_gettable_ctx_md_params;
56 static OSSL_FUNC_signature_set_ctx_md_params_fn dsa_set_ctx_md_params;
57 static OSSL_FUNC_signature_settable_ctx_md_params_fn dsa_settable_ctx_md_params;
58
59 /*
60  * What's passed as an actual key is defined by the KEYMGMT interface.
61  * We happen to know that our KEYMGMT simply passes DSA structures, so
62  * we use that here too.
63  */
64
65 typedef struct {
66     OPENSSL_CTX *libctx;
67     char *propq;
68     DSA *dsa;
69
70     /*
71      * Flag to determine if the hash function can be changed (1) or not (0)
72      * Because it's dangerous to change during a DigestSign or DigestVerify
73      * operation, this flag is cleared by their Init function, and set again
74      * by their Final function.
75      */
76     unsigned int flag_allow_md : 1;
77
78     char mdname[OSSL_MAX_NAME_SIZE];
79
80     /* The Algorithm Identifier of the combined signature algorithm */
81     unsigned char aid_buf[OSSL_MAX_ALGORITHM_ID_SIZE];
82     unsigned char *aid;
83     size_t  aid_len;
84
85     /* main digest */
86     EVP_MD *md;
87     EVP_MD_CTX *mdctx;
88     size_t mdsize;
89     int operation;
90
91 } PROV_DSA_CTX;
92
93 /*
94  * Check for valid key sizes if fips mode. Refer to
95  * https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf
96  * "Table 2"
97  */
98 static int dsa_check_key_size(const PROV_DSA_CTX *ctx)
99 {
100 #ifdef FIPS_MODULE
101     size_t L, N;
102     const BIGNUM *p, *q;
103     DSA *dsa = ctx->dsa;
104
105     if (dsa == NULL)
106         return 0;
107
108     p = DSA_get0_p(dsa);
109     q = DSA_get0_q(dsa);
110     if (p == NULL || q == NULL)
111         return 0;
112
113     L = BN_num_bits(p);
114     N = BN_num_bits(q);
115
116     /*
117      * Valid sizes or verification - Note this could be a fips186-2 type
118      * key - so we allow 512 also. When this is no longer suppported the
119      * lower bound should be increased to 1024.
120      */
121     if (ctx->operation != EVP_PKEY_OP_SIGN)
122         return (L >= 512 && N >= 160);
123
124      /* Valid sizes for both sign and verify */
125     if (L == 2048 && (N == 224 || N == 256))
126         return 1;
127     return (L == 3072 && N == 256);
128 #else
129     return 1;
130 #endif
131 }
132
133 static size_t dsa_get_md_size(const PROV_DSA_CTX *pdsactx)
134 {
135     if (pdsactx->md != NULL)
136         return EVP_MD_size(pdsactx->md);
137     return 0;
138 }
139
140 static int dsa_get_md_nid(const PROV_DSA_CTX *ctx, const EVP_MD *md)
141 {
142     int sha1_allowed = (ctx->operation != EVP_PKEY_OP_SIGN);
143
144     return ossl_prov_digest_get_approved_nid(md, sha1_allowed);
145 }
146
147 static void *dsa_newctx(void *provctx, const char *propq)
148 {
149     PROV_DSA_CTX *pdsactx;
150
151     if (!ossl_prov_is_running())
152         return NULL;
153
154     pdsactx = OPENSSL_zalloc(sizeof(PROV_DSA_CTX));
155     if (pdsactx == NULL)
156         return NULL;
157
158     pdsactx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
159     pdsactx->flag_allow_md = 1;
160     if (propq != NULL && (pdsactx->propq = OPENSSL_strdup(propq)) == NULL) {
161         OPENSSL_free(pdsactx);
162         pdsactx = NULL;
163         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
164     }
165     return pdsactx;
166 }
167
168 static int dsa_setup_md(PROV_DSA_CTX *ctx,
169                         const char *mdname, const char *mdprops)
170 {
171     if (mdprops == NULL)
172         mdprops = ctx->propq;
173
174     if (mdname != NULL) {
175         WPACKET pkt;
176         EVP_MD *md = EVP_MD_fetch(ctx->libctx, mdname, mdprops);
177         int md_nid = dsa_get_md_nid(ctx, md);
178         size_t mdname_len = strlen(mdname);
179
180         if (md == NULL || md_nid == NID_undef) {
181             if (md == NULL)
182                 ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
183                                "%s could not be fetched", mdname);
184             if (md_nid == NID_undef)
185                 ERR_raise_data(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED,
186                                "digest=%s", mdname);
187             if (mdname_len >= sizeof(ctx->mdname))
188                 ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST,
189                                "%s exceeds name buffer length", mdname);
190             EVP_MD_free(md);
191             return 0;
192         }
193
194         EVP_MD_CTX_free(ctx->mdctx);
195         EVP_MD_free(ctx->md);
196
197         /*
198          * TODO(3.0) Should we care about DER writing errors?
199          * All it really means is that for some reason, there's no
200          * AlgorithmIdentifier to be had, but the operation itself is
201          * still valid, just as long as it's not used to construct
202          * anything that needs an AlgorithmIdentifier.
203          */
204         ctx->aid_len = 0;
205         if (WPACKET_init_der(&pkt, ctx->aid_buf, sizeof(ctx->aid_buf))
206             && DER_w_algorithmIdentifier_DSA_with_MD(&pkt, -1, ctx->dsa,
207                                                      md_nid)
208             && WPACKET_finish(&pkt)) {
209             WPACKET_get_total_written(&pkt, &ctx->aid_len);
210             ctx->aid = WPACKET_get_curr(&pkt);
211         }
212         WPACKET_cleanup(&pkt);
213
214         ctx->mdctx = NULL;
215         ctx->md = md;
216         OPENSSL_strlcpy(ctx->mdname, mdname, sizeof(ctx->mdname));
217     }
218     return 1;
219 }
220
221 static int dsa_signverify_init(void *vpdsactx, void *vdsa, int operation)
222 {
223     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
224
225     if (!ossl_prov_is_running()
226             || pdsactx == NULL
227             || vdsa == NULL
228             || !DSA_up_ref(vdsa))
229         return 0;
230     DSA_free(pdsactx->dsa);
231     pdsactx->dsa = vdsa;
232     pdsactx->operation = operation;
233     if (!dsa_check_key_size(pdsactx)) {
234         ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
235         return 0;
236     }
237     return 1;
238 }
239
240 static int dsa_sign_init(void *vpdsactx, void *vdsa)
241 {
242     return dsa_signverify_init(vpdsactx, vdsa, EVP_PKEY_OP_SIGN);
243 }
244
245 static int dsa_verify_init(void *vpdsactx, void *vdsa)
246 {
247     return dsa_signverify_init(vpdsactx, vdsa, EVP_PKEY_OP_VERIFY);
248 }
249
250 static int dsa_sign(void *vpdsactx, unsigned char *sig, size_t *siglen,
251                     size_t sigsize, const unsigned char *tbs, size_t tbslen)
252 {
253     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
254     int ret;
255     unsigned int sltmp;
256     size_t dsasize = DSA_size(pdsactx->dsa);
257     size_t mdsize = dsa_get_md_size(pdsactx);
258
259     if (!ossl_prov_is_running())
260         return 0;
261
262     if (sig == NULL) {
263         *siglen = dsasize;
264         return 1;
265     }
266
267     if (sigsize < (size_t)dsasize)
268         return 0;
269
270     if (mdsize != 0 && tbslen != mdsize)
271         return 0;
272
273     ret = dsa_sign_int(0, tbs, tbslen, sig, &sltmp, pdsactx->dsa);
274     if (ret <= 0)
275         return 0;
276
277     *siglen = sltmp;
278     return 1;
279 }
280
281 static int dsa_verify(void *vpdsactx, const unsigned char *sig, size_t siglen,
282                       const unsigned char *tbs, size_t tbslen)
283 {
284     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
285     size_t mdsize = dsa_get_md_size(pdsactx);
286
287     if (!ossl_prov_is_running() || (mdsize != 0 && tbslen != mdsize))
288         return 0;
289
290     return DSA_verify(0, tbs, tbslen, sig, siglen, pdsactx->dsa);
291 }
292
293 static int dsa_digest_signverify_init(void *vpdsactx, const char *mdname,
294                                       void *vdsa, int operation)
295 {
296     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
297
298     if (!ossl_prov_is_running())
299         return 0;
300
301     pdsactx->flag_allow_md = 0;
302     if (!dsa_signverify_init(vpdsactx, vdsa, operation))
303         return 0;
304
305     if (!dsa_setup_md(pdsactx, mdname, NULL))
306         return 0;
307
308     pdsactx->mdctx = EVP_MD_CTX_new();
309     if (pdsactx->mdctx == NULL)
310         goto error;
311
312     if (!EVP_DigestInit_ex(pdsactx->mdctx, pdsactx->md, NULL))
313         goto error;
314
315     return 1;
316
317  error:
318     EVP_MD_CTX_free(pdsactx->mdctx);
319     EVP_MD_free(pdsactx->md);
320     pdsactx->mdctx = NULL;
321     pdsactx->md = NULL;
322     return 0;
323 }
324
325 static int dsa_digest_sign_init(void *vpdsactx, const char *mdname,
326                                       void *vdsa)
327 {
328     return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, EVP_PKEY_OP_SIGN);
329 }
330
331 static int dsa_digest_verify_init(void *vpdsactx, const char *mdname, void *vdsa)
332 {
333     return dsa_digest_signverify_init(vpdsactx, mdname, vdsa, EVP_PKEY_OP_VERIFY);
334 }
335
336 int dsa_digest_signverify_update(void *vpdsactx, const unsigned char *data,
337                                  size_t datalen)
338 {
339     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
340
341     if (pdsactx == NULL || pdsactx->mdctx == NULL)
342         return 0;
343
344     return EVP_DigestUpdate(pdsactx->mdctx, data, datalen);
345 }
346
347 int dsa_digest_sign_final(void *vpdsactx, unsigned char *sig, size_t *siglen,
348                           size_t sigsize)
349 {
350     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
351     unsigned char digest[EVP_MAX_MD_SIZE];
352     unsigned int dlen = 0;
353
354     if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
355         return 0;
356
357     /*
358      * If sig is NULL then we're just finding out the sig size. Other fields
359      * are ignored. Defer to dsa_sign.
360      */
361     if (sig != NULL) {
362         /*
363          * TODO(3.0): There is the possibility that some externally provided
364          * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
365          * but that problem is much larger than just in DSA.
366          */
367         if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
368             return 0;
369     }
370
371     pdsactx->flag_allow_md = 1;
372
373     return dsa_sign(vpdsactx, sig, siglen, sigsize, digest, (size_t)dlen);
374 }
375
376
377 int dsa_digest_verify_final(void *vpdsactx, const unsigned char *sig,
378                             size_t siglen)
379 {
380     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
381     unsigned char digest[EVP_MAX_MD_SIZE];
382     unsigned int dlen = 0;
383
384     if (!ossl_prov_is_running() || pdsactx == NULL || pdsactx->mdctx == NULL)
385         return 0;
386
387     /*
388      * TODO(3.0): There is the possibility that some externally provided
389      * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
390      * but that problem is much larger than just in DSA.
391      */
392     if (!EVP_DigestFinal_ex(pdsactx->mdctx, digest, &dlen))
393         return 0;
394
395     pdsactx->flag_allow_md = 1;
396
397     return dsa_verify(vpdsactx, sig, siglen, digest, (size_t)dlen);
398 }
399
400 static void dsa_freectx(void *vpdsactx)
401 {
402     PROV_DSA_CTX *ctx = (PROV_DSA_CTX *)vpdsactx;
403
404     OPENSSL_free(ctx->propq);
405     EVP_MD_CTX_free(ctx->mdctx);
406     EVP_MD_free(ctx->md);
407     ctx->propq = NULL;
408     ctx->mdctx = NULL;
409     ctx->md = NULL;
410     ctx->mdsize = 0;
411     DSA_free(ctx->dsa);
412     OPENSSL_free(ctx);
413 }
414
415 static void *dsa_dupctx(void *vpdsactx)
416 {
417     PROV_DSA_CTX *srcctx = (PROV_DSA_CTX *)vpdsactx;
418     PROV_DSA_CTX *dstctx;
419
420     if (!ossl_prov_is_running())
421         return NULL;
422
423     dstctx = OPENSSL_zalloc(sizeof(*srcctx));
424     if (dstctx == NULL)
425         return NULL;
426
427     *dstctx = *srcctx;
428     dstctx->dsa = NULL;
429     dstctx->md = NULL;
430     dstctx->mdctx = NULL;
431
432     if (srcctx->dsa != NULL && !DSA_up_ref(srcctx->dsa))
433         goto err;
434     dstctx->dsa = srcctx->dsa;
435
436     if (srcctx->md != NULL && !EVP_MD_up_ref(srcctx->md))
437         goto err;
438     dstctx->md = srcctx->md;
439
440     if (srcctx->mdctx != NULL) {
441         dstctx->mdctx = EVP_MD_CTX_new();
442         if (dstctx->mdctx == NULL
443                 || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
444             goto err;
445     }
446
447     return dstctx;
448  err:
449     dsa_freectx(dstctx);
450     return NULL;
451 }
452
453 static int dsa_get_ctx_params(void *vpdsactx, OSSL_PARAM *params)
454 {
455     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
456     OSSL_PARAM *p;
457
458     if (pdsactx == NULL || params == NULL)
459         return 0;
460
461     p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_ALGORITHM_ID);
462     if (p != NULL
463         && !OSSL_PARAM_set_octet_string(p, pdsactx->aid, pdsactx->aid_len))
464         return 0;
465
466     p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST);
467     if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pdsactx->mdname))
468         return 0;
469
470     return 1;
471 }
472
473 static const OSSL_PARAM known_gettable_ctx_params[] = {
474     OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0),
475     OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
476     OSSL_PARAM_END
477 };
478
479 static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *vctx)
480 {
481     return known_gettable_ctx_params;
482 }
483
484 static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[])
485 {
486     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
487     const OSSL_PARAM *p;
488
489     if (pdsactx == NULL || params == NULL)
490         return 0;
491
492     p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST);
493     /* Not allowed during certain operations */
494     if (p != NULL && !pdsactx->flag_allow_md)
495         return 0;
496     if (p != NULL) {
497         char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname;
498         char mdprops[OSSL_MAX_PROPQUERY_SIZE] = "", *pmdprops = mdprops;
499         const OSSL_PARAM *propsp =
500             OSSL_PARAM_locate_const(params,
501                                     OSSL_SIGNATURE_PARAM_PROPERTIES);
502
503         if (!OSSL_PARAM_get_utf8_string(p, &pmdname, sizeof(mdname)))
504             return 0;
505         if (propsp != NULL
506             && !OSSL_PARAM_get_utf8_string(propsp, &pmdprops, sizeof(mdprops)))
507             return 0;
508         if (!dsa_setup_md(pdsactx, mdname, mdprops))
509             return 0;
510     }
511
512     return 1;
513 }
514
515 static const OSSL_PARAM known_settable_ctx_params[] = {
516     OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
517     OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
518     OSSL_PARAM_END
519 };
520
521 static const OSSL_PARAM *dsa_settable_ctx_params(ossl_unused void *provctx)
522 {
523     /*
524      * TODO(3.0): Should this function return a different set of settable ctx
525      * params if the ctx is being used for a DigestSign/DigestVerify? In that
526      * case it is not allowed to set the digest size/digest name because the
527      * digest is explicitly set as part of the init.
528      * NOTE: Ideally we would check pdsactx->flag_allow_md, but this is
529      * problematic because there is no nice way of passing the
530      * PROV_DSA_CTX down to this function...
531      * Because we have API's that dont know about their parent..
532      * e.g: EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig).
533      * We could pass NULL for that case (but then how useful is the check?).
534      */
535     return known_settable_ctx_params;
536 }
537
538 static int dsa_get_ctx_md_params(void *vpdsactx, OSSL_PARAM *params)
539 {
540     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
541
542     if (pdsactx->mdctx == NULL)
543         return 0;
544
545     return EVP_MD_CTX_get_params(pdsactx->mdctx, params);
546 }
547
548 static const OSSL_PARAM *dsa_gettable_ctx_md_params(void *vpdsactx)
549 {
550     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
551
552     if (pdsactx->md == NULL)
553         return 0;
554
555     return EVP_MD_gettable_ctx_params(pdsactx->md);
556 }
557
558 static int dsa_set_ctx_md_params(void *vpdsactx, const OSSL_PARAM params[])
559 {
560     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
561
562     if (pdsactx->mdctx == NULL)
563         return 0;
564
565     return EVP_MD_CTX_set_params(pdsactx->mdctx, params);
566 }
567
568 static const OSSL_PARAM *dsa_settable_ctx_md_params(void *vpdsactx)
569 {
570     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
571
572     if (pdsactx->md == NULL)
573         return 0;
574
575     return EVP_MD_settable_ctx_params(pdsactx->md);
576 }
577
578 const OSSL_DISPATCH dsa_signature_functions[] = {
579     { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))dsa_newctx },
580     { OSSL_FUNC_SIGNATURE_SIGN_INIT, (void (*)(void))dsa_sign_init },
581     { OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))dsa_sign },
582     { OSSL_FUNC_SIGNATURE_VERIFY_INIT, (void (*)(void))dsa_verify_init },
583     { OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))dsa_verify },
584     { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT,
585       (void (*)(void))dsa_digest_sign_init },
586     { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE,
587       (void (*)(void))dsa_digest_signverify_update },
588     { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL,
589       (void (*)(void))dsa_digest_sign_final },
590     { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT,
591       (void (*)(void))dsa_digest_verify_init },
592     { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE,
593       (void (*)(void))dsa_digest_signverify_update },
594     { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL,
595       (void (*)(void))dsa_digest_verify_final },
596     { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))dsa_freectx },
597     { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))dsa_dupctx },
598     { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, (void (*)(void))dsa_get_ctx_params },
599     { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS,
600       (void (*)(void))dsa_gettable_ctx_params },
601     { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, (void (*)(void))dsa_set_ctx_params },
602     { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS,
603       (void (*)(void))dsa_settable_ctx_params },
604     { OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS,
605       (void (*)(void))dsa_get_ctx_md_params },
606     { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS,
607       (void (*)(void))dsa_gettable_ctx_md_params },
608     { OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS,
609       (void (*)(void))dsa_set_ctx_md_params },
610     { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS,
611       (void (*)(void))dsa_settable_ctx_md_params },
612     { 0, NULL }
613 };