Repository navigation
Conversation
339cde2 to
489417a
Compare
489417a to
9a09a71
Compare
bukka
left a comment
There was a problem hiding this comment.
I check this one and GCM-SIV cannot actually use variable length IV so it's always 12 bytes which means that it could result in OOB read so this will need to be addressed and fixed len IV used for GCM-SIV
Extends the AEAD switch in php_openssl_load_cipher_mode() to also recognize EVP_CIPH_GCM_SIV_MODE alongside the SIV/OCB cases added by phpGH-20853. GCM-SIV (OpenSSL >= 3.2) uses the standard EVP_CTRL_AEAD_*_TAG controls and takes a single AAD input, so aad_supports_vector stays false. LibreSSL does not define EVP_CIPH_GCM_SIV_MODE, hence the #ifdef guard. GCM-SIV only takes a 96-bit nonce, but OpenSSL accepts any EVP_CTRL_AEAD_SET_IVLEN for it and reads 12 bytes from the IV buffer, so a shorter IV was an out-of-bounds read. php_openssl_validate_iv() now rejects any GCM-SIV IV that is not exactly 12 bytes instead of taking the variable-length AEAD path. Tests use RFC 8452 Appendix C.2 vectors and cover the tag, tampering and IV length failure paths.
9a09a71 to
88a741d
Compare
Thanks, confirmed. Released OpenSSL versions (checked up to 3.5.7 / 3.6.2) accept any
|
Follow-up to #20853 (now merged). Adds the missing GCM-SIV piece so the full set of AES SIV-family ciphers exposed by OpenSSL providers is treated as AEAD by
openssl_encrypt()/openssl_decrypt().cc @bukka @jordikroon — per Bukka's note on the previous (closed) PR, this is rebased on master and only contains the GCM-SIV delta.