fix(libSceLibreSsl): decode compressed 224-bit EC points and report errors #11466

Closed
christopear wants to merge 63 commits from upstream-pr/11466 into main
christopear commented 2026-10-26 15:12:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by christopear on 2026-10-26T15:12:36Z.


What

Fixes two gaps in the existing EC point decoder carried by #11146 from #10407: compressed secp224k1/P-224 points currently throw, and decoding does not update the LibreSSL error queue. This follow-up implements modular square roots for every supported prime curve and matches LibreSSL 2.5.4's decoding errors, error-queue clearing and point state after failed decoding. EC_POINT_new also queues the reference null-group/allocation errors.

The existing EC point types, public signatures and point/key APIs are retained. The decoder is moved from Ec.cpp into EcPoint.cpp to keep the arithmetic and validation together. Caller BN_CTX storage remains unused; scratch storage is host-owned. Cross-curve point reuse and backend arithmetic/allocation failures remain documented throwing gaps.

Source: public LibreSSL 2.5.4 ec_lib.c, ec_oct.c and ecp_oct.c, OpenBSD revision 2e2c612066aa993717528a0249c15c51128d61cb; this is the version identified in published firmware 13.40 measurements. No PS5 module, title or console execution was tested.

Stacked on #11146, which carries #10395, the EC implementation from closed #10407, and #10915. Their original commits/authorship are retained. This PR's own change is commit 5de6263705 (replayed from fb6b35dc7b); the intended merge order is #10395 and #10915, then #11146, then this follow-up. After the dependencies merge, remove the inherited commits from the diff. Shared-file overlaps with unrelated PRs may still require rebasing; no independent implementation of the prerequisite exports is proposed here.

Tested

Current update includes parent main a61d5edf9855e9bb6965695ecd247614861dd5e3 and the current prerequisite heads: #11146 29cfe068b0, #10915 7be988fd70, #10395 c1e28b6338. Their original history/authorship is retained. Shared CMake/API/debt conflicts are resolved while retaining newer upstream functionality.

The October 28 review is addressed: removed the single cross-curve decoding RequireThrows and its unused alternate-group fixture; retained all three null-argument assertions. The RSA fixture cleanup remains identical to current #10915. EC production code is unchanged from the previously reviewed implementation. Cross-curve runtime behavior remains an explicitly documented unknown; no new behavior is asserted.

Ubuntu 26.04 x86-64, GCC 15.2.0, Release with bundled dependencies:

  • Candidate 92e45814d8: full build succeeded, 37 LibreSSL tests passed, and full suite 2,961 passed, 32 skipped, zero failures, 2,993 registered tests in 271.10 seconds.
  • Publication head 6a5b78ccbf811f3f2eefe76ef9e594ffd31da7a7 additionally integrates unrelated upstream inventory, scheduler, NGS2 and tooling changes; LibreSSL source/tests are unchanged from the candidate. Full build and full suite rerun on this exact head: 2,961 passed, 32 skipped, zero failures, 2,993 registered tests in 253.32 seconds.
  • Commands: cmake --build build --parallel 8; ctest --test-dir build -R libressl --output-on-failure --parallel 4; ctest --test-dir build --output-on-failure --parallel 4. Full suite runs use normal host permissions.
  • Convention check against current upstream main passes without findings; git diff --check passes. The required old-fork origin/main comparison reports inherited NID/commit-subject findings: the candidate and upstream-only checks produced byte-for-byte identical output (51 findings, 15 errors). These are outside this contribution.
  • Overlap audit completed on preparation branch codex/libressl-ec-review-oct30; shared files and incomplete comparisons against conflicting PRs remain. No claim of a globally conflict-free dependency stack.

Reference evidence from original code commit fb6b35dc7b: the regression test failed against the prerequisite decoder and passed with this fix. The committed test covers 33 reference points across 11 curves plus decoding errors, field bounds, parity, infinity and state/error-queue effects. A separate real-LibreSSL 2.5.4 differential matched 22,110 cases, including complete error queues and final point state, with null and supplied BN_CTX. That standalone differential was not rerun for this refresh; reproduction remains below.

Independent Windows validation applies to earlier head 9e6abd40ab: contributor-reported Windows 11 / WinLibs GCC 15.2.0 success for five EC/RSA tests. No fresh Windows, PS5 or title execution was performed for this head. No performance claim.

