feat(libSceLibreSsl3): implement X509_cmp_current_time #15620

Merged
alvaroelpob merged 4 commits from upstream-pr/15620 into main 2026-11-10 09:46:22 +00:00
alvaroelpob commented 2026-11-03 22:08:42 +00:00 (Migrated from github.com)

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


What

Implements X509_cmp_current_time in libSceLibreSsl3, following LibreSSL 4.0.0 X509_cmp_time: the RFC 5280 time is compared with the current time and the result is -1 when it is not later, 1 when it is later and 0 when the time is invalid.

Tested

Linux x86-64 (WSL2), Release: the full build passes and ctest --test-dir build -j16 passes 3829 of 3829 tests, including the new guest_libressl3_x509_cmp_time. python3 tools/check_conventions.py --base upstream/main passes. Not run on a console or in 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 (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #12945, #14366, #14889, #14890, #14992, #15031, #15045, #15119, #15289, #15303, #15472, #15514, #15544, #15591, #15599, #15616, #15618
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5145256609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15620). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-11-03T22:08:42Z. --- ### What Implements `X509_cmp_current_time` in libSceLibreSsl3, following LibreSSL 4.0.0 [`X509_cmp_time`](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/x509/x509_vfy.c#L1886-L1929): the RFC 5280 time is compared with the current time and the result is -1 when it is not later, 1 when it is later and 0 when the time is invalid. ### 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. --> Linux x86-64 (WSL2), Release: the full build passes and `ctest --test-dir build -j16` passes 3829 of 3829 tests, including the new `guest_libressl3_x509_cmp_time`. `python3 tools/check_conventions.py --base upstream/main` passes. Not run on a console or in a title. ### 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: #12945, #14366, #14889, #14890, #14992, #15031, #15045, #15119, #15289, #15303, #15472, #15514, #15544, #15591, #15599, #15616, #15618 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
BunnyFl commented 2026-11-04 02:31:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T02:31:36Z.

Review: APPROVED


@alvaroelpob thanks. I compared the parser with LibreSSL 4.0.0 at the commit you cite, asn1_time_parse_cbs and ASN1_time_parse in asn1/a_time_tm.c plus x509_verify_asn1_time_to_time_t in x509/x509_verify.c, and the rules match:

  • the length must be 13 or 15;
  • a nonzero type that differs from the length's format fails;
  • a UTCTime year below 50 is 20xx, otherwise 19xx;
  • a GeneralizedTime before 2050 is rejected (RFC 5280 §4.1.2.5, x509_verify.c lines 63-66);
  • invalid days, hours over 23, minutes or seconds over 59 (no leap second) and anything but a final Z fail;
  • equal times compare as -1, as in X509_cmp_time_internal.

What I ran: head e18f8216de merged onto main 1c8c0efc8c, Windows 11, WinLibs GCC, Release:

  • guest_libressl3_x509_cmp_time and public_headers pass (2 of 2);
  • mutation, the year < 2050 rejection disabled: guest_libressl3_x509_cmp_time fails;
  • tools/check_conventions.py --base upstream/main on the head: all checks passed;
  • tools/pr_overlap.py --branch: no shared exports. None of the 10 PRs it couldn't compare adds X509_cmp_current_time.

As on #15618, your open LibreSsl3 PRs conflict with one another on the export count line and adjacent lines in CMakeLists.txt and the debt file.

Approving.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5762391543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15620#pullrequestreview-5762391543). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-04T02:31:36Z. **Review:** APPROVED --- @alvaroelpob thanks. I compared the parser with LibreSSL 4.0.0 at the commit you cite, `asn1_time_parse_cbs` and `ASN1_time_parse` in `asn1/a_time_tm.c` plus `x509_verify_asn1_time_to_time_t` in `x509/x509_verify.c`, and the rules match: - the length must be 13 or 15; - a nonzero `type` that differs from the length's format fails; - a UTCTime year below 50 is 20xx, otherwise 19xx; - a GeneralizedTime before 2050 is rejected (RFC 5280 §4.1.2.5, `x509_verify.c` lines 63-66); - invalid days, hours over 23, minutes or seconds over 59 (no leap second) and anything but a final `Z` fail; - equal times compare as -1, as in `X509_cmp_time_internal`. **What I ran:** head `e18f8216de` merged onto `main` `1c8c0efc8c`, Windows 11, WinLibs GCC, Release: - `guest_libressl3_x509_cmp_time` and `public_headers` pass (2 of 2); - mutation, the `year < 2050` rejection disabled: `guest_libressl3_x509_cmp_time` fails; - `tools/check_conventions.py --base upstream/main` on the head: all checks passed; - `tools/pr_overlap.py --branch`: no shared exports. None of the 10 PRs it couldn't compare adds `X509_cmp_current_time`. As on #15618, your open LibreSsl3 PRs conflict with one another on the export count line and adjacent lines in `CMakeLists.txt` and the debt file. Approving.
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!15620
No description provided.