Repository navigation
feat(libSceLibreSsl3): implement the EVP AES-128-CCM cipher - #16255
Merged
oneandonlydean merged 10 commits intoNov 9, 2026
Merged
Conversation
Progress report (f0228ed → 9ce8e6f)📈 System libraries: 33.31% (+0.01%, +4 implemented functions) ✅ 4 implemented
Changed libraries (implemented exports)
|
Implement EVP_aes_128_ccm after LibreSSL 4.0.0 e_aes.c and ccm128.c over the parent AES: the L and M parameters fixed at key setup, the length, AAD and tag calls through the EVP update and control interfaces, the zeroed output after a bad tag and the context copy fixup. The forwarded libSceLibreSsl EVP_CipherInit_ex now zeroes the cipher data as LibreSSL 4.0.0 does, which the IV-only path relies on. Record the unverified console behaviour as debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ducengarth
force-pushed
the
feat/libressl3-aes-ccm
branch
from
November 6, 2026 01:25
bb0133f to
c8a87e9
Compare
12 tasks done
12 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
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.
|
11 tasks done
12 tasks done
12 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
…/libressl3-aes-ccm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
…/libressl3-aes-ccm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/libressl3-aes-ccm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/libressl3-aes-ccm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the libSceLibreSsl3 CMakeLists.txt (keep the AES-CCM source and test next to the ChaCha ones from main) and recount the debt-doc "Additional exports" line from AdditionalExports.cpp on the merged tree. Credit: Ducengarth (PR author).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implement
EVP_aes_128_ccm(NID 896,uM9UnC8KFjY) inlibSceLibreSsl3, replacing its parameterless throwing placeholder inAdditionalExports.cpp. Source: LibreSSL 4.0.0 atce488b78, the revision the library's debt file already uses:evp/e_aes.c(aes_ccm_ctrl,aes_ccm_init_key,aes_ccm_cipher) andmodes/ccm128.c.CRYPTO_ccm128_*is ported byte for byte over the parent'sAES_set_encrypt_keyandAES_encrypt, in the same way libSceLibreSsl'sEvpAes.cppportsgcm128.c. mbedtls's CCM is not used, because it rejects 0xFF00 bytes of AAD or more and does not reproduceccm128.c's behaviour:EVP_CTRL_CCM_SET_LorSET_TAGchanges the nonce length or tag length the EVP layer passes, not the encoding.EVP_CTRL_INIT(L 8, M 12),AEAD_GET_IVLEN(15 - L),AEAD_SET_IVLEN,CCM_SET_L,CCM_SET_TAG(even, 4 to 16; a tag only when decrypting),CCM_GET_TAG(encrypt only, after the message) andEVP_CTRL_COPY(rebinds the key schedule pointer), with the same return values.ctx_size336, the LP64 size ofEVP_AES_CCM_CTX. It uses libSceLibreSsl's 88-byteEVP_CIPHER, so the existingEVP_CIPHER_key_lengthandEVP_CIPHER_iv_lengthwork on it.It runs inside libSceLibreSsl's
EVP_CipherInit_ex,EVP_*UpdateandEVP_*Final_ex, which libSceLibreSsl3 forwards. For CCM, 4.0.0'sEVP_*Updatepasses a zero-length update to the cipher, as 2.5.4 does, so the length-setting call works unchanged. One change there:EVP_CipherInit_exnow takes the cipher data fromcallocinstead ofmalloc. LibreSSL 4.0.0 zeroes it, and an IV-only init before any key relies on that: with a zero flags byte, the length call fails as in LibreSSL instead of reading garbage. This is the same one-line change as in #16249. In 2.5.4 the contents were unspecified, so it is still valid for libSceLibreSsl's own ciphers.Known gap, recorded in
docs/dev/debt/libSceLibreSsl3.md: when the cipher fails, the forwarded 2.5.4EVP_EncryptUpdate,EVP_EncryptFinal_exand encryptingEVP_Cipher*calls leave*outlunset and accept a nulloutl, where 4.0.0 sets it to 0 first. The decrypt calls already match. A negative length returns 0 with the state untouched, as in 4.0.0.EVP_aes_192_ccmandEVP_aes_256_ccmare not among libSceLibreSsl3's exports, so they are not added.No title's trace or disassembly was used, and the export was not measured on a PS5.
pr_overlapreports no pull request with the same exports or new files. The "same exports" it lists (Allocate,Align,Calloc,Free,PosixAlign,Realign,Reallocate) are the test's file-local guest-heap callbacks, which other tests also define. The remaining hits are line conflicts:CMakeLists.txtand the debt file. feat(libSceLibreSsl3): implement the EVP ChaCha20 and ChaCha20-Poly1305 ciphers #16249 also makes the samecallocchange, so whichever merges second resolves only the neighbouring lines.I will rebase this one as needed. 65 pull requests that conflict with
maincould not be compared by the tool. I scanned the diffs of all 1892 open pull requests foraes_128_ccm,ccm128and CCM helpers, and none adds them.Tested
Windows 11, MinGW-w64 GCC (WinLibs), Release build. No title or homebrew, and not built on Linux or macOS.
guest_libressl3_aes_ccm(new) passes. It drives the cipher through the forwarded EVP functions:0xFFFElength encoding.SET_IVLENorSET_L. Each message is also opened with a flipped tag bit, ciphertext and AAD, and the output must be zeroed.SET_IVLENwithINT_MINandINT_MAX.EVP_CTRL_COPY: a copied context still encrypts after the source is freed.EVP_CIPHER_key_lengthandEVP_CIPHER_iv_length.mallocfills memory with 0xFF so that thecallocdependence is checked.guest_libressl*andguest_crypto_memcmptests pass, including libSceLibreSsl's after thecallocchange.objdump -ponlibSceLibreSsl3.prxlistsEVP_aes_128_ccm_nid_postfixand nombedtls_*symbol.python3 tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code