Repository navigation
Commit 0fba211
* gh-159786: Convert HACL* update() errors in `_hmac` after releasing the lock
`_hacl_hmac_state_update_once()` converted the HACL* exit code into an
exception while the thread state was detached and, for HMAC.update(),
while the object's mutex was held. On debug builds, this re-attached the
thread state under the mutex and then called PyErr_Occurred() with the
thread state detached in the chunking loop of `_hacl_hmac_state_update()`.
Return the raw HACL* exit code instead and convert it in `_hmac.new()` and
`_hmac.HMAC.update()` once the thread state is re-attached and the mutex
is released, as `hmac_digest_compute_locked()` already does. Release
builds keep ignoring the update() exit code.
Since `_hacl_convert_errno()` is now always called with an attached
thread state, remove the `PyGILState_Ensure()` added by gh-135561 and
assert that a thread state is attached instead.
* simplify ifdefs: always check for the hacl error
---------
Co-authored-by: Gregory P. Smith <greg@krypto.org>
1 parent 4c356f7 commit 0fba211
2 files changed
Lines changed: 27 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
| 383 | + | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
386 | | - | |
| 388 | + | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
391 | | - | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
| |||
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
416 | | - | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | | - | |
453 | | - | |
454 | | - | |
| 452 | + | |
| 453 | + | |
455 | 454 | | |
456 | | - | |
| 455 | + | |
457 | 456 | | |
458 | 457 | | |
459 | 458 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
| 459 | + | |
467 | 460 | | |
468 | 461 | | |
469 | 462 | | |
470 | 463 | | |
471 | 464 | | |
472 | | - | |
473 | | - | |
474 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
475 | 468 | | |
476 | | - | |
| 469 | + | |
477 | 470 | | |
478 | 471 | | |
479 | 472 | | |
480 | 473 | | |
481 | 474 | | |
482 | | - | |
483 | | - | |
484 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
485 | 479 | | |
486 | 480 | | |
487 | 481 | | |
| |||
786 | 780 | | |
787 | 781 | | |
788 | 782 | | |
| 783 | + | |
789 | 784 | | |
790 | 785 | | |
791 | | - | |
| 786 | + | |
792 | 787 | | |
793 | 788 | | |
794 | | - | |
| 789 | + | |
795 | 790 | | |
796 | 791 | | |
797 | 792 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 793 | | |
802 | 794 | | |
803 | 795 | | |
| |||
889 | 881 | | |
890 | 882 | | |
891 | 883 | | |
892 | | - | |
| 884 | + | |
893 | 885 | | |
894 | 886 | | |
895 | 887 | | |
896 | 888 | | |
897 | | - | |
| 889 | + | |
898 | 890 | | |
899 | 891 | | |
900 | | - | |
| 892 | + | |
901 | 893 | | |
902 | 894 | | |
903 | 895 | | |
| |||
0 commit comments