feat(libSceLibreSsl3): implement BN_div #15770

Merged
alvaroelpob merged 7 commits from upstream-pr/15770 into main 2026-11-08 13:25:16 +00:00
alvaroelpob commented 2026-11-04 13:42:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-11-04T13:42:08Z.


What

Implements the libSceLibreSsl3 BN_div export on libSceLibreSsl's BIGNUM layout, as in LibreSSL 4.0.0: it truncates the quotient, gives the remainder the numerator's sign and makes either output optional. Writes happen in the same order when outputs alias, and division by zero, untrimmed numerators and expansion failures queue the same errors.

Tested

Full suite on e0dc7c1c8e (Linux): 3883/3883 passed, including the new guest_libressl3_bignum_divide test. It checks 14 quotient and remainder vectors computed with Python integers (single-word to 9-word numerators, every sign combination), each output alone and both null, the constant-time flag, quotient and remainder aliasing the inputs or each other, a zero numerator, division by zero, an untrimmed numerator, both allocation failures, and a static-data output. check_conventions passes.

Checklist

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5155276513 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15770). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-11-04T13:42:08Z. --- ### What Implements the libSceLibreSsl3 BN_div export on libSceLibreSsl's BIGNUM layout, as in LibreSSL 4.0.0: it truncates the quotient, gives the remainder the numerator's sign and makes either output optional. Writes happen in the same order when outputs alias, and division by zero, untrimmed numerators and expansion failures queue the same errors. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Full suite on e0dc7c1c8e (Linux): 3883/3883 passed, including the new guest_libressl3_bignum_divide test. It checks 14 quotient and remainder vectors computed with Python integers (single-word to 9-word numerators, every sign combination), each output alone and both null, the constant-time flag, quotient and remainder aliasing the inputs or each other, a zero numerator, division by zero, an untrimmed numerator, both allocation failures, and a static-data output. check_conventions passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #1384, #12945, #14366, #14889, #14890, #14992, #15031, #15045, #15119, #15232, #15289, #15303, #15472, #15514, #15591, #15616, #15618, #15620, #15622, #15623, #15624, #15625, #15627, #15628, #15629, #15631, #15758, #15760, #15761, #15765 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15770
No description provided.