Commit f08a717
committed
test: Add test_sign_hook exercising the signing hooks
Add a test analogous to test_alloc, driven by a custom config
(test_sign_hook_config.h) that enables the three signing-hook options and
forward-declares the hook context; the context type and the hook
implementations live in the test.
The hooks pause signing after a configurable number of attempts and resume
from the recorded attempt, letting one context drive:
- a known-answer smoke test, reproducing the test-vector signature both
one-shot and single-step;
- a restartable-signing equivalence test, checking that pausing after a
random number of attempts and resuming yields the same signature as an
uninterrupted run, over many random signing-randomness draws;
- a distribution test, gathering the attempts-per-signature histogram over
many one-shot signatures and checking the measured attempts/signature
ratio against the expected geometric mean for the parameter set.
The test requires the internal signing API, so it compiles to a no-op main
under MLD_CONFIG_NO_SIGN_API. Statistics are printed via printf only (no
putchar), so freestanding platforms with a minimal stdio shim can run it.
Wire it up in the Makefile, the test make fragments and scripts/tests
(new --sign-hook subcommand). Mirror alloc's CI plumbing: add a sign_hook
input to the functest / multi-functest actions and disable it for the
config variations it is incompatible with -- those passing their own
MLD_CONFIG_FILE (would clash with the test's fixed config) and those
enabling MLD_CONFIG_KEYGEN_PCT (incompatible with SIGN_HOOK_RESUME). The
generated configs follow in a separate commit.
Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>1 parent 9a3b120 commit f08a717
16 files changed
Lines changed: 942 additions & 89 deletions
File tree
- .github
- actions
- config-variations
- functest
- multi-functest
- workflows
- scripts
- test
- acvp
- baremetal/platform
- aarch64-virt
- avr
- configs
- mk
- notrandombytes
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
| 116 | + | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| |||
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| |||
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
| 164 | + | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
| |||
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
| 180 | + | |
170 | 181 | | |
171 | 182 | | |
172 | 183 | | |
| |||
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
| 196 | + | |
185 | 197 | | |
186 | 198 | | |
187 | 199 | | |
| |||
197 | 209 | | |
198 | 210 | | |
199 | 211 | | |
| 212 | + | |
200 | 213 | | |
201 | 214 | | |
202 | 215 | | |
| |||
212 | 225 | | |
213 | 226 | | |
214 | 227 | | |
| 228 | + | |
215 | 229 | | |
216 | 230 | | |
217 | 231 | | |
| |||
227 | 241 | | |
228 | 242 | | |
229 | 243 | | |
| 244 | + | |
230 | 245 | | |
231 | 246 | | |
232 | 247 | | |
| |||
242 | 257 | | |
243 | 258 | | |
244 | 259 | | |
| 260 | + | |
245 | 261 | | |
246 | 262 | | |
247 | 263 | | |
| |||
257 | 273 | | |
258 | 274 | | |
259 | 275 | | |
| 276 | + | |
260 | 277 | | |
261 | 278 | | |
262 | 279 | | |
| |||
272 | 289 | | |
273 | 290 | | |
274 | 291 | | |
| 292 | + | |
275 | 293 | | |
276 | 294 | | |
277 | 295 | | |
| |||
287 | 305 | | |
288 | 306 | | |
289 | 307 | | |
| 308 | + | |
290 | 309 | | |
291 | 310 | | |
292 | 311 | | |
| |||
302 | 321 | | |
303 | 322 | | |
304 | 323 | | |
| 324 | + | |
305 | 325 | | |
306 | 326 | | |
307 | 327 | | |
| |||
317 | 337 | | |
318 | 338 | | |
319 | 339 | | |
| 340 | + | |
320 | 341 | | |
321 | 342 | | |
322 | 343 | | |
| |||
330 | 351 | | |
331 | 352 | | |
332 | 353 | | |
| 354 | + | |
333 | 355 | | |
334 | 356 | | |
335 | 357 | | |
| |||
345 | 367 | | |
346 | 368 | | |
347 | 369 | | |
| 370 | + | |
348 | 371 | | |
349 | 372 | | |
350 | 373 | | |
| |||
357 | 380 | | |
358 | 381 | | |
359 | 382 | | |
| 383 | + | |
360 | 384 | | |
361 | 385 | | |
362 | 386 | | |
| |||
375 | 399 | | |
376 | 400 | | |
377 | 401 | | |
| 402 | + | |
378 | 403 | | |
379 | 404 | | |
380 | 405 | | |
| |||
390 | 415 | | |
391 | 416 | | |
392 | 417 | | |
| 418 | + | |
393 | 419 | | |
394 | 420 | | |
395 | 421 | | |
| |||
405 | 431 | | |
406 | 432 | | |
407 | 433 | | |
| 434 | + | |
408 | 435 | | |
409 | 436 | | |
410 | 437 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
122 | | - | |
| 126 | + | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
128 | | - | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| |||
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| |||
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
| 183 | + | |
177 | 184 | | |
178 | 185 | | |
179 | 186 | | |
| |||
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
| |||
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
| 237 | + | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
| |||
252 | 261 | | |
253 | 262 | | |
254 | 263 | | |
| 264 | + | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
| 438 | + | |
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
443 | 485 | | |
444 | 486 | | |
445 | 487 | | |
| |||
0 commit comments