From: Operating system: Ubuntu 10.04 LTS PHP version: 5.4.0RC4 Package: OpenSSL related Bug Type: Bug Bug description:openssl_seal fails with AES
Description: ------------ The following test script segfaults in both PHP 5.3.8 and PHP 5.4.0RC4 even though OpenSSL is supposed to support AES in PHP 5.4.0. In the attached script running with method 'aes256' or 'AES-256-CFB' both segfault. PHP 5.4.0 just prints a segfault, but in my PHP 5.3.8 from Zend Server, it prints a full printout first. I don't know if this is an expected wontfix or if its a genuinely overlooked item. Test script: --------------- <?php $pkey = openssl_pkey_new(array( 'digest_alg' => 'sha256', 'x509_extensions' => 'v3_ca', 'private_key_bits' => 4096, 'private_key_type' => OPENSSL_KEYTYPE_RSA, 'encrypt_key' => false )); $details = openssl_pkey_get_details($pkey); $Tpubkey = $details['key']; $pubkey = openssl_pkey_get_public($Tpubkey); $encrypted = null; $ekeys = array(); $result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'aes256'); //$result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'AES-256-CFB'); Expected result: ---------------- I would expect encrypted text placed in $encrypted and AES encrypted session keys placed in $ekeys. Actual result: -------------- PHP 5.4.0 blt@php54:~$ php-5.4.0RC4/sapi/cli/php phpsealtest.php Segmentation fault PHP 5.3.8 blt@aurora:~$ /usr/local/zend/bin/php phpsealtest.php [31.12.2011 14:14:29 ERROR] [ ZendExtensionManager.cpp : 661 ( sig_handler ) ] ZendExtensionManager got SIG 11 at pid 1583 ! [31.12.2011 14:14:29 ERROR] [ ZendExtensionManager.cpp : 674 ( sig_handler ) ] Crash happened during IDLE stage [31.12.2011 14:14:29 ERROR] [ ZendExtensionManager.cpp : 677 ( sig_handler ) ] The stack trace follows: [31.12.2011 14:14:29 SYSTEM] Obtained 17 stack frames [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/lib/ZendExtensionManager.so(+0x28df5) [0x7f62e378fdf5] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/lib/ZendExtensionManager.so(+0x1724a) [0x7f62e377e24a] [31.12.2011 14:14:29 SYSTEM] /lib/libc.so.6(+0x33af0) [0x7f62e3c81af0] [31.12.2011 14:14:29 SYSTEM] /lib/libc.so.6(memcpy+0x1e) [0x7f62e3cd4cae] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php(SHA1_Update+0x13e) [0x75ca2e] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x7833f7] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x782d66] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php(EVP_SealInit+0x14f) [0x72cc0f] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x498893] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x692c93] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php(execute+0x1d3) [0x692293] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/lib/debugger/php- 5.3.x/ZendDebugger.so(+0xed9b) [0x7f62d866fd9b] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php(zend_execute_scripts+0x159) [0x66bae9] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php(php_execute_script+0x1b8) [0x619968] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x6f5b94] [31.12.2011 14:14:29 SYSTEM] /lib/libc.so.6(__libc_start_main+0xfd) [0x7f62e3c6cc4d] [31.12.2011 14:14:29 SYSTEM] /usr/local/zend/bin/php() [0x4614aa] Segmentation fault -- Edit bug report at https://bugs.php.net/bug.php?id=60632&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60632&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60632&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60632&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60632&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60632&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60632&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60632&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60632&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60632&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60632&r=support Expected behavior: https://bugs.php.net/fix.php?id=60632&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60632&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60632&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60632&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60632&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60632&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60632&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60632&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60632&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60632&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60632&r=mysqlcfg