Edit report at https://bugs.php.net/bug.php?id=60632&edit=1
ID: 60632 Comment by: brett at silcon dot com Reported by: brett at silcon dot com Summary: openssl_seal fails with AES Status: Open Type: Bug Package: OpenSSL related Operating System: Ubuntu 10.04 LTS PHP Version: 5.4.0RC4 Block user comment: N Private report: N New Comment: The issue remains in the current PHP 5.4 release. PHP 5.4.0-ZS5.6.0 (cli) (built: Feb 19 2012 10:30:28) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies - with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled] - with Zend Download Server v1.5.0, Copyright (c) 1998-2010 Zend Technologies Ltd., by Zend Technologies [loaded] [licensed] [disabled] - with Zend Job Queue v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [not licensed] [disabled] - with Zend Session Clustering v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled] - with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled] - with Zend Code Tracing v1.0, Copyright (c) 2009-2010, by Zend Technologies [loaded] [not licensed] [disabled] - with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Page Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled] [14.08.2012 14:00:27 ERROR] [ ZendExtensionManager.cpp : 657 ( sig_handler ) ] ZendExtensionManager got SIG 11 at pid 32160 ! [14.08.2012 14:00:27 ERROR] [ ZendExtensionManager.cpp : 670 ( sig_handler ) ] Crash happened during IDLE stage [14.08.2012 14:00:27 ERROR] [ ZendExtensionManager.cpp : 673 ( sig_handler ) ] The stack trace follows: [14.08.2012 14:00:27 SYSTEM] Obtained 18 stack frames [14.08.2012 14:00:27 SYSTEM] /usr/local/zend/lib/ZendExtensionManager.so(+0x2b439) [0x7f9bbf15f439] [14.08.2012 14:00:27 SYSTEM] /usr/local/zend/lib/ZendExtensionManager.so(+0x17ce4) [0x7f9bbf14bce4] [14.08.2012 14:00:27 SYSTEM] /lib/x86_64-linux-gnu/libc.so.6(+0x364c0) [0x7f9bbfaf64c0] [14.08.2012 14:00:27 SYSTEM] /lib/x86_64-linux-gnu/libc.so.6(+0x8b560) [0x7f9bbfb4b560] [14.08.2012 14:00:27 SYSTEM] php(SHA1_Update+0x13e) [0x79620e] [14.08.2012 14:00:27 SYSTEM] php() [0x7bedf7] [14.08.2012 14:00:27 SYSTEM] php() [0x7be766] [14.08.2012 14:00:27 SYSTEM] php(EVP_SealInit+0x14f) [0x76672f] [14.08.2012 14:00:27 SYSTEM] php() [0x499c33] [14.08.2012 14:00:27 SYSTEM] php() [0x6af2e5] [14.08.2012 14:00:27 SYSTEM] php(execute+0x1ce) [0x6b527e] [14.08.2012 14:00:27 SYSTEM] /usr/local/zend/lib/debugger/php-5.4.x/ZendDebugger.so(+0xed85) [0x7f9bb1868d85] [14.08.2012 14:00:27 SYSTEM] php(zend_execute_scripts+0x159) [0x681649] [14.08.2012 14:00:27 SYSTEM] php(php_execute_script+0x1b8) [0x624718] [14.08.2012 14:00:27 SYSTEM] php() [0x728370] [14.08.2012 14:00:27 SYSTEM] php() [0x728921] [14.08.2012 14:00:27 SYSTEM] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f9bbfae176d] [14.08.2012 14:00:27 SYSTEM] php() [0x462cea] Segmentation fault (core dumped) Previous Comments: ------------------------------------------------------------------------ [2011-12-31 20:15:24] brett at silcon dot com 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 this bug report at https://bugs.php.net/bug.php?id=60632&edit=1