Skip to content

feat(libSceLibreSsl): implement the EVP message digest and HMAC functions - #9448

Merged
oneandonlydean merged 7 commits into
boykopovar:mainfrom
HQasper:claude/project-thread-hgbj5s
Nov 2, 2026
Merged

oneandonlydean merged 7 commits into
boykopovar:mainfrom
HQasper:claude/project-thread-hgbj5s

Conversation

@HQasper

@HQasper HQasper commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

All libSceLibreSsl exports outside the open PRs still throw. This implements the 20 EVP message digest and HMAC exports, which is what code built on LibreSSL normally calls instead of the raw SHA256_* functions: EVP_md5, EVP_sha256, EVP_sha384, EVP_sha512, EVP_MD_size, EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_DigestInit_ex, EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_Digest, HMAC_CTX_init, HMAC_CTX_cleanup, HMAC_Init, HMAC_Init_ex, HMAC_Update, HMAC_Final and HMAC.

  • Which LibreSSL. The firmware 13.40 measurements that main already cites for X509_verify_cert_error_string identify LibreSSL 2.5.4, while the module's export table also has SSL_get0_param and X509_VERIFY_PARAM_set1_host, which the Symbols.list of 2.5.4 and 2.6.3 lack and 2.7.2's has. It also has HMAC_CTX_init/HMAC_CTX_cleanup, which 3.4.1 has and 3.5.2 dropped when HMAC_CTX became opaque. The functions follow 2.5.4's digest.c and hmac.c, and src/Evp.cpp starts with the copyright notices, licence conditions and disclaimers of both files, verbatim from that commit. Up to 3.4.1, hmac.c only gains new functions, digest.c only changes malloc to calloc for the digest data and drops a null check before ENGINE_finish, and the EVP_MD, EVP_MD_CTX and HMAC_CTX structures do not change, so the behaviour is the same for either reading.
  • Layouts. The public EVP_MD (120 bytes), EVP_MD_CTX (48) and HMAC_CTX (288) follow evp.h and hmac.h and are checked with static_assert on size and field offsets. The unsigned long flags are a 64-bit field, so the layout also holds on Windows. A context the title allocates, copies or reads (for example through the HMAC_size macro, which reads ctx->md) stays valid.
  • Public header. include/Api.hpp declared the 20 functions with the unknown no-parameter signature. It now holds the three layouts (EvpMd, EvpMdContext, HmacContext) and the real signatures, and Evp.cpp and the test include it instead of local declarations, as was done for the ERR and OCSP functions.
  • Behaviour.
    • The context flags ONESHOT, CLEANED, REUSE and NO_INIT work as in digest.c. Digest data is reused when a context is initialised again with the same digest, freed and replaced when the digest changes, zeroed after EVP_DigestFinal_ex, and zeroed and freed by EVP_MD_CTX_cleanup, which then clears the context.
    • When allocating the digest data fails, EVP_DigestInit_ex returns 0 and leaves the context without a digest, update function or data, so calling it again allocates again. LibreSSL keeps the digest with null data there, and a retry with the same digest runs its init on a null pointer. The context copy inside HMAC_Init_ex and HMAC_Final does the same when its allocation fails.
    • HMAC_Init_ex hashes keys longer than the block size and stores a key of exactly the block size unhashed, as hmac.c does (block < len). It re-initialises with the stored key when called without key or digest, and returns 0 when the digest changes without a key, for a negative key length and when no digest was ever set. HMAC_Update and HMAC_Final return 0 without a digest. HMAC_Init clears the context first when both key and digest are given. HMAC with a null output buffer returns a static buffer. HMAC_CTX_cleanup zeroes all 288 bytes.
    • All digest work goes through the EVP_MD function table, so an EVP_MD the title defines itself also works.
  • The EVP_MD tables carry LibreSSL's NIDs, public key types, flags (0 for MD5, EVP_MD_FLAG_PKEY_METHOD_SIGNATURE | EVP_MD_FLAG_DIGALGID_ABSENT = 0xc for SHA-256, SHA-384 and SHA-512), block sizes and context sizes from m_md5.c and m_sha1.c. sign and verify (RSA_sign, RSA_verify in LibreSSL) are null because RSA_sign and RSA_verify still throw.
  • Digest data and EVP_MD_CTX_create contexts come from the guest heap (malloc, calloc and free of libc), as LibreSSL uses the module's own libc.
  • Paths that need unimplemented parts throw through NotImplemented_nid_no_patch: an ENGINE argument, and a context that holds an ENGINE or an EVP_PKEY_CTX. Null contexts, EVP_DigestInit_ex without a type on a context that already has a digest, and an update or final on a context without a digest throw std::invalid_argument; LibreSSL does not check these and would crash.
  • Failures return 0 as in LibreSSL but add nothing to the error queue. main now has the queue and LibreSslPutError_nid_no_patch, but no libSceLibreSsl export publishes to it yet; publishing LibreSSL's codes here (for example ERR_R_MALLOC_FAILURE from EVP_DigestInit_ex) is left for a follow-up and recorded in the debt entry.
  • The debt file gets an entry for these functions (including the allocation-failure difference), and the pending-export count goes from 292 to 272, matching the 272 stubs left in Export.cpp.