Reproduce the independent LibreSSL 2.5.4 comparison (Linux)

Save the C++ harness below as differential.cpp in a temporary directory outside the checkout. Save the shell block as reproduce.sh, then run bash reproduce.sh /absolute/path/to/that/directory from the AnyPS5 checkout. The reference archive is built outside the repository and is not a runtime dependency.

set -eu
research_dir="${1:?Pass the directory containing differential.cpp}"
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
cmake --build build --target guest_libressl_ec_point_tests --parallel 8
curl -fL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.5.4.tar.gz -o "$research_dir/libressl-2.5.4.tar.gz"
(cd "$research_dir" && echo '107a5b522fbb8318d4c3be668075e5e607296f0a9255d71674caa94571336efa  libressl-2.5.4.tar.gz' | sha256sum -c -)
tar -xzf "$research_dir/libressl-2.5.4.tar.gz" -C "$research_dir"
cmake -S "$research_dir/libressl-2.5.4" -B "$research_dir/libressl-build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
cmake --build "$research_dir/libressl-build" --target crypto --parallel 8
g++ -std=c++20 -O2 -Icore/libs -I3rdparty/mbedtls/include -I"$research_dir/libressl-2.5.4/include" "$research_dir/differential.cpp" build/core/libs/libs/unpatched/libSceLibreSsl.prx build/3rdparty/mbedtls/library/libmbedcrypto.a build/3rdparty/mbedtls/3rdparty/p256-m/libp256m.a "$research_dir/libressl-build/crypto/libcrypto.a" -lpthread -Wl,-rpath,"$PWD/build/core/libs/libs/unpatched" -o "$research_dir/differential"
"$research_dir/differential"
#include "prx/libSceLibreSsl/include/Api.hpp"
#include "prx/libSceLibreSsl/include/Ec.hpp"
#include "prx/libSceLibreSsl/include/Error.hpp"
#include <openssl/ec.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <random>
#include <cstring>
void Require(bool ok) { if (!ok) { std::fputs("reference harness setup failed\n", stderr); std::abort(); } }
int main() {
    const int nids[]={409,415,711,712,713,714,715,716,928,932,934};
    std::mt19937 random(12345);
    size_t cases=0;
    for(int nid:nids) {
        EC_GROUP* g=EC_GROUP_new_by_curve_name(nid);
        EC_POINT* p=EC_POINT_new(g);
        EcGroup* ag=EC_GROUP_new_by_curve_name_nid_postfix(nid);
        EcPoint* ap=EC_POINT_new_nid_postfix(ag);
        Require(g && p && ag && ap);
        size_t width=(EC_GROUP_get_degree(g)+7)/8;
        std::vector<unsigned char> initial(1+2*width);
        Require(EC_POINT_point2oct(g,EC_GROUP_get0_generator(g),POINT_CONVERSION_UNCOMPRESSED,initial.data(),initial.size(),nullptr)==initial.size());
        BN_CTX* sharedContext=BN_CTX_new();Require(sharedContext!=nullptr);
        BN_CTX_start(sharedContext);
        BIGNUM* guard=BN_CTX_get(sharedContext);Require(guard!=nullptr);Require(BN_set_word(guard,77)==1);
        auto check=[&](const std::vector<unsigned char>& bytes) {
            for(BN_CTX* context:{static_cast<BN_CTX*>(nullptr),sharedContext}) {
            Require(EC_POINT_oct2point(g,p,initial.data(),initial.size(),nullptr)==1);
            Require(EC_POINT_oct2point_nid_postfix(ag,ap,initial.data(),initial.size(),nullptr)==1);
            ERR_clear_error(); ERR_clear_error_nid_postfix();
            ERR_put_error(1,2,3,__FILE__,__LINE__); LibreSslPutError_nid_no_patch(1,2,3);
            int expected=EC_POINT_oct2point(g,p,bytes.data(),bytes.size(),context);
            int actual=EC_POINT_oct2point_nid_postfix(ag,ap,bytes.data(),bytes.size(),context);
            bool match=expected==actual;
            for(;;) {
                auto e=ERR_get_error(); auto a=ERR_get_error_nid_postfix();
                if(e!=a) {std::printf("error mismatch %lx %lx\n",e,a);match=false;}
                if(!e&&!a)break;
            }
            std::vector<unsigned char> ep(1+2*width),a(1+2*width);
            auto len=EC_POINT_point2oct(g,p,POINT_CONVERSION_UNCOMPRESSED,ep.data(),ep.size(),nullptr);Require(len>0);ep.resize(len);
            if(mbedtls_mpi_cmp_int(&ap->point.MBEDTLS_PRIVATE(Z),0)==0)a={0};
            else {
                a[0]=4;
                Require(mbedtls_mpi_write_binary(&ap->point.MBEDTLS_PRIVATE(X),a.data()+1,width)==0);
                Require(mbedtls_mpi_write_binary(&ap->point.MBEDTLS_PRIVATE(Y),a.data()+1+width,width)==0);
            }
            if(ep!=a) {puts("state mismatch");match=false;}
            if(!match) {
                printf("nid %d case %zu expected %d actual %d bytes ",nid,cases,expected,actual);
                for(auto v:bytes)printf("%02x",v);puts("");std::exit(1);
            }
            Require(BN_get_word(guard)==77);
            cases++;
            }
        };
        check({});check({0});check({1});check({0,0});
        for(unsigned prefix=0;prefix<256;prefix++) {
            auto bytes=initial;bytes[0]=prefix;check(bytes);
        }
        for(unsigned x=0;x<128;x++) {
            for(unsigned prefix:{2u,3u}) {
                std::vector<unsigned char> bytes(width+1);bytes[0]=prefix;bytes.back()=x;check(bytes);
            }
        }
        for(unsigned i=0;i<300;i++) {
            unsigned prefix=2+random()%6;
            std::vector<unsigned char> bytes(1+(prefix<4?width:2*width));
            for(auto& b:bytes)b=random();bytes[0]=prefix;check(bytes);
        }
        for(unsigned i=1;i<64;i++) {
            BIGNUM* scalar=BN_new();Require(scalar!=nullptr);Require(BN_set_word(scalar,random())==1);
            Require(EC_POINT_mul(g,p,scalar,nullptr,nullptr,nullptr)==1);
            for(auto form:{POINT_CONVERSION_COMPRESSED,POINT_CONVERSION_UNCOMPRESSED,POINT_CONVERSION_HYBRID}) {
                std::vector<unsigned char> bytes(1+2*width);
                auto n=EC_POINT_point2oct(g,p,form,bytes.data(),bytes.size(),nullptr);Require(n>0);bytes.resize(n);check(bytes);
                Require(EC_POINT_mul(g,p,scalar,nullptr,nullptr,nullptr)==1);
            }
            BN_free(scalar);
        }
        BN_CTX_end(sharedContext);BN_CTX_free(sharedContext);
        EC_POINT_free(p);EC_GROUP_free(g);EC_POINT_free_nid_postfix(ap);EC_GROUP_free_nid_postfix(ag);
    }
    printf("Matched return values, full error queues and point coordinates for %zu cases across 11 curves.\n",cases);
}

