Commit 567f411
authored
Verify musig2 secret nonces (#108)
* Verify musig2 secret nonces
Trying to generate a musig2 partial signature with a secret nonce that was generated with a public key that does not match the signing key's public key will trigger secp256k1's illegal callback (which calls abort()) and crash the application.
=> Here we verify that the secret nonce matches the signing key before we call secp256k1_musig_partial_sign().
The verification method is a bit hackish (we extract the public key from the secret nonce blob) because secp256k1 does not export the methods we need to do this cleanly.1 parent eb92fcc commit 567f411
File tree
4 files changed
+80
-27
lines changed- jni/src/main/kotlin/fr/acinq/secp256k1
- src
- commonMain/kotlin/fr/acinq/secp256k1
- nativeMain/kotlin/fr/acinq/secp256k1
- tests/src/commonTest/kotlin/fr/acinq/secp256k1
4 files changed
+80
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
220 | 240 | | |
221 | 241 | | |
222 | 242 | | |
| |||
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
311 | 320 | | |
312 | 321 | | |
313 | 322 | | |
| |||
339 | 348 | | |
340 | 349 | | |
341 | 350 | | |
342 | | - | |
| 351 | + | |
343 | 352 | | |
344 | 353 | | |
345 | 354 | | |
| |||
386 | 395 | | |
387 | 396 | | |
388 | 397 | | |
389 | | - | |
| 398 | + | |
390 | 399 | | |
391 | 400 | | |
392 | 401 | | |
393 | 402 | | |
394 | 403 | | |
395 | 404 | | |
| 405 | + | |
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
| |||
Lines changed: 44 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| |||
454 | 462 | | |
455 | 463 | | |
456 | 464 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
461 | 468 | | |
462 | | - | |
463 | | - | |
464 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
465 | 480 | | |
466 | 481 | | |
467 | 482 | | |
468 | 483 | | |
469 | 484 | | |
470 | 485 | | |
471 | | - | |
472 | | - | |
| 486 | + | |
| 487 | + | |
473 | 488 | | |
474 | | - | |
475 | 489 | | |
476 | 490 | | |
477 | 491 | | |
478 | | - | |
479 | | - | |
| 492 | + | |
| 493 | + | |
480 | 494 | | |
481 | 495 | | |
482 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
483 | 506 | | |
484 | | - | |
485 | | - | |
| 507 | + | |
| 508 | + | |
486 | 509 | | |
487 | 510 | | |
488 | | - | |
| 511 | + | |
489 | 512 | | |
490 | | - | |
| 513 | + | |
491 | 514 | | |
492 | 515 | | |
493 | 516 | | |
| |||
523 | 546 | | |
524 | 547 | | |
525 | 548 | | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
533 | 552 | | |
| 553 | + | |
534 | 554 | | |
| 555 | + | |
| 556 | + | |
535 | 557 | | |
536 | 558 | | |
537 | 559 | | |
| |||
0 commit comments