Tested

Which head each run covers: everything under Linux is on the current head 4a465be (on main 0836dfd, 2026-10-31). The Windows run is on the earlier head b2583e3 and has not been repeated since.

Linux (Ubuntu 24.04 container, GCC 13.3, Release, BUILD_TESTING=ON; on 4a465be; earlier rounds on f6b83d9, 81733ad, 2b3f66e, ca37404, 5994190, b2583e3, 42d887d, b55c473, 0929356, 6f2687c, db69a66 and 334de4d):

  • New guest_libressl_evp: passed. For MD5, SHA-256, SHA-384 and SHA-512 it checks:

    • the EVP_MD fields (NID, public key type, size, flags, block and context size, required key types, function pointers), with flags 0 for MD5 and 0xc for SHA-256, SHA-384 and SHA-512;
    • EVP_DigestInit_ex/Update/Final_ex and EVP_Digest on the empty string, abc and a 1000-byte message, fed in chunks of 1, block - 1, block, block + 1 and 1000 bytes;
    • the RFC 4231 test cases 1 to 4, 6 and 7 for HMAC (also with MD5), including the 131-byte keys that get hashed, over the same chunk sizes;
    • HMAC with keys of exactly the block size: a 64-byte key with SHA-256 and a 128-byte key with SHA-512 over the 1000-byte message in chunks of 1, the key size and 1000 bytes, checking the MAC, that key_length equals the block size and that the key is stored unhashed, plus the one-shot HMAC;
    • the HMAC_CTX fields (md, key_length, the key and its zero padding), re-initialisation without key and digest, HMAC_Init, and the one-shot HMAC with and without an output buffer;
    • the context after Final and cleanup, the reuse of digest data, the NO_INIT flag, a title-defined EVP_MD, a digest size over 64 returning 0, the HMAC refusals listed above and the invalid-argument throws (null contexts, an update or final without a digest, EVP_DigestInit_ex without a type on a context that has one). The ENGINE and EVP_PKEY_CTX paths are not asserted, as they throw only because that support is missing;
    • allocation failures, through a test allocator registered with ApplicationHeapRegister_nid_no_patch that fails a chosen allocation and counts live blocks: EVP_DigestInit_ex on a new context and when switching digest, EVP_MD_CTX_create, EVP_Digest, HMAC_Init_ex failing at each of its three allocations with a 4-byte and a 131-byte key, and HMAC. Each returns 0 or null, frees what it allocated and leaves no context with a digest but no data (an update or final on a context left without a digest throws), and the same call again gives the right digest or MAC. No block is left allocated at the end of the test.

    Expected values were computed with Python hashlib and hmac; the SHA-2 HMAC values match RFC 4231. The block-size key MACs, the stored key length and key, and the flags of all four tables were also produced by LibreSSL 2.5.4's own hmac.c, digest.c, m_sha1.c, m_md5.c, sha256.c, sha512.c and md5_dgst.c (commit 2e2c61206, built with a small host harness) and match. With the inner pad changed to 0x37, the key padding left out, the NO_INIT early return removed or the context clearing in HMAC_Init removed, the test fails. It also fails when a key of exactly the block size is hashed (block <= len), when EVP_MD_FLAG_DIGALGID_ABSENT is dropped from SHA-256 or set on MD5, and with the previous EVP_DigestInit_ex order (digest set before the allocation) or the previous context copy (digest kept when its allocation fails).

  • All other libSceLibreSsl and libSceLibreSsl3 tests on main passed: guest_libressl_digest, guest_libressl_des, guest_libressl_x509_errors, guest_libressl_runtime, guest_libressl_aes, guest_libressl_asn1, guest_libressl_asn1_allocator, guest_libressl_ex_data, guest_libressl_error, guest_libressl_ocsp, guest_libressl_stack, guest_libressl_ui, guest_libressl_rsa, guest_libressl_x509_store, guest_libressl_x509_store_allocator, guest_libressl_x509_store_context, guest_libressl_x509_lookup, guest_libressl_x509_lookup_allocator, guest_libressl_x509_verify_param, guest_libressl_x509_verify_param_allocator, guest_libressl_pkey_type, guest_libressl_cipher, guest_libressl_alert, guest_libressl_version, guest_libressl_crypto_locks, guest_libressl_object_text, guest_libressl_object_allocation, guest_libressl_protocol, guest_libressl_protocol_nid, guest_libressl3_digest, guest_libressl3_digest_context, guest_libressl3_asn1, guest_libressl3_cipher, guest_libressl3_key_reference, guest_libressl3_stack, guest_libressl3_x509_verify_param and guest_crypto_memcmp (39/39 together with guest_libressl_evp and patched_libraries). Their sources include the changed include/Api.hpp. The opt-in guest_libressl_oracle (ANYPS5_LIBRESSL_ORACLE) was not enabled; it compares the AES, digest, DES parity and error-string exports, not these functions.

  • patched_libraries: passed. libSceLibreSsl.prx exports the same 394 _nid_postfix names as on main.

  • python3 tools/check_conventions.py --base upstream/main: passed.

  • The mutants above (block <= len, the SHA-256 flags, the EVP_DigestInit_ex order and the HMAC_Init_ex context copy) were rerun on 4a465be and each makes guest_libressl_evp fail.

  • MinGW-w64 13.2 (x86_64-w64-mingw32-g++-posix -std=gnu++20 -fsyntax-only with the UCRT defines) compiles every libSceLibreSsl and libSceLibreSsl3 source and LibreSSL test except the opt-in oracle test on 4a465be without errors.

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r7, the toolchain of the CI Windows job), CMake 4.3.1, Ninja 1.13.2, Release, BUILD_TESTING=ON, configured as in CI (cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, submodules with git submodule update --init --recursive --depth 1):

  • On b2583e3 (2026-10-25): libSceLibreSsl, libSceLibreSsl3, the LibreSSL test executables, guest_crypto_memcmp_tests and patched_libraries_tests built with no warning in any libSceLibreSsl file; Evp.cpp, Export.cpp and GuestLibreSslEvp.cpp also compile without warnings with -Wall -Wextra. tools/check_test_registration.py passed. The same 14 tests as on Linux passed. The unpatched libSceLibreSsl.prx exports the same 394 _nid_postfix names as the Linux build, including the 20, and guest_libressl_evp_tests.exe imports exactly these 20 from it. With a key of exactly the block size hashed (block <= len), guest_libressl_evp fails on Windows as well.

  • Earlier rounds: guest_libressl_evp and the digest tests passed on f6b83d9 and 81733ad.

  • Not rerun on Windows since b2583e3. Since then the rebases (onto c7b4878, 750cf6c, 04fefeb, 3679074, 409fe64, d4de594 and 0836dfd) only changed the conflicting lines next to main's new code in CMakeLists.txt, include/Api.hpp, Export.cpp (stubs next to main's OBJ_cleanup and OBJ_create changes) and the debt file, plus the debt entry's wording about RSA_sign and RSA_verify; the third review only prepended the licence comment to Evp.cpp and removed five assertions from GuestLibreSslEvp.cpp; the code in both is otherwise the same as on b2583e3. The MinGW-w64 syntax check above is the only Windows-toolchain check on 4a465be.

  • Not tested: any title or homebrew (no title using libSceLibreSsl is known).

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: none
  • Fixes: none
  • Unblocks: feat(libSceLibreSsl3): implement EVP digest contexts and SHA methods #10960 (its mixed EVP test is built only once src/Evp.cpp exists and uses EvpMd and EvpMdContext)
  • GPUs tested: n/a
  • AI-assisted: yes

Duplicate and overlap check

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Progress report (24238c4 → 7bc5f0e)

📈 System libraries: 26.18% (+0.06%, +21 implemented functions)

✅ 21 implemented
Library Name
libSceLibreSsl EVP_DigestFinal_ex_nid_postfix
libSceLibreSsl EVP_DigestUpdate_nid_postfix
libSceLibreSsl EVP_MD_CTX_create_nid_postfix
libSceLibreSsl EVP_MD_CTX_init_nid_postfix
libSceLibreSsl EVP_MD_size_nid_postfix
libSceLibreSsl EVP_md5_nid_postfix
libSceLibreSsl EVP_sha256_nid_postfix
libSceLibreSsl EVP_sha384_nid_postfix
libSceLibreSsl EVP_sha512_nid_postfix
libSceLibreSsl HMAC_CTX_init_nid_postfix
libSceLibreSsl HMAC_Update_nid_postfix
libSceLibreSsl Md5Final
libSceLibreSsl Md5Init
libSceLibreSsl Md5Update
libSceLibreSsl Sha256Final
libSceLibreSsl Sha256Init
libSceLibreSsl Sha256Update
libSceLibreSsl Sha384Init
libSceLibreSsl Sha512Final
libSceLibreSsl Sha512Init
libSceLibreSsl Sha512Update

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl 111/401 (27.68%) 132/411 (32.12%) +4.44%

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9536 docs/dev/debt/libSceLibreSsl.md L10
PR 10834 core/libs/prx/libSceLibreSsl/CMakeLists.txt L1
core/libs/prx/libSceLibreSsl/Export.cpp L483-532, L543-582, L663-737
core/libs/prx/libSceLibreSsl/include/Api.hpp L252, L376-385, L388-395, L413-420
docs/dev/debt/libSceLibreSsl.md L10
PR 10878 core/libs/prx/libSceLibreSsl/CMakeLists.txt L1
docs/dev/debt/libSceLibreSsl.md L10
PR 10915 docs/dev/debt/libSceLibreSsl.md L10
PR 11003 docs/dev/debt/libSceLibreSsl.md L10
PR 13860 docs/dev/debt/libSceLibreSsl.md L10

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9446 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
docs/dev/debt/libSceLibreSsl.md
PR 9571 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 10508 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 10570 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11128 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11151 core/libs/prx/libSceLibreSsl/CMakeLists.txt
core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11174 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 11553 docs/dev/debt/libSceLibreSsl.md
PR 11662 core/libs/prx/libSceLibreSsl/Export.cpp
docs/dev/debt/libSceLibreSsl.md
PR 14115 core/libs/prx/libSceLibreSsl/Export.cpp
core/libs/prx/libSceLibreSsl/include/Api.hpp
docs/dev/debt/libSceLibreSsl.md
PR 14212 docs/dev/debt/libSceLibreSsl.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test coverage is unusually thorough: digest/HMAC vectors include chunk boundaries and RFC 4231 cases, context layouts and reuse are checked, and Linux plus MinGW runs are reported. I found one failure-path defect in DigestInit: when malloc_nid_postfix returns null, it returns 0 after assigning context.digest = type, but leaves context.mdData null. A retry with the same digest skips allocation because context.digest == type and then calls type->init(&context) with null mdData; this can crash. Please leave the context retryable (or otherwise fail explicitly without publishing a partially initialized digest) and add coverage for allocator failure/retry if the test harness allows it.