Seed 12345; 1,005 encodings per curve, each tested with two context modes, across 11 curves. Inputs include empty/infinity encodings, all 256 prefixes, small compressed X values with both parities, random encodings, and random generator multiples in compressed/uncompressed/hybrid forms. Each case starts with the generator and a pre-existing error.

Expected output:

Matched return values, full error queues and point coordinates for 22110 cases across 11 curves.

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: #11146, #10395, #10915
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5019832364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11466). Originally posted by [christopear](https://github.com/christopear) on 2026-10-26T15:12:36Z. --- ### What Fixes two gaps in the existing EC point decoder carried by #11146 from #10407: compressed secp224k1/P-224 points currently throw, and decoding does not update the LibreSSL error queue. This follow-up implements modular square roots for every supported prime curve and matches LibreSSL 2.5.4's decoding errors, error-queue clearing and point state after failed decoding. `EC_POINT_new` also queues the reference null-group/allocation errors. The existing EC point types, public signatures and point/key APIs are retained. The decoder is moved from `Ec.cpp` into `EcPoint.cpp` to keep the arithmetic and validation together. Caller BN_CTX storage remains unused; scratch storage is host-owned. Cross-curve point reuse and backend arithmetic/allocation failures remain documented throwing gaps. Source: public LibreSSL 2.5.4 `ec_lib.c`, `ec_oct.c` and `ecp_oct.c`, OpenBSD revision `2e2c612066aa993717528a0249c15c51128d61cb`; this is the version identified in [published firmware 13.40 measurements](https://github.com/boykopovar/AnyPS5/discussions/8981#discussioncomment-19111214). No PS5 module, title or console execution was tested. Stacked on #11146, which carries #10395, the EC implementation from closed #10407, and #10915. Their original commits/authorship are retained. This PR's own change is [commit 5de6263705](https://github.com/christopear/AnyPS5/commit/5de626370518ec759e5890d139b8dfda83abad34) (replayed from fb6b35dc7b); the intended merge order is #10395 and #10915, then #11146, then this follow-up. After the dependencies merge, remove the inherited commits from the diff. Shared-file overlaps with unrelated PRs may still require rebasing; no independent implementation of the prerequisite exports is proposed here. ### Tested Current update includes parent main `a61d5edf9855e9bb6965695ecd247614861dd5e3` and the current prerequisite heads: #11146 `29cfe068b0`, #10915 `7be988fd70`, #10395 `c1e28b6338`. Their original history/authorship is retained. Shared CMake/API/debt conflicts are resolved while retaining newer upstream functionality. The October 28 review is addressed: removed the single cross-curve decoding `RequireThrows` and its unused alternate-group fixture; retained all three null-argument assertions. The RSA fixture cleanup remains identical to current #10915. EC production code is unchanged from the previously reviewed implementation. Cross-curve runtime behavior remains an explicitly documented unknown; no new behavior is asserted. Ubuntu 26.04 x86-64, GCC 15.2.0, Release with bundled dependencies: - Candidate `92e45814d8`: full build succeeded, **37 LibreSSL tests passed**, and full suite **2,961 passed, 32 skipped, zero failures**, 2,993 registered tests in 271.10 seconds. - Publication head `6a5b78ccbf811f3f2eefe76ef9e594ffd31da7a7` additionally integrates unrelated upstream inventory, scheduler, NGS2 and tooling changes; LibreSSL source/tests are unchanged from the candidate. Full build and full suite rerun on this exact head: **2,961 passed, 32 skipped, zero failures**, 2,993 registered tests in 253.32 seconds. - Commands: `cmake --build build --parallel 8`; `ctest --test-dir build -R libressl --output-on-failure --parallel 4`; `ctest --test-dir build --output-on-failure --parallel 4`. Full suite runs use normal host permissions. - Convention check against current upstream main passes without findings; `git diff --check` passes. The required old-fork `origin/main` comparison reports inherited NID/commit-subject findings: the candidate and upstream-only checks produced byte-for-byte identical output (51 findings, 15 errors). These are outside this contribution. - Overlap audit completed on preparation branch `codex/libressl-ec-review-oct30`; shared files and incomplete comparisons against conflicting PRs remain. No claim of a globally conflict-free dependency stack. Reference evidence from original code commit `fb6b35dc7b`: the regression test failed against the prerequisite decoder and passed with this fix. The committed test covers 33 reference points across 11 curves plus decoding errors, field bounds, parity, infinity and state/error-queue effects. A separate real-LibreSSL 2.5.4 differential matched **22,110 cases**, including complete error queues and final point state, with null and supplied BN_CTX. That standalone differential was not rerun for this refresh; reproduction remains below. [Independent Windows validation](https://github.com/boykopovar/AnyPS5/pull/11466#issuecomment-6421003699) applies to earlier head `9e6abd40ab`: contributor-reported Windows 11 / WinLibs GCC 15.2.0 success for five EC/RSA tests. No fresh Windows, PS5 or title execution was performed for this head. No performance claim. <details> <summary>Reproduce the independent LibreSSL 2.5.4 comparison (Linux)</summary> Save the C++ harness below as `differential.cpp` in a temporary directory outside the checkout. Save the shell block as `reproduce.sh`, then run `bash reproduce.sh /absolute/path/to/that/directory` from the AnyPS5 checkout. The reference archive is built outside the repository and is not a runtime dependency. ```sh set -eu research_dir="${1:?Pass the directory containing differential.cpp}" cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON cmake --build build --target guest_libressl_ec_point_tests --parallel 8 curl -fL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.5.4.tar.gz -o "$research_dir/libressl-2.5.4.tar.gz" (cd "$research_dir" && echo '107a5b522fbb8318d4c3be668075e5e607296f0a9255d71674caa94571336efa libressl-2.5.4.tar.gz' | sha256sum -c -) tar -xzf "$research_dir/libressl-2.5.4.tar.gz" -C "$research_dir" cmake -S "$research_dir/libressl-2.5.4" -B "$research_dir/libressl-build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake --build "$research_dir/libressl-build" --target crypto --parallel 8 g++ -std=c++20 -O2 -Icore/libs -I3rdparty/mbedtls/include -I"$research_dir/libressl-2.5.4/include" "$research_dir/differential.cpp" build/core/libs/libs/unpatched/libSceLibreSsl.prx build/3rdparty/mbedtls/library/libmbedcrypto.a build/3rdparty/mbedtls/3rdparty/p256-m/libp256m.a "$research_dir/libressl-build/crypto/libcrypto.a" -lpthread -Wl,-rpath,"$PWD/build/core/libs/libs/unpatched" -o "$research_dir/differential" "$research_dir/differential" ``` ```cpp #include "prx/libSceLibreSsl/include/Api.hpp" #include "prx/libSceLibreSsl/include/Ec.hpp" #include "prx/libSceLibreSsl/include/Error.hpp" #include <openssl/ec.h> #include <openssl/err.h> #include <openssl/bn.h> #include <vector> #include <cstdio> #include <cstdlib> #include <random> #include <cstring> void Require(bool ok) { if (!ok) { std::fputs("reference harness setup failed\n", stderr); std::abort(); } } int main() { const int nids[]={409,415,711,712,713,714,715,716,928,932,934}; std::mt19937 random(12345); size_t cases=0; for(int nid:nids) { EC_GROUP* g=EC_GROUP_new_by_curve_name(nid); EC_POINT* p=EC_POINT_new(g); EcGroup* ag=EC_GROUP_new_by_curve_name_nid_postfix(nid); EcPoint* ap=EC_POINT_new_nid_postfix(ag); Require(g && p && ag && ap); size_t width=(EC_GROUP_get_degree(g)+7)/8; std::vector<unsigned char> initial(1+2*width); Require(EC_POINT_point2oct(g,EC_GROUP_get0_generator(g),POINT_CONVERSION_UNCOMPRESSED,initial.data(),initial.size(),nullptr)==initial.size()); BN_CTX* sharedContext=BN_CTX_new();Require(sharedContext!=nullptr); BN_CTX_start(sharedContext); BIGNUM* guard=BN_CTX_get(sharedContext);Require(guard!=nullptr);Require(BN_set_word(guard,77)==1); auto check=[&](const std::vector<unsigned char>& bytes) { for(BN_CTX* context:{static_cast<BN_CTX*>(nullptr),sharedContext}) { Require(EC_POINT_oct2point(g,p,initial.data(),initial.size(),nullptr)==1); Require(EC_POINT_oct2point_nid_postfix(ag,ap,initial.data(),initial.size(),nullptr)==1); ERR_clear_error(); ERR_clear_error_nid_postfix(); ERR_put_error(1,2,3,__FILE__,__LINE__); LibreSslPutError_nid_no_patch(1,2,3); int expected=EC_POINT_oct2point(g,p,bytes.data(),bytes.size(),context); int actual=EC_POINT_oct2point_nid_postfix(ag,ap,bytes.data(),bytes.size(),context); bool match=expected==actual; for(;;) { auto e=ERR_get_error(); auto a=ERR_get_error_nid_postfix(); if(e!=a) {std::printf("error mismatch %lx %lx\n",e,a);match=false;} if(!e&&!a)break; } std::vector<unsigned char> ep(1+2*width),a(1+2*width); auto len=EC_POINT_point2oct(g,p,POINT_CONVERSION_UNCOMPRESSED,ep.data(),ep.size(),nullptr);Require(len>0);ep.resize(len); if(mbedtls_mpi_cmp_int(&ap->point.MBEDTLS_PRIVATE(Z),0)==0)a={0}; else { a[0]=4; Require(mbedtls_mpi_write_binary(&ap->point.MBEDTLS_PRIVATE(X),a.data()+1,width)==0); Require(mbedtls_mpi_write_binary(&ap->point.MBEDTLS_PRIVATE(Y),a.data()+1+width,width)==0); } if(ep!=a) {puts("state mismatch");match=false;} if(!match) { printf("nid %d case %zu expected %d actual %d bytes ",nid,cases,expected,actual); for(auto v:bytes)printf("%02x",v);puts("");std::exit(1); } Require(BN_get_word(guard)==77); cases++; } }; check({});check({0});check({1});check({0,0}); for(unsigned prefix=0;prefix<256;prefix++) { auto bytes=initial;bytes[0]=prefix;check(bytes); } for(unsigned x=0;x<128;x++) { for(unsigned prefix:{2u,3u}) { std::vector<unsigned char> bytes(width+1);bytes[0]=prefix;bytes.back()=x;check(bytes); } } for(unsigned i=0;i<300;i++) { unsigned prefix=2+random()%6; std::vector<unsigned char> bytes(1+(prefix<4?width:2*width)); for(auto& b:bytes)b=random();bytes[0]=prefix;check(bytes); } for(unsigned i=1;i<64;i++) { BIGNUM* scalar=BN_new();Require(scalar!=nullptr);Require(BN_set_word(scalar,random())==1); Require(EC_POINT_mul(g,p,scalar,nullptr,nullptr,nullptr)==1); for(auto form:{POINT_CONVERSION_COMPRESSED,POINT_CONVERSION_UNCOMPRESSED,POINT_CONVERSION_HYBRID}) { std::vector<unsigned char> bytes(1+2*width); auto n=EC_POINT_point2oct(g,p,form,bytes.data(),bytes.size(),nullptr);Require(n>0);bytes.resize(n);check(bytes); Require(EC_POINT_mul(g,p,scalar,nullptr,nullptr,nullptr)==1); } BN_free(scalar); } BN_CTX_end(sharedContext);BN_CTX_free(sharedContext); EC_POINT_free(p);EC_GROUP_free(g);EC_POINT_free_nid_postfix(ap);EC_GROUP_free_nid_postfix(ag); } printf("Matched return values, full error queues and point coordinates for %zu cases across 11 curves.\n",cases); } ``` Seed 12345; 1,005 encodings per curve, each tested with two context modes, across 11 curves. Inputs include empty/infinity encodings, all 256 prefixes, small compressed X values with both parities, random encodings, and random generator multiples in compressed/uncompressed/hybrid forms. Each case starts with the generator and a pre-existing error. Expected output: ```text Matched return values, full error queues and point coordinates for 22110 cases across 11 curves. ``` </details> <!-- 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. --> ### 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: #11146, #10395, #10915 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-26 15:23:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T15:23:01Z.

Review: CHANGES_REQUESTED


I reviewed the incremental change fb6b35dc7b26fb9455c9eb337c99d34eb3e24efb and the inherited EC decoder context. I did not find a concrete correctness defect in the compressed-point arithmetic or the added vectors. The PR reports a 2,346-pass full suite and a 22,110-case LibreSSL differential; I did not independently rerun those tests.

I am requesting one repository-rule update before approval: this branch’s parent main is 716cb74e0871, while current main is b0f1183ca12b. CONTRIBUTING.md requires each PR branch to stay up to date with main. The intervening commits touch ScanningWide.cpp, GuestWideConversion.cpp, and unrelated debt documents, and the merge-tree preview is clean, so I found no new code conflict. Please sync this branch to current main and let the required checks rerun; the dependency chain can remain as described.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5654486036 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11466#pullrequestreview-5654486036). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T15:23:01Z. **Review:** CHANGES_REQUESTED --- I reviewed the incremental change `fb6b35dc7b26fb9455c9eb337c99d34eb3e24efb` and the inherited EC decoder context. I did not find a concrete correctness defect in the compressed-point arithmetic or the added vectors. The PR reports a 2,346-pass full suite and a 22,110-case LibreSSL differential; I did not independently rerun those tests. I am requesting one repository-rule update before approval: this branch’s parent main is `716cb74e0871`, while current `main` is `b0f1183ca12b`. `CONTRIBUTING.md` requires each PR branch to stay up to date with main. The intervening commits touch `ScanningWide.cpp`, `GuestWideConversion.cpp`, and unrelated debt documents, and the merge-tree preview is clean, so I found no new code conflict. Please sync this branch to current main and let the required checks rerun; the dependency chain can remain as described.
MarcZX10 commented 2026-10-26 15:51:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T15:51:31Z.

Review: APPROVED


Re-reviewed exact head 9e6abd40ab93. This synchronization includes the parent main requested in my earlier review and leaves the EC implementation unchanged. The declared dependency chain (#11146, #10395 and #10915) is explicit; the author reports 28/28 focused tests after syncing, alongside the earlier 2,346-pass full suite and 22,110-case LibreSSL differential. I did not independently rerun those crypto tests. Current-main conventions and git diff --check pass, and the merge preview is clean. The only later main commit changes an unrelated IME debt note. I found no unresolved correctness or dependency-order issue in this update. Approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5654905242 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11466#pullrequestreview-5654905242). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T15:51:31Z. **Review:** APPROVED --- Re-reviewed exact head `9e6abd40ab93`. This synchronization includes the parent `main` requested in my earlier review and leaves the EC implementation unchanged. The declared dependency chain (#11146, #10395 and #10915) is explicit; the author reports 28/28 focused tests after syncing, alongside the earlier 2,346-pass full suite and 22,110-case LibreSSL differential. I did not independently rerun those crypto tests. Current-main conventions and `git diff --check` pass, and the merge preview is clean. The only later `main` commit changes an unrelated IME debt note. I found no unresolved correctness or dependency-order issue in this update. Approved.
MarcZX10 commented 2026-11-18 15:45:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T15:45:55Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: fix the hybrid point decoding validation/state behavior described below.

What I ran

Reviewed head ed8624f22c90b2cf26388a7022e9383f0756a532. No build or tests were run in this review. I read the prepared description, commit list, diff and manifest, and inspected all 12 changed files listed in the manifest; all were marked included. No files were excluded by rule. No repository files outside that set were read for context.

Results

Check Result Note
Source review failed Hybrid point decoding has a validation ordering defect
Build and tests not run No commands executed
PS5 behavior not run No console execution verified

Findings

Blocking

  • core/libs/prx/libSceLibreSsl/src/EcPoint.cpp:133: Hybrid encodings with an incorrect parity bit are rejected before the decoded coordinates are copied into the caller’s point, but hybrid encodings whose parity matches and whose coordinates are off-curve are swapped into the caller’s point at lines 136–138 before mbedtls_ecp_check_pubkey rejects them at line 140. This means a failed hybrid decode changes point state. Keep validation on the temporary decoded point and copy it only after validation, while preserving the reference behavior for failures that occur after point assignment. Add a test for a hybrid encoding with correct parity but off-curve coordinates and assert both the return/error and final point state.

Non-blocking

  • None.

Not verified

  • No build, tests, differential comparison, Windows run, PS5 module run, title run, or console behavior was verified in this review. The description reports earlier host tests and a prior differential comparison; those reports were not rerun at this head.
  • No files were excluded by rule; all 12 changed files listed in the manifest were read. No other repository context was read.

To get this to a good state

Fix the hybrid decoding validation ordering and add a regression test for the rejected off-curve hybrid case. Rerun the EC point tests and relevant build checks on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5959972914 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11466#pullrequestreview-5959972914). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T15:45:55Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: fix the hybrid point decoding validation/state behavior described below. ## What I ran Reviewed head `ed8624f22c90b2cf26388a7022e9383f0756a532`. No build or tests were run in this review. I read the prepared description, commit list, diff and manifest, and inspected all 12 changed files listed in the manifest; all were marked included. No files were excluded by rule. No repository files outside that set were read for context. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Hybrid point decoding has a validation ordering defect | | Build and tests | not run | No commands executed | | PS5 behavior | not run | No console execution verified | ## Findings ### Blocking - `core/libs/prx/libSceLibreSsl/src/EcPoint.cpp:133`: Hybrid encodings with an incorrect parity bit are rejected before the decoded coordinates are copied into the caller’s point, but hybrid encodings whose parity matches and whose coordinates are off-curve are swapped into the caller’s point at lines 136–138 before `mbedtls_ecp_check_pubkey` rejects them at line 140. This means a failed hybrid decode changes point state. Keep validation on the temporary decoded point and copy it only after validation, while preserving the reference behavior for failures that occur after point assignment. Add a test for a hybrid encoding with correct parity but off-curve coordinates and assert both the return/error and final point state. ### Non-blocking - None. ## Not verified - No build, tests, differential comparison, Windows run, PS5 module run, title run, or console behavior was verified in this review. The description reports earlier host tests and a prior differential comparison; those reports were not rerun at this head. - No files were excluded by rule; all 12 changed files listed in the manifest were read. No other repository context was read. ## To get this to a good state Fix the hybrid decoding validation ordering and add a regression test for the rejected off-curve hybrid case. Rerun the EC point tests and relevant build checks on the updated head.

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