Multithreaded AES-XTS decryption (OpenMP) #4
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-zecoxao/ps4encdec!4
Loading…
Reference in a new issue
No description provided.
Delete branch "multithreaded-openmp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Makes
ps4encdecmultithreaded. The per-1 MiB work blocks are independent — each block's AES-XTS tweak depends only on the absolute sector index — so the main loop is embarrassingly parallel.aes_xtscontext is initialized once and only read while crypting, so it is shared read-only across threads (the AES tables arestatic const).criticalsection with an explicit seek, so the result is correct regardless of completion order (crypting, the hot path, stays outside the lock).OMP_NUM_THREADSor an optional[threads]argument:ps4encdec <keys> <input> <output> <ivoffset> [threads]Makefilegains-fopenmp.Latent bugs fixed along the way
_ftelli64/_fseeki64instead of 32-bitunsigned long(matters for HDD-partition-sized inputs).Verification
-O2 -fopenmp). Past ~8 threads it becomes I/O/write-lock bound, as expected for a decrypt tool.🤖 Generated with Claude Code