The branch is also based on a6dcea927, 47 commits behind current main (110a18ba01); the described checks and overlap scan used the earlier base/open-PR snapshot. Please update/rebase and rerun conventions, overlap/debt and focused digest/HMAC tests on current main, preserving the declared #9025 dependency and the CMake/debt merge coordination with #9033/#9041/#9047. Hosted full Linux/Windows product jobs are skipped; the author-reported local Linux and Windows tests are useful but not hosted validation. I did not run local crypto tests.

@HQasper

HQasper commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Thanks, fixed in f6b83d9.

@HQasper

HQasper commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4777cac (includes 110a18b), still stacked on #9025 at 52a439b. The conventions check passes, and guest_libressl_evp, guest_libressl_digest and patched_libraries pass on Linux and on Windows (MinGW-w64 GCC 15.2.0). I rescanned all 1237 open PRs: no other PR touches these 20 functions. The conflicts with #9033, #9041, #9047, #9446 and #9529 are still only the add_library/test block in the CMakeLists and the debt count line, the same places as #9025's; #9571 conflicts only in the debt file and #9535/#9536 not at all. The description is updated.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@HQasper
HQasper force-pushed the claude/project-thread-hgbj5s branch from f6b83d9 to 81733ad Compare October 23, 2026 12:03
@HQasper
HQasper force-pushed the claude/project-thread-hgbj5s branch from 81733ad to 2b3f66e Compare October 23, 2026 12:56
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@HQasper
HQasper force-pushed the claude/project-thread-hgbj5s branch from 2b3f66e to ca37404 Compare October 23, 2026 18:57
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@HQasper

