Repository navigation
feat(libSceLibreSsl3): implement PKCS5_PBKDF2_HMAC - #15624
user236404 wants to merge 1 commit into
Conversation
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>
|
@alvaroelpob @user236404 a heads-up: #15622 and #15624 both implement Where they differ, read from the two heads (
I haven't reviewed either one in full yet. I'll hold off until you've agreed which one continues, then review that one. |
|
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. |
✅ AMD GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (8 IDs in 470 tests)Skipped (7)ReproduceAutomated 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. |
|
Closing in favour of #15622 as agreed |
What
Implements
PKCS5_PBKDF2_HMAC(libSceLibreSsl3, NIDvnwZHU5FvBQ), which threwNotImplemented_nid_no_patchas a parameterless placeholder. It now has LibreSSL's prototypeint (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.0evp/evp_pbe.c(the version the 13.40 module reports; the function is unchanged from 2.5.4), using libSceLibreSsl's HMAC and digests.EVP_R_MESSAGE_DIGEST_IS_NULL(0x06fff09f), as 4.0.0'sEVP_MD_sizedoes.HMAC_Init_ex, as in LibreSSL; -1 meansstrlen; an iteration count below 1 acts as 1; a key length of 0 returns 1 and writes nothing.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=ONon086c0686c8. Titles and console: not tested.guest_libressl3_pbkdf2passes (0.2 s): RFC 7914 §11 vectors, Pythonhashlib.pbkdf2_hmacvectors for MD5, SHA-256, SHA-384 and SHA-512 (password longer than the block, partial last block, embedded NULs), -1 and 0 lengths, iteration counts 0 and -5, null and empty salt, the failure and throwing cases, no leaked allocations, and allocation failures returning 0.guest_libressl_oracle(-DANYPS5_LIBRESSL_ORACLE=ON): 3000 randomPKCS5_PBKDF2_HMACcases against LibreSSL 2.5.4, 0 differ. The test still fails on 6AES_set_*_keycases, which fail the same way onmain.guest_libressl_oracle(above) and 11 socket tests that need IPv6, which the container does not have.tools/check_conventions.py --base origin/main,tools/check_test_registration.pyandcore/libs/tests/test_public_headers.pypass.tools/pr_overlap.py --branch claude/epic-tesla-2yue6yfinds no open PR with the same exports; it reports textual overlap indocs/dev/debt/libSceLibreSsl3.md,core/libs/prx/libSceLibreSsl3/CMakeLists.txt,include/Api.hpp,AdditionalExports.cppandcore/libs/prx/libSceLibreSsl/tests/Oracle.cppwith feat(libSceLibreSsl3): implement X509 public key parameters #10557, feat(libSceLibreSsl3): implement EVP digest contexts and SHA methods #10960, feat(libSceLibreSsl3): implement numeric object identifier text parsing #12315, feat(libSceLibreSsl3): implement BIO_up_ref #12945, feat(libSceLibreSsl): implement d2i_X509 and X509_free #13266, feat(libSceLibreSsl): implement X509_STORE_add_cert #13285, feat(libSceLibreSsl): implement i2d_X509_PUBKEY #13546, feat(libSceLibreSsl): implement X509_INFO_free #13547, feat(libSceLibreSsl): implement X509_get_ext_d2i #13877, feat(libSceLibreSsl3): implement RSA_get0_factors and RSA_get0_crt_params #14366, feat(libSceLibreSsl3): implement ASN.1 value mutation and octet lifetime #14889, feat(libSceLibreSsl3): implement custom BIO methods and field accessors #14890, feat(libSceLibreSsl3): implement RSA component ownership setters #14992, feat(libSceLibreSsl3): implement key size, security and comparison queries #15031, feat(libSceLibreSsl3): implement TLS protocol list parsing #15045, feat(libSceLibreSsl3): implement session time and version accessors #15119, feat(libSceLibreSsl3): implement libtls context and config lifecycle #15289, feat(libSceLibreSsl3): implement four libtls CA and verification settings #15303, feat(libSceLibreSsl3): implement ECDSA_SIG_get0 #15449, feat(libSceLibreSsl3): implement HKDF #15472, feat(libSceLibreSsl3): implement HMAC_CTX_new and HMAC_CTX_free #15514, feat(libSceLibreSsl3): implement X509_STORE_CTX_new, free, get0_param and X509_STORE_up_ref #15544, feat(libSceLibreSsl3): return from four calls as firmware 13.42 does #15591, feat(libSceLibreSsl3): release BIO references through BIO_vfree #15599. It also lists shared helper names (Allocate,Release,Align,Realign,Reallocate,PosixAlign, not PKCS5) with feat(ngs2): add experimental I3DL2 reverb #1384 and feat(libSceJxr): implement the PKFactory and PKCodecFactory constructors #15232. It could not compare feat(libSceLibreSsl3): implement ASN1_OBJECT_free #10461, feat(libSceLibreSsl3): implement OBJ_cmp #10631, feat(libSceLibreSsl): implement EC_KEY_get0_private_key and EC_KEY_set_private_key #11146, feat(libSceLibreSsl3): implement the SSL_CTX, SSL, SSL_SESSION and X509 retains, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version #12754, feat(libSceLibreSsl): implement file and socket BIO adapters #12928, docs(debt): separate entries with blank lines and drop derived export totals #14212, feat(libSceLibreSsl3): implement SSL_CIPHER_get_id #14483, feat(libSceLibreSsl3): implement EVP_PKEY_get0_EC_KEY #14499 and feat(libSceLibreSsl3): implement AES_unwrap_key #14612 because they conflict withmain; none of their diffs mentionPKCS5_PBKDF2_HMACorvnwZHU5FvBQ. Run with--repo boykopovar/AnyPS5againstmainat04a9eb4fa2, into which the branch still merges cleanly.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)