feat(libSceLibreSsl3): implement X509_gmtime_adj #17242

Closed
fishingpvalues wants to merge 7 commits from upstream-pr/17242 into main
fishingpvalues commented 2026-11-08 16:05:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fishingpvalues on 2026-11-08T16:05:33Z.


What

feat(libSceLibreSsl3): implement X509_gmtime_adj. The implementation and its technical-debt entry are in this branch; the export leaves AdditionalExports.cpp and gains its real signature in include/Api.hpp.

Tested

Linux x86-64 (CachyOS, GCC 16.2.1), Release, BUILD_TESTING=ON, base main 828e44310e:

  • cmake --build build --target guest_libressl3_x509_gmtime_adj_tests --parallel 6: passed.
  • ctest --test-dir build -R '^guest_libressl3_x509_gmtime_adj$' --output-on-failure: 1/1 passed.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • Not run: Windows, a console or a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5212845263 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17242). Originally posted by [fishingpvalues](https://github.com/fishingpvalues) on 2026-11-08T16:05:33Z. --- ### What feat(libSceLibreSsl3): implement X509_gmtime_adj. The implementation and its technical-debt entry are in this branch; the export leaves `AdditionalExports.cpp` and gains its real signature in `include/Api.hpp`. ### Tested Linux x86-64 (CachyOS, GCC 16.2.1), Release, `BUILD_TESTING=ON`, base `main` `828e44310e`: - `cmake --build build --target guest_libressl3_x509_gmtime_adj_tests --parallel 6`: passed. - `ctest --test-dir build -R '^guest_libressl3_x509_gmtime_adj$' --output-on-failure`: 1/1 passed. - `python3 tools/check_conventions.py --base origin/main`: passed. - Not run: Windows, a console or a title. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
gabichuuuuu commented 2026-11-08 16:27:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T16:27:24Z.

Review: COMMENTED


Read against the LibreSSL in 3rdparty/libressl-openbsd (078b3d1d), which is what this module follows. I haven't built or run this branch. One host check was run on Windows, below.

  • Host gmtime range on Windows. The new time is formatted with std::gmtime. With WinLibs GCC 15.2 (UCRT, 64-bit time_t), gmtime returns NULL for 1940-01-01 (-946080000) and for 3000-01-01 or later. I checked the second at 32538240000. LibreSSL formats any year from 1950 to 9999 (asn1/a_time_tm.c).

    So on Windows, an adjustment that lands in 1950-1969 or in 3000-9999 returns null here, which is a valid time in LibreSSL. A calendar conversion that doesn't depend on the host (days-from-civil) would avoid both the range limit and the non-reentrant gmtime.

  • Null s. X509_gmtime_adj(NULL, adj) allocates a new ASN1_TIME in LibreSSL (x509_vfy.c → ASN1_TIME_adj). Here it returns null.

  • Years outside 1950-9999. These are accepted and printed with %04d here. LibreSSL rejects them with ASN1_R_ILLEGAL_TIME_VALUE. now + adjustment can also overflow int64.

  • The signature uses std::int64_t for the guest long, which is right for LLP64 Windows.

Debt file: compared with main, this branch's docs/dev/debt/libSceLibreSsl3.md drops a BIO_meth line that main now has (src/BioMethod.cpp, #15761), and it repeats the new bullet on two consecutive lines. It looks rebased from an older copy of the file.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818653823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17242#pullrequestreview-5818653823). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T16:27:24Z. **Review:** COMMENTED --- Read against the LibreSSL in `3rdparty/libressl-openbsd` (`078b3d1d`), which is what this module follows. I haven't built or run this branch. One host check was run on Windows, below. - **Host `gmtime` range on Windows.** The new time is formatted with `std::gmtime`. With WinLibs GCC 15.2 (UCRT, 64-bit `time_t`), `gmtime` returns NULL for 1940-01-01 (`-946080000`) and for 3000-01-01 or later. I checked the second at `32538240000`. LibreSSL formats any year from 1950 to 9999 (`asn1/a_time_tm.c`). So on Windows, an adjustment that lands in 1950-1969 or in 3000-9999 returns null here, which is a valid time in LibreSSL. A calendar conversion that doesn't depend on the host (days-from-civil) would avoid both the range limit and the non-reentrant `gmtime`. - **Null `s`.** `X509_gmtime_adj(NULL, adj)` allocates a new `ASN1_TIME` in LibreSSL (`x509_vfy.c` → `ASN1_TIME_adj`). Here it returns null. - **Years outside 1950-9999.** These are accepted and printed with `%04d` here. LibreSSL rejects them with `ASN1_R_ILLEGAL_TIME_VALUE`. `now + adjustment` can also overflow `int64`. - The signature uses `std::int64_t` for the guest `long`, which is right for LLP64 Windows. **Debt file:** compared with `main`, this branch's `docs/dev/debt/libSceLibreSsl3.md` drops a `BIO_meth` line that `main` now has (`src/BioMethod.cpp`, #15761), and it repeats the new bullet on two consecutive lines. It looks rebased from an older copy of the file.

Pull request closed

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!17242
No description provided.