HQasper commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@oneandonlydean
Thanks for the standalone run. Both changes are pushed (head 334de4d, rebased on main d4de594; it also merges cleanly with 140d55e):

  1. Notices. src/Evp.cpp now starts with the header comments of LibreSSL 2.5.4's evp/digest.c ($OpenBSD: digest.c,v 1.27: the Eric Young notice and the OpenSSL Project notice) and hmac/hmac.c ($OpenBSD: hmac.c,v 1.24: the Eric Young notice), verbatim from the pinned commit 2e2c612066aa, in the same form as libSceLibreSsl3/src/Stack.cpp. (7aa1dbe)
  2. Implementation-limit assertions. I removed the five RequireThrows on the ENGINE arguments to EVP_DigestInit_ex, EVP_Digest and HMAC_Init_ex, the cleanup with context.engine set and the init with context.pkeyContext set, plus the local they used. The production guards, the debt entry, the invalid-argument checks, the vectors and the allocator-failure/retry assertions are unchanged. (334de4d)

On 334de4d (Linux): check_conventions.py --base upstream/main passes, and so do all libSceLibreSsl/libSceLibreSsl3 tests, including guest_libressl_evp and patched_libraries. The block-size, flag, init-order and context-copy mutants are still caught, and a MinGW-w64 syntax check of the LibreSSL sources and tests passes. The description is updated; the Windows run is still labelled as b2583e3.

Comment to post on #9448 (2026-10-31, after the rebase)

Rebased on main 0836dfd and pushed (head 4a465be). #13562 had moved OBJ_cleanup and OBJ_create out of Export.cpp right next to the HMAC stubs this PR removes, so I kept main's side; compared with main, Export.cpp loses exactly the 20 stubs. The pending-export count goes from 292 to 272, matching the 272 stubs left. The two review changes (the LibreSSL notices in src/Evp.cpp and the removed ENGINE/EVP_PKEY_CTX assertions) are unchanged.

On 4a465be (Linux): check_conventions.py --base upstream/main passes, and so do all 39 libSceLibreSsl/libSceLibreSsl3 tests, including guest_libressl_evp and patched_libraries. The mutants are still caught, and the MinGW-w64 syntax check passes. #10395's current head 9074d90 still stacks on top: all 40 LibreSSL tests pass with both sides kept. The Tested section names this head.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 31, 2026
@HQasper
HQasper force-pushed the claude/project-thread-hgbj5s branch from 334de4d to 4a465be Compare October 31, 2026 20:39
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 31, 2026
…ions

EVP_md5, EVP_sha256, EVP_sha384, EVP_sha512, EVP_MD_size, the
EVP_MD_CTX init/create/cleanup/destroy functions, EVP_DigestInit_ex,
EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_Digest and HMAC_CTX_init,
HMAC_CTX_cleanup, HMAC_Init, HMAC_Init_ex, HMAC_Update, HMAC_Final and
HMAC threw. They now behave as LibreSSL's digest.c and hmac.c, on the
public EVP_MD, EVP_MD_CTX and HMAC_CTX layouts, and call through the
EVP_MD function table, so a context the title copies or inspects and a
digest table the title defines keep working.

The module exports SSL_get0_param and X509_VERIFY_PARAM_set1_host (new
in LibreSSL 2.7) and HMAC_CTX_init (gone in 3.5); between 2.7.2 and
3.4.1 these layouts and functions do not change. ENGINE and
EVP_PKEY_CTX use, and calls LibreSSL would crash on, throw.

When allocating the digest data fails, the context is left without a
digest instead of with a digest and no data, so initialising it again
allocates rather than running the digest's init on a null pointer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main now records LibreSSL 2.5.4 for the module, from the firmware 13.40
measurements, while the EVP/HMAC entry inferred 2.7 or later from the
SSL_get0_param export. digest.c, hmac.c and the EVP_MD, EVP_MD_CTX and
HMAC_CTX layouts behave the same from 2.5.4 to 3.4.1, so the entry now
links the 2.5.4 sources and names both readings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n the public header

The canonical include/Api.hpp still declared the 20 implemented EVP and
HMAC exports with the unknown no-parameter signature. It now holds the
EVP_MD, EVP_MD_CTX and HMAC_CTX layouts and the real signatures, and
Evp.cpp and the guest test use it instead of local declarations.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
HMAC with a 64-byte key for SHA-256 and a 128-byte key for SHA-512 must
copy the key unhashed, as LibreSSL 2.5.4's hmac.c only hashes keys longer
than the block. The expected MACs, key lengths and flags (MD5 0,
SHA-256/384/512 0xc) were produced by LibreSSL 2.5.4's own hmac.c,
digest.c, m_sha1.c and m_md5.c.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ource

Evp.cpp follows the control flow of LibreSSL 2.5.4's digest.c and
hmac.c, so it starts with the copyright notices, licence conditions and
disclaimers of both files, verbatim from commit 2e2c612066aa.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontext paths

The ENGINE arguments to EVP_DigestInit_ex, EVP_Digest and HMAC_Init_ex,
a cleanup with an ENGINE set and an init with an EVP_PKEY_CTX set throw
because that support is missing, not because the input is invalid.
Asserting it would break once the support exists, so the test no longer
checks these paths. The production guards and the debt entry stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HQasper
HQasper force-pushed the claude/project-thread-hgbj5s branch from 4a465be to a505de4 Compare November 1, 2026 12:31
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
ahmadmuj added a commit to ahmadmuj/AnyPS5 that referenced this pull request Nov 1, 2026
@AZLisme

AZLisme commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@oneandonlydean could you make the merge decision for current head a505de4ed8f0f4bd996a2fb32555f820c419558c? Its actual merge is the remaining declared prerequisite for #10960.

Your license-notice and implementation-limit assertion requests are present in the current source. MarcZX10's latest submitted review is APPROVED; there are no inline review threads or current conflicts. The current-head linked Windows Build 41306912241 succeeded.

