Skip to content

feat(libSceLibreSsl3): implement PKCS5_PBKDF2_HMAC - #15624

Closed
user236404 wants to merge 1 commit into
boykopovar:mainfrom
user236404:claude/epic-tesla-2yue6y
Closed

user236404 wants to merge 1 commit into
boykopovar:mainfrom
user236404:claude/epic-tesla-2yue6y

Conversation

@user236404

Copy link
Copy Markdown
Contributor

What

Implements PKCS5_PBKDF2_HMAC (libSceLibreSsl3, NID vnwZHU5FvBQ), which threw NotImplemented_nid_no_patch as a parameterless placeholder. It now has LibreSSL's prototype int (const char* pass, int passlen, const unsigned char* salt, int saltlen, int iter, const EVP_MD* digest, int keylen, unsigned char* out) and follows LibreSSL 4.0.0 evp/evp_pbe.c (the version the 13.40 module reports; the function is unchanged from 2.5.4), using libSceLibreSsl's HMAC and digests.

  • A null digest returns 0 and queues EVP_R_MESSAGE_DIGEST_IS_NULL (0x06fff09f), as 4.0.0's EVP_MD_size does.
  • A null password, or a negative password length other than -1, returns 0 through HMAC_Init_ex, as in LibreSSL; -1 means strlen; an iteration count below 1 acts as 1; a key length of 0 returns 1 and writes nothing.
  • Inputs the reference overruns or loops on throw std::invalid_argument: a negative key length, a null output, a negative salt length, a null salt with a positive length, a digest size of 0 or over 64.
  • docs/dev/debt/libSceLibreSsl3.md: new entry (nothing checked on the console; the queued error has no file/line), the placeholder row removed and the count cut from 175 to 174.

Tested

Linux x86_64 (Ubuntu 24.04, GCC 13.3), full build with -DBUILD_TESTING=ON on 086c0686c8. Titles and console: not tested.

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: none
  • GPUs tested: n/a
  • AI-assisted: yes

Derive keys with PBKDF2 (RFC 8018) as LibreSSL 4.0.0's evp_pbe.c
does, over libSceLibreSsl's HMAC and digests. A null digest returns 0
with EVP_R_MESSAGE_DIGEST_IS_NULL queued; a null password or a
negative password length other than -1 returns 0; inputs the
reference overruns on throw.

Add guest_libressl3_pbkdf2 with RFC 7914 and hashlib vectors, the
edge cases and allocation failures, and compare the export with
LibreSSL 2.5.4 in guest_libressl_oracle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BunnyFl

BunnyFl commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@alvaroelpob @user236404 a heads-up: #15622 and #15624 both implement PKCS5_PBKDF2_HMAC in libSceLibreSsl3. They were opened five minutes apart (22:11 and 22:16 UTC on 2026-11-03), and both add core/libs/prx/libSceLibreSsl3/src/Pbkdf2.cpp and register a test named guest_libressl3_pbkdf2 (CMakeLists.txt:112 in each), so only one of them can merge. CONTRIBUTING.md asks overlapping authors to agree which one goes ahead, so it would help if you two settled that here.

Where they differ, read from the two heads (c3bcda3c3f and 123ac269b7):

I haven't reviewed either one in full yet. I'll hold off until you've agreed which one continues, then review that one.

@user236404

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up. #15622 was opened first, so I’m happy for it to go ahead, and I’ll close #15624 once @alvaroelpob confirms. After it merges I can send a small follow-up with the differences listed above (null digest returning 0 with EVP_R_MESSAGE_DIGEST_IS_NULL, the reference’s check order, and the guest_libressl_oracle cases), if that’s welcome. @alvaroelpob, if you’d rather fold those into #15622 yourself, that works too.

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

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 123ac26 merged onto main 1c8c0ef · tested 2026-11-04 05:20 UTC · 18 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 1,129 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 7 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 1,140 of 3,842 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (549 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.6 s, ⚠️ public_headers 45.3 s, ⚠️ agc_driver_image_sample_unnormalized 44.9 s, ⚠️ agc_driver_lazy_resolved_abi 39.4 s, ⚠️ agc_driver_sample_multisample_target 36.4 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
Validation IDs already present on main (8 IDs in 470 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (470 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 462 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (7)
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
Reproduce
git fetch origin 123ac269b73398a5d10903d34865a473363bf69a 1c8c0efc8c41314402e6966da5bef6ea3d639d10
git checkout 1c8c0efc8c41314402e6966da5bef6ea3d639d10 && git merge --no-ff 123ac269b73398a5d10903d34865a473363bf69a
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@user236404

Copy link
Copy Markdown
Contributor Author

Closing in favour of #15622 as agreed

@user236404 user236404 closed this Nov 4, 2026
@user236404
user236404 deleted the claude/epic-tesla-2yue6y branch November 4, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants