/src/openssl/providers/implementations/signature/ml_dsa_sig.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2024-2025 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 | | #include "internal/deprecated.h" |
11 | | |
12 | | #include <assert.h> |
13 | | #include <string.h> /* memset */ |
14 | | #include <openssl/core_names.h> |
15 | | #include <openssl/err.h> |
16 | | #include <openssl/rand.h> |
17 | | #include <openssl/proverr.h> |
18 | | #include "prov/implementations.h" |
19 | | #include "prov/providercommon.h" |
20 | | #include "prov/provider_ctx.h" |
21 | | #include "prov/der_ml_dsa.h" |
22 | | #include "crypto/ml_dsa.h" |
23 | | #include "internal/common.h" |
24 | | #include "internal/packet.h" |
25 | | #include "internal/sizes.h" |
26 | | |
27 | | #define ml_dsa_set_ctx_params_st ml_dsa_verifymsg_set_ctx_params_st |
28 | | #define ml_dsa_set_ctx_params_decoder ml_dsa_verifymsg_set_ctx_params_decoder |
29 | | |
30 | | #include "providers/implementations/signature/ml_dsa_sig.inc" |
31 | | |
32 | | #define ML_DSA_MESSAGE_ENCODE_RAW 0 |
33 | 0 | #define ML_DSA_MESSAGE_ENCODE_PURE 1 |
34 | | |
35 | | static OSSL_FUNC_signature_sign_message_init_fn ml_dsa_sign_msg_init; |
36 | | static OSSL_FUNC_signature_sign_message_update_fn ml_dsa_signverify_msg_update; |
37 | | static OSSL_FUNC_signature_sign_message_final_fn ml_dsa_sign_msg_final; |
38 | | static OSSL_FUNC_signature_sign_fn ml_dsa_sign; |
39 | | static OSSL_FUNC_signature_verify_message_init_fn ml_dsa_verify_msg_init; |
40 | | static OSSL_FUNC_signature_verify_message_update_fn ml_dsa_signverify_msg_update; |
41 | | static OSSL_FUNC_signature_verify_message_final_fn ml_dsa_verify_msg_final; |
42 | | static OSSL_FUNC_signature_verify_fn ml_dsa_verify; |
43 | | static OSSL_FUNC_signature_digest_sign_init_fn ml_dsa_digest_signverify_init; |
44 | | static OSSL_FUNC_signature_digest_sign_fn ml_dsa_digest_sign; |
45 | | static OSSL_FUNC_signature_digest_verify_fn ml_dsa_digest_verify; |
46 | | static OSSL_FUNC_signature_freectx_fn ml_dsa_freectx; |
47 | | static OSSL_FUNC_signature_set_ctx_params_fn ml_dsa_set_ctx_params; |
48 | | static OSSL_FUNC_signature_settable_ctx_params_fn ml_dsa_settable_ctx_params; |
49 | | static OSSL_FUNC_signature_get_ctx_params_fn ml_dsa_get_ctx_params; |
50 | | static OSSL_FUNC_signature_gettable_ctx_params_fn ml_dsa_gettable_ctx_params; |
51 | | static OSSL_FUNC_signature_dupctx_fn ml_dsa_dupctx; |
52 | | |
53 | | typedef struct { |
54 | | ML_DSA_KEY *key; |
55 | | OSSL_LIB_CTX *libctx; |
56 | | uint8_t context_string[ML_DSA_MAX_CONTEXT_STRING_LEN]; |
57 | | size_t context_string_len; |
58 | | uint8_t test_entropy[ML_DSA_ENTROPY_LEN]; |
59 | | size_t test_entropy_len; |
60 | | int msg_encode; |
61 | | int deterministic; |
62 | | int evp_type; |
63 | | /* The Algorithm Identifier of the signature algorithm */ |
64 | | uint8_t aid_buf[OSSL_MAX_ALGORITHM_ID_SIZE]; |
65 | | size_t aid_len; |
66 | | int mu; /* Flag indicating we should begin from \mu, not the message */ |
67 | | |
68 | | int operation; |
69 | | EVP_MD_CTX *md_ctx; /* Ctx for msg_init/update/final interface */ |
70 | | unsigned char *sig; /* Signature, for verification */ |
71 | | size_t siglen; |
72 | | } PROV_ML_DSA_CTX; |
73 | | |
74 | | static void ml_dsa_freectx(void *vctx) |
75 | 0 | { |
76 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
77 | |
|
78 | 0 | EVP_MD_CTX_free(ctx->md_ctx); |
79 | 0 | OPENSSL_cleanse(ctx->test_entropy, ctx->test_entropy_len); |
80 | 0 | OPENSSL_free(ctx->sig); |
81 | 0 | OPENSSL_free(ctx); |
82 | 0 | } |
83 | | |
84 | | static void *ml_dsa_newctx(void *provctx, int evp_type, const char *propq) |
85 | 0 | { |
86 | 0 | PROV_ML_DSA_CTX *ctx; |
87 | |
|
88 | 0 | if (!ossl_prov_is_running()) |
89 | 0 | return NULL; |
90 | | |
91 | 0 | ctx = OPENSSL_zalloc(sizeof(PROV_ML_DSA_CTX)); |
92 | 0 | if (ctx == NULL) |
93 | 0 | return NULL; |
94 | | |
95 | 0 | ctx->libctx = PROV_LIBCTX_OF(provctx); |
96 | 0 | ctx->msg_encode = ML_DSA_MESSAGE_ENCODE_PURE; |
97 | 0 | ctx->evp_type = evp_type; |
98 | 0 | return ctx; |
99 | 0 | } |
100 | | |
101 | | static void *ml_dsa_dupctx(void *vctx) |
102 | 0 | { |
103 | 0 | PROV_ML_DSA_CTX *srcctx = (PROV_ML_DSA_CTX *)vctx; |
104 | 0 | PROV_ML_DSA_CTX *dstctx; |
105 | |
|
106 | 0 | if (!ossl_prov_is_running()) |
107 | 0 | return NULL; |
108 | | |
109 | | /* |
110 | | * Note that the ML_DSA_KEY is ref counted via EVP_PKEY so we can just copy |
111 | | * the key here. |
112 | | */ |
113 | 0 | dstctx = OPENSSL_memdup(srcctx, sizeof(*srcctx)); |
114 | |
|
115 | 0 | if (dstctx == NULL) |
116 | 0 | return NULL; |
117 | | |
118 | 0 | if (srcctx->sig != NULL) { |
119 | 0 | dstctx->sig = OPENSSL_memdup(srcctx->sig, srcctx->siglen); |
120 | 0 | if (dstctx->sig == NULL) { |
121 | | /* |
122 | | * Can't call ml_dsa_freectx() here, as it would free |
123 | | * md_ctx which has not been duplicated yet. |
124 | | */ |
125 | 0 | OPENSSL_free(dstctx); |
126 | 0 | return NULL; |
127 | 0 | } |
128 | 0 | } |
129 | | |
130 | 0 | if (srcctx->md_ctx != NULL) { |
131 | 0 | dstctx->md_ctx = EVP_MD_CTX_dup(srcctx->md_ctx); |
132 | 0 | if (dstctx->md_ctx == NULL) { |
133 | 0 | ml_dsa_freectx(dstctx); |
134 | 0 | return NULL; |
135 | 0 | } |
136 | 0 | } |
137 | | |
138 | 0 | return dstctx; |
139 | 0 | } |
140 | | |
141 | | static int set_alg_id_buffer(PROV_ML_DSA_CTX *ctx) |
142 | 0 | { |
143 | 0 | int ret; |
144 | 0 | WPACKET pkt; |
145 | 0 | uint8_t *aid = NULL; |
146 | | |
147 | | /* |
148 | | * We do not care about DER writing errors. |
149 | | * All it really means is that for some reason, there's no |
150 | | * AlgorithmIdentifier to be had, but the operation itself is |
151 | | * still valid, just as long as it's not used to construct |
152 | | * anything that needs an AlgorithmIdentifier. |
153 | | */ |
154 | 0 | ctx->aid_len = 0; |
155 | 0 | ret = WPACKET_init_der(&pkt, ctx->aid_buf, sizeof(ctx->aid_buf)); |
156 | 0 | ret = ret && ossl_DER_w_algorithmIdentifier_ML_DSA(&pkt, -1, ctx->key); |
157 | 0 | if (ret && WPACKET_finish(&pkt)) { |
158 | 0 | WPACKET_get_total_written(&pkt, &ctx->aid_len); |
159 | 0 | aid = WPACKET_get_curr(&pkt); |
160 | 0 | } |
161 | 0 | WPACKET_cleanup(&pkt); |
162 | 0 | if (aid != NULL && ctx->aid_len != 0) |
163 | 0 | memmove(ctx->aid_buf, aid, ctx->aid_len); |
164 | 0 | return 1; |
165 | 0 | } |
166 | | |
167 | | static int ml_dsa_signverify_msg_init(void *vctx, void *vkey, |
168 | | const OSSL_PARAM params[], int operation, |
169 | | const char *desc) |
170 | 0 | { |
171 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
172 | 0 | ML_DSA_KEY *key = vkey; |
173 | |
|
174 | 0 | if (!ossl_prov_is_running() |
175 | 0 | || ctx == NULL) |
176 | 0 | return 0; |
177 | | |
178 | 0 | if (vkey == NULL && ctx->key == NULL) { |
179 | 0 | ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET); |
180 | 0 | return 0; |
181 | 0 | } |
182 | | |
183 | 0 | if (key != NULL) |
184 | 0 | ctx->key = vkey; |
185 | 0 | if (!ossl_ml_dsa_key_matches(ctx->key, ctx->evp_type)) |
186 | 0 | return 0; |
187 | | |
188 | 0 | set_alg_id_buffer(ctx); |
189 | 0 | ctx->mu = 0; |
190 | 0 | ctx->operation = operation; |
191 | |
|
192 | 0 | return ml_dsa_set_ctx_params(ctx, params); |
193 | 0 | } |
194 | | |
195 | | static int ml_dsa_sign_msg_init(void *vctx, void *vkey, const OSSL_PARAM params[]) |
196 | 0 | { |
197 | 0 | return ml_dsa_signverify_msg_init(vctx, vkey, params, |
198 | 0 | EVP_PKEY_OP_SIGNMSG, "ML_DSA Sign Init"); |
199 | 0 | } |
200 | | |
201 | | static int ml_dsa_digest_signverify_init(void *vctx, const char *mdname, |
202 | | void *vkey, const OSSL_PARAM params[]) |
203 | 0 | { |
204 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
205 | |
|
206 | 0 | if (mdname != NULL && mdname[0] != '\0') { |
207 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST, |
208 | 0 | "Explicit digest not supported for ML-DSA operations"); |
209 | 0 | return 0; |
210 | 0 | } |
211 | | |
212 | 0 | ctx->mu = 0; |
213 | |
|
214 | 0 | if (vkey == NULL && ctx->key != NULL) |
215 | 0 | return ml_dsa_set_ctx_params(ctx, params); |
216 | | |
217 | 0 | return ml_dsa_signverify_msg_init(vctx, vkey, params, |
218 | 0 | EVP_PKEY_OP_SIGN, "ML_DSA Sign Init"); |
219 | 0 | } |
220 | | |
221 | | static int ml_dsa_signverify_msg_update(void *vctx, |
222 | | const unsigned char *data, |
223 | | size_t datalen) |
224 | 0 | { |
225 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
226 | |
|
227 | 0 | if (ctx == NULL) |
228 | 0 | return 0; |
229 | | |
230 | 0 | if (!ossl_prov_is_running()) |
231 | 0 | return 0; |
232 | | |
233 | 0 | if (ctx->mu) |
234 | 0 | return 0; |
235 | | |
236 | 0 | if (ctx->md_ctx == NULL) { |
237 | 0 | ctx->md_ctx = ossl_ml_dsa_mu_init(ctx->key, ctx->msg_encode, |
238 | 0 | ctx->context_string, |
239 | 0 | ctx->context_string_len); |
240 | 0 | if (ctx->md_ctx == NULL) |
241 | 0 | return 0; |
242 | 0 | } |
243 | | |
244 | 0 | return ossl_ml_dsa_mu_update(ctx->md_ctx, data, datalen); |
245 | 0 | } |
246 | | |
247 | | static int ml_dsa_sign_msg_final(void *vctx, unsigned char *sig, |
248 | | size_t *siglen, size_t sigsize) |
249 | 0 | { |
250 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
251 | 0 | uint8_t rand_tmp[ML_DSA_ENTROPY_LEN], *rnd = NULL; |
252 | 0 | uint8_t mu[ML_DSA_MU_BYTES]; |
253 | 0 | int ret = 0; |
254 | |
|
255 | 0 | if (ctx == NULL) |
256 | 0 | return 0; |
257 | | |
258 | 0 | if (!ossl_prov_is_running()) |
259 | 0 | return 0; |
260 | | |
261 | 0 | if (ctx->md_ctx == NULL) |
262 | 0 | return 0; |
263 | | |
264 | 0 | if (sig != NULL) { |
265 | 0 | if (ctx->test_entropy_len != 0) { |
266 | 0 | rnd = ctx->test_entropy; |
267 | 0 | } else { |
268 | 0 | rnd = rand_tmp; |
269 | |
|
270 | 0 | if (ctx->deterministic == 1) |
271 | 0 | memset(rnd, 0, sizeof(rand_tmp)); |
272 | 0 | else if (RAND_priv_bytes_ex(ctx->libctx, rnd, sizeof(rand_tmp), 0) <= 0) |
273 | 0 | return 0; |
274 | 0 | } |
275 | | |
276 | 0 | if (!ossl_ml_dsa_mu_finalize(ctx->md_ctx, mu, sizeof(mu))) |
277 | 0 | return 0; |
278 | 0 | } |
279 | | |
280 | 0 | ret = ossl_ml_dsa_sign(ctx->key, 1, mu, sizeof(mu), NULL, 0, rnd, |
281 | 0 | sizeof(rand_tmp), 0, sig, siglen, sigsize); |
282 | 0 | if (rnd != ctx->test_entropy) |
283 | 0 | OPENSSL_cleanse(rand_tmp, sizeof(rand_tmp)); |
284 | 0 | return ret; |
285 | 0 | } |
286 | | |
287 | | static int ml_dsa_sign(void *vctx, uint8_t *sig, size_t *siglen, size_t sigsize, |
288 | | const uint8_t *msg, size_t msg_len) |
289 | 0 | { |
290 | 0 | int ret = 0; |
291 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
292 | 0 | uint8_t rand_tmp[ML_DSA_ENTROPY_LEN], *rnd = NULL; |
293 | |
|
294 | 0 | if (!ossl_prov_is_running()) |
295 | 0 | return 0; |
296 | | |
297 | 0 | if (sig != NULL) { |
298 | 0 | if (ctx->test_entropy_len != 0) { |
299 | 0 | rnd = ctx->test_entropy; |
300 | 0 | } else { |
301 | 0 | rnd = rand_tmp; |
302 | |
|
303 | 0 | if (ctx->deterministic == 1) |
304 | 0 | memset(rnd, 0, sizeof(rand_tmp)); |
305 | 0 | else if (RAND_priv_bytes_ex(ctx->libctx, rnd, sizeof(rand_tmp), 0) <= 0) |
306 | 0 | return 0; |
307 | 0 | } |
308 | 0 | } |
309 | 0 | ret = ossl_ml_dsa_sign(ctx->key, ctx->mu, msg, msg_len, |
310 | 0 | ctx->context_string, ctx->context_string_len, |
311 | 0 | rnd, sizeof(rand_tmp), ctx->msg_encode, |
312 | 0 | sig, siglen, sigsize); |
313 | 0 | if (rnd != ctx->test_entropy) |
314 | 0 | OPENSSL_cleanse(rand_tmp, sizeof(rand_tmp)); |
315 | 0 | return ret; |
316 | 0 | } |
317 | | |
318 | | static int ml_dsa_digest_sign(void *vctx, uint8_t *sig, size_t *siglen, size_t sigsize, |
319 | | const uint8_t *tbs, size_t tbslen) |
320 | 0 | { |
321 | 0 | return ml_dsa_sign(vctx, sig, siglen, sigsize, tbs, tbslen); |
322 | 0 | } |
323 | | |
324 | | static int ml_dsa_verify_msg_init(void *vctx, void *vkey, const OSSL_PARAM params[]) |
325 | 0 | { |
326 | 0 | return ml_dsa_signverify_msg_init(vctx, vkey, params, EVP_PKEY_OP_VERIFYMSG, |
327 | 0 | "ML_DSA Verify Init"); |
328 | 0 | } |
329 | | |
330 | | static int ml_dsa_verify_msg_final(void *vctx) |
331 | 0 | { |
332 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
333 | 0 | uint8_t mu[ML_DSA_MU_BYTES]; |
334 | |
|
335 | 0 | if (!ossl_prov_is_running()) |
336 | 0 | return 0; |
337 | | |
338 | 0 | if (ctx->md_ctx == NULL) |
339 | 0 | return 0; |
340 | | |
341 | 0 | if (!ossl_ml_dsa_mu_finalize(ctx->md_ctx, mu, sizeof(mu))) |
342 | 0 | return 0; |
343 | | |
344 | 0 | return ossl_ml_dsa_verify(ctx->key, 1, mu, sizeof(mu), NULL, 0, 0, |
345 | 0 | ctx->sig, ctx->siglen); |
346 | 0 | } |
347 | | |
348 | | static int ml_dsa_verify(void *vctx, const uint8_t *sig, size_t siglen, |
349 | | const uint8_t *msg, size_t msg_len) |
350 | 0 | { |
351 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
352 | |
|
353 | 0 | if (!ossl_prov_is_running()) |
354 | 0 | return 0; |
355 | 0 | return ossl_ml_dsa_verify(ctx->key, ctx->mu, msg, msg_len, |
356 | 0 | ctx->context_string, ctx->context_string_len, |
357 | 0 | ctx->msg_encode, sig, siglen); |
358 | 0 | } |
359 | | static int ml_dsa_digest_verify(void *vctx, |
360 | | const uint8_t *sig, size_t siglen, |
361 | | const uint8_t *tbs, size_t tbslen) |
362 | 0 | { |
363 | 0 | return ml_dsa_verify(vctx, sig, siglen, tbs, tbslen); |
364 | 0 | } |
365 | | |
366 | | /* |
367 | | * Only need the param list for the signing case. The decoder and structure |
368 | | * are shared between the sign and verify cases. |
369 | | */ |
370 | | |
371 | | static int ml_dsa_set_ctx_params(void *vctx, const OSSL_PARAM params[]) |
372 | 0 | { |
373 | 0 | PROV_ML_DSA_CTX *pctx = (PROV_ML_DSA_CTX *)vctx; |
374 | 0 | struct ml_dsa_verifymsg_set_ctx_params_st p; |
375 | |
|
376 | 0 | if (pctx == NULL || !ml_dsa_verifymsg_set_ctx_params_decoder(params, &p)) |
377 | 0 | return 0; |
378 | | |
379 | 0 | if (p.ctx != NULL) { |
380 | 0 | void *vp = pctx->context_string; |
381 | |
|
382 | 0 | if (!OSSL_PARAM_get_octet_string(p.ctx, &vp, sizeof(pctx->context_string), |
383 | 0 | &(pctx->context_string_len))) { |
384 | 0 | pctx->context_string_len = 0; |
385 | 0 | return 0; |
386 | 0 | } |
387 | 0 | } |
388 | | |
389 | 0 | if (p.ent != NULL) { |
390 | 0 | void *vp = pctx->test_entropy; |
391 | |
|
392 | 0 | pctx->test_entropy_len = 0; |
393 | 0 | if (!OSSL_PARAM_get_octet_string(p.ent, &vp, sizeof(pctx->test_entropy), |
394 | 0 | &(pctx->test_entropy_len))) |
395 | 0 | return 0; |
396 | 0 | if (pctx->test_entropy_len != sizeof(pctx->test_entropy)) { |
397 | 0 | pctx->test_entropy_len = 0; |
398 | 0 | ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SEED_LENGTH); |
399 | 0 | return 0; |
400 | 0 | } |
401 | 0 | } |
402 | | |
403 | 0 | if (p.det != NULL && !OSSL_PARAM_get_int(p.det, &pctx->deterministic)) |
404 | 0 | return 0; |
405 | | |
406 | 0 | if (p.msgenc != NULL && !OSSL_PARAM_get_int(p.msgenc, &pctx->msg_encode)) |
407 | 0 | return 0; |
408 | | |
409 | 0 | if (p.mu != NULL && !OSSL_PARAM_get_int(p.mu, &pctx->mu)) |
410 | 0 | return 0; |
411 | | |
412 | 0 | if (p.sig != NULL && pctx->operation == EVP_PKEY_OP_VERIFYMSG) { |
413 | 0 | OPENSSL_free(pctx->sig); |
414 | 0 | pctx->sig = NULL; |
415 | 0 | pctx->siglen = 0; |
416 | 0 | if (!OSSL_PARAM_get_octet_string(p.sig, (void **)&pctx->sig, |
417 | 0 | 0, &pctx->siglen)) |
418 | 0 | return 0; |
419 | 0 | } |
420 | | |
421 | 0 | return 1; |
422 | 0 | } |
423 | | |
424 | | static const OSSL_PARAM *ml_dsa_settable_ctx_params(void *vctx, |
425 | | ossl_unused void *provctx) |
426 | 0 | { |
427 | 0 | PROV_ML_DSA_CTX *pctx = (PROV_ML_DSA_CTX *)vctx; |
428 | |
|
429 | 0 | if (pctx != NULL && pctx->operation == EVP_PKEY_OP_VERIFYMSG) |
430 | 0 | return ml_dsa_verifymsg_set_ctx_params_list; |
431 | 0 | else |
432 | 0 | return ml_dsa_set_ctx_params_list; |
433 | 0 | } |
434 | | |
435 | | static const OSSL_PARAM *ml_dsa_gettable_ctx_params(ossl_unused void *vctx, |
436 | | ossl_unused void *provctx) |
437 | 0 | { |
438 | 0 | return ml_dsa_get_ctx_params_list; |
439 | 0 | } |
440 | | |
441 | | static int ml_dsa_get_ctx_params(void *vctx, OSSL_PARAM *params) |
442 | 0 | { |
443 | 0 | PROV_ML_DSA_CTX *ctx = (PROV_ML_DSA_CTX *)vctx; |
444 | 0 | struct ml_dsa_get_ctx_params_st p; |
445 | |
|
446 | 0 | if (ctx == NULL || !ml_dsa_get_ctx_params_decoder(params, &p)) |
447 | 0 | return 0; |
448 | | |
449 | 0 | if (p.id != NULL |
450 | 0 | && !OSSL_PARAM_set_octet_string(p.id, |
451 | 0 | ctx->aid_len == 0 ? NULL : ctx->aid_buf, |
452 | 0 | ctx->aid_len)) |
453 | 0 | return 0; |
454 | | |
455 | 0 | return 1; |
456 | 0 | } |
457 | | |
458 | | #define MAKE_SIGNATURE_FUNCTIONS(alg) \ |
459 | | static OSSL_FUNC_signature_newctx_fn ml_dsa_##alg##_newctx; \ |
460 | | static void *ml_dsa_##alg##_newctx(void *provctx, const char *propq) \ |
461 | 0 | { \ |
462 | 0 | return ml_dsa_newctx(provctx, EVP_PKEY_ML_DSA_##alg, propq); \ |
463 | 0 | } \ Unexecuted instantiation: ml_dsa_sig.c:ml_dsa_44_newctx Unexecuted instantiation: ml_dsa_sig.c:ml_dsa_65_newctx Unexecuted instantiation: ml_dsa_sig.c:ml_dsa_87_newctx |
464 | | const OSSL_DISPATCH ossl_ml_dsa_##alg##_signature_functions[] = { \ |
465 | | { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))ml_dsa_##alg##_newctx }, \ |
466 | | { OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_INIT, \ |
467 | | (void (*)(void))ml_dsa_sign_msg_init }, \ |
468 | | { OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_UPDATE, \ |
469 | | (void (*)(void))ml_dsa_signverify_msg_update }, \ |
470 | | { OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_FINAL, \ |
471 | | (void (*)(void))ml_dsa_sign_msg_final }, \ |
472 | | { OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))ml_dsa_sign }, \ |
473 | | { OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_INIT, \ |
474 | | (void (*)(void))ml_dsa_verify_msg_init }, \ |
475 | | { OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_UPDATE, \ |
476 | | (void (*)(void))ml_dsa_signverify_msg_update }, \ |
477 | | { OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_FINAL, \ |
478 | | (void (*)(void))ml_dsa_verify_msg_final }, \ |
479 | | { OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))ml_dsa_verify }, \ |
480 | | { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, \ |
481 | | (void (*)(void))ml_dsa_digest_signverify_init }, \ |
482 | | { OSSL_FUNC_SIGNATURE_DIGEST_SIGN, \ |
483 | | (void (*)(void))ml_dsa_digest_sign }, \ |
484 | | { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, \ |
485 | | (void (*)(void))ml_dsa_digest_signverify_init }, \ |
486 | | { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY, \ |
487 | | (void (*)(void))ml_dsa_digest_verify }, \ |
488 | | { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))ml_dsa_freectx }, \ |
489 | | { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, \ |
490 | | (void (*)(void))ml_dsa_set_ctx_params }, \ |
491 | | { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, \ |
492 | | (void (*)(void))ml_dsa_settable_ctx_params }, \ |
493 | | { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, \ |
494 | | (void (*)(void))ml_dsa_get_ctx_params }, \ |
495 | | { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, \ |
496 | | (void (*)(void))ml_dsa_gettable_ctx_params }, \ |
497 | | { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))ml_dsa_dupctx }, \ |
498 | | OSSL_DISPATCH_END \ |
499 | | } |
500 | | |
501 | | MAKE_SIGNATURE_FUNCTIONS(44); |
502 | | MAKE_SIGNATURE_FUNCTIONS(65); |
503 | | MAKE_SIGNATURE_FUNCTIONS(87); |