The later ten-PR batch 41347775299 includes this exact head and passed its full Linux/Windows product jobs, but failed overall on the x86_64/Rosetta mulx_lowering test (MULX changed arithmetic flags). Its cause/ownership is unestablished; I am not presenting that batch as wholly green or as validation against today's main.

I have only upstream READ permission. Please merge if no concrete blocker remains, or identify the remaining required change/run. If a fresh single-PR run is needed, the current-main command is gh workflow run build.yml --repo boykopovar/AnyPS5 --ref main --field pr=9448 --field full=true --field linux=true --field select=true. I will then validate #10960 against the actual landed inputs.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@AZLisme

AZLisme commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@HQasper #9448 currently reports a merge conflict at a505de4ed8f0f4bd996a2fb32555f820c419558c against current main (3c3b3cda739f when checked). Could you resolve it while preserving the existing implementation and rerun the affected checks? This is the remaining declared prerequisite for #10960. @oneandonlydean, once the conflict is resolved, please merge it or identify the specific remaining requirement; the earlier notices/assertion requests are already addressed. I cannot update this contributor branch or merge upstream with my READ permission.

@AZLisme

AZLisme commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@HQasper I prepared the conflict resolution so you can adopt it directly: commit 7bc5f0ea259f, on codex/parent9448-donor-20261102. It is a merge of your unchanged public head a505de4ed8f0 and main 98346b748caa.

The three conflicts preserve both EVP/HMAC and main's cipher-context source, declarations and tests; existing ERR and LibreSSL3 changes stay intact. The original EVP/HMAC implementation and fixture are unchanged. Linux x86-64/GCC 16.2.1 Release: 43 related SSL/SSL3/crypto tests and 65 public-header checks pass, along with conventions and targeted NID patching of the two freshly built providers. Two protocol tests that depend on the full-project libs target were not run; no new Windows or full-project CI is claimed.

If your branch is still at a505de4ed8f0, you can fast-forward it without rewriting history:

git fetch https://github.com/AZLisme/AnyPS5.git codex/parent9448-donor-20261102
git merge --ff-only FETCH_HEAD

Please review/adopt this resolution and update the existing PR branch. @oneandonlydean, this addresses the current conflict blocking #9448 and its dependent #10960 once adopted; please merge after your remaining concrete checks/decision. I have not changed HQasper's branch or opened another PR.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi HQasper,

#9448 conflicted with main, and it is the remaining prerequisite for #10960, so we have fast-forwarded your branch to the merge AZLisme prepared: 7bc5f0e, a merge of your unchanged head a505de4 with main 98346b7. Thanks, AZLisme.

We checked it before pushing. It changes only the three conflicted files. The CMake source list keeps both sides' files, Api.hpp keeps your EVP digest/HMAC structs and main's cipher context, and the pending-exports figure is 261, which matches the stub count in Export.cpp. It builds, and the affected tests pass on Linux. Your own commits are unchanged.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@AZLisme

AZLisme commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@oneandonlydean the conflict repair you adopted at 7bc5f0ea259f7172880c0b8e7ea2ac25509db9f6 now has successful upstream Windows execution. I checked the actual log: PR #9448/head 7bc5f0ea259f was merged into frozen main 0278ca983148; the changed-guest helper built the normal libs target and fixtures, then CTest reported 1,962 passed, 952 skipped, zero failed. All 45 LibreSSL/LibreSSL3/crypto-related cases passed, including guest_libressl_evp and the cipher-context case. Skips remain unexecuted; this lane did not run the separate skip validator or public-header checks. The previously reported Linux check passed 43 related runtime cases plus 65 header checks.

GitHub now reports CLEAN with all completed applicable checks successful; the agreed conflict repair is on the author's branch. Please merge #9448, or identify a concrete remaining issue. Its actual merge will unblock the final #10960 integration, which I will test against the landed source. My upstream permission remains READ, so I cannot perform the merge myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants