Commit 31cb153
authored
Verify size of mlen in ML-DSA external mu mode (#2841)
### Issues:
Resolves #N/A
### Description of changes:
When signing/verifying in ML-DSA the caller provides `mlen` the the
length of the message `m` that is being signed/verified. Currently, we
do no validation on the size of `mlen` when in pre-hash mode (called
"external mu" in ML-DSA). Since the pre-hash is the output of a SHAKE256
hash function, it is of fixed size `ML_DSA_CRHBYTES`. This adds
validation to check that, returning `-1` if not true to match the case
where the context `ctx` has length too large.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.1 parent 2929213 commit 31cb153
1 file changed
+14
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
| |||
346 | 350 | | |
347 | 351 | | |
348 | 352 | | |
349 | | - | |
| 353 | + | |
350 | 354 | | |
351 | 355 | | |
352 | 356 | | |
353 | 357 | | |
354 | | - | |
| 358 | + | |
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
| |||
380 | 384 | | |
381 | 385 | | |
382 | 386 | | |
383 | | - | |
| 387 | + | |
384 | 388 | | |
385 | 389 | | |
386 | 390 | | |
387 | | - | |
| 391 | + | |
388 | 392 | | |
389 | 393 | | |
390 | 394 | | |
| |||
469 | 473 | | |
470 | 474 | | |
471 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
472 | 481 | | |
473 | 482 | | |
474 | 483 | | |
| |||
0 commit comments