feat(libSceLibreSsl): implement EVP_aes_{128,192,256}_wrap #16539

Merged
MarcZX10 merged 8 commits from upstream-pr/16539 into main 2026-11-11 11:30:52 +00:00
MarcZX10 commented 2026-11-07 02:11:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-07T02:11:08Z.


What

Implements EVP_aes_128_wrap, EVP_aes_192_wrap and EVP_aes_256_wrap (RFC 3394 AES key wrap) in libSceLibreSsl, and replaces the three NotImplemented stubs in libSceLibreSsl3 with forwards to the parent export, as the GCM ciphers already do.

  • Descriptors: NIDs 788, 789, 790 (as in the vendored LibreSSL obj_mac.num), block and IV 8 bytes, key 16/24/32 bytes, flags follow LibreSSL 2.5.4 e_aes.c WRAP_FLAGS.
  • The wrap and unwrap loops reuse the AES key schedule and block functions of the existing EVP_aes_* ciphers. No second AES is added.
  • EVP_CipherInit_ex keeps the EVP_CIPHER_CTX_FLAG_WRAP_ALLOW bit across a cipher change and rejects wrap-mode ciphers without it, as upstream does.
  • Debt entry added in docs/dev/debt/libSceLibreSsl.md.

Tested

  • Build: guest_libressl_evp_cipher_ctx on Linux (Debian, GCC, archive build on this host), BUILD-EXIT 0, 1/1 Test #3133: guest_libressl_evp_cipher_ctx ... Passed.
  • The test pins RFC 3394 section 4.1 (AES-128), 4.2 (AES-192) and 4.3 and 4.6 (AES-256), in both directions, with the wrap-allow gate, default and explicit IV, a tampered unwrap, a length query and bad lengths.
  • NOT run: the test against the unfixed (stub) code. The stub throws NotImplemented, so the new test is expected to fail there, but that has not been measured.
  • Not run: Windows, macOS, console or title tests.
  • The last commit only changes the debt file after the build above (NID wording), so it has no code effect.

Checklist

  • Conventional commit subjects
  • tools/check_conventions.py passes
  • git diff --check clean
  • One implementation and one test commit per function, plus a docs(debt) commit
  • Depends on: none

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5197478417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16539). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-07T02:11:08Z. --- ### What Implements `EVP_aes_128_wrap`, `EVP_aes_192_wrap` and `EVP_aes_256_wrap` (RFC 3394 AES key wrap) in libSceLibreSsl, and replaces the three `NotImplemented` stubs in libSceLibreSsl3 with forwards to the parent export, as the GCM ciphers already do. - Descriptors: NIDs 788, 789, 790 (as in the vendored LibreSSL `obj_mac.num`), block and IV 8 bytes, key 16/24/32 bytes, flags follow LibreSSL 2.5.4 `e_aes.c` `WRAP_FLAGS`. - The wrap and unwrap loops reuse the AES key schedule and block functions of the existing EVP_aes_* ciphers. No second AES is added. - `EVP_CipherInit_ex` keeps the `EVP_CIPHER_CTX_FLAG_WRAP_ALLOW` bit across a cipher change and rejects wrap-mode ciphers without it, as upstream does. - Debt entry added in `docs/dev/debt/libSceLibreSsl.md`. ### Tested - Build: `guest_libressl_evp_cipher_ctx` on Linux (Debian, GCC, archive build on this host), `BUILD-EXIT 0`, `1/1 Test #3133: guest_libressl_evp_cipher_ctx ... Passed`. - The test pins RFC 3394 section 4.1 (AES-128), 4.2 (AES-192) and 4.3 and 4.6 (AES-256), in both directions, with the wrap-allow gate, default and explicit IV, a tampered unwrap, a length query and bad lengths. - NOT run: the test against the unfixed (stub) code. The stub throws `NotImplemented`, so the new test is expected to fail there, but that has not been measured. - Not run: Windows, macOS, console or title tests. - The last commit only changes the debt file after the build above (NID wording), so it has no code effect. ### Checklist - [x] Conventional commit subjects - [x] `tools/check_conventions.py` passes - [x] `git diff --check` clean - [x] One implementation and one test commit per function, plus a docs(debt) commit - [x] Depends on: none AI-assisted: yes
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!16539
No description provided.