hi Sara, On Tue, May 18, 2010 at 3:53 AM, Sara Golemon <poll...@php.net> wrote: > I was just looking through the implementation of openssl_encrypt() (and > openssl_decrypt()) today because I need to make some encrypted payloads, but > the prototype didn't have anywhere to place an initialization vector. > > On opening ext/openssl/openssl.c, I noticed line 4620 which simply hardcodes > IV as a string of NULL bytes. > > This is a bad idea roughly equivalent to hashing passwords without salt; > Worse, it prevents interoperability at the application layer by preventing > the decryption of a data stream where the generator used an IV other than > all-null. > > Fixing this is a simple matter, but I wanted to bounce approaches for BC (or > lack thereof) off everyone else since this version of openssl_encrypt() is > already "in the wild".
> I think it's worth a BC break. Comments? To break BC is a no go, even if your arguments are appealing (even in a major version). I would suggest a new function: openssl_encrypt_iv($data, $method, $key, $iv, $raw=false); Which will use the same internal implementations internally but with a different entry point. please note that I moved iv to the 4th position as well. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php