cvs: php-src /ext/openssl openssl.c /ext/openssl/tests 005.phpt bug38261.phpt

From: Date: Fri, 19 Jan 2007 19:23:20 +0000
Subject: cvs: php-src /ext/openssl openssl.c /ext/openssl/tests 005.phpt bug38261.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42816@lists.php.net to get a copy of this message
rrichards Fri Jan 19 19:23:20 2007 UTC Added files: /php-src/ext/openssl/tests 005.phpt Modified files: /php-src/ext/openssl openssl.c /php-src/ext/openssl/tests bug38261.phpt Log: fix accessing public key from x509 resource add test fix test under win32 http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.132&r2=1.133&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.132 php-src/ext/openssl/openssl.c:1.133 --- php-src/ext/openssl/openssl.c:1.132 Mon Jan 1 09:29:26 2007 +++ php-src/ext/openssl/openssl.c Fri Jan 19 19:23:20 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.132 2007/01/01 09:29:26 sebastian Exp $ */ +/* $Id: openssl.c,v 1.133 2007/01/19 19:23:20 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1945,11 +1945,10 @@ /* got the key - return it */ return (EVP_PKEY*)what; } + } else { + /* other types could be used here - eg: file pointers and read in the data from them */ + TMP_CLEAN; } - - /* other types could be used here - eg: file pointers and read in the data from them */ - - TMP_CLEAN; } else { /* force it to be a string and check if it refers to a file */ /* passing non string values leaks, object uses toString, it returns NULL http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug38261.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/openssl/tests/bug38261.phpt diff -u php-src/ext/openssl/tests/bug38261.phpt:1.2 php-src/ext/openssl/tests/bug38261.phpt:1.3 --- php-src/ext/openssl/tests/bug38261.phpt:1.2 Sun Jul 30 16:27:02 2006 +++ php-src/ext/openssl/tests/bug38261.phpt Fri Jan 19 19:23:20 2007 @@ -27,8 +27,8 @@ bool(false) bool(false) -Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %s/bug38261.php on line %d +Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d NULL bool(false) -Catchable fatal error: Object of class stdClass could not be converted to string in %s/bug38261.php on line %d +Catchable fatal error: Object of class stdClass could not be converted to string in %sbug38261.php on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/005.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/005.phpt +++ php-src/ext/openssl/tests/005.phpt --TEST-- openSSL: read public key from x.509 resource --SKIPIF-- <?php if (!extension_loaded("openssl")) die("skip"); ?> --FILE-- <?php $dir = dirname(__FILE__); $file_pub = $dir . '/bug37820cert.pem'; $file_key = $dir . '/bug37820key.pem'; $priv_key = file_get_contents($file_key); $priv_key_id = openssl_get_privatekey($priv_key); $x509 = openssl_x509_read(file_get_contents($file_pub)); $pub_key_id = openssl_get_publickey($x509); $data = "some custom data"; if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) { echo "openssl_sign failed."; } $ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5); if ($ok == 1) { echo "Ok"; } elseif ($ok == 0) { echo "openssl_verify failed."; } ?> --EXPECTF-- Ok

« previous php.cvs (#42816) next »