Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Alexey Shein
21 марта 2012 г. 3:34 пользователь Sergey Ryazanov
ryazanov@gmail.com написал:
 Hello all.

 Openssl starting from version 0.9.8 supports the ECDSA signature
 algorithm. Return value of the openssl_get_md_methods() also includes
 ecdsa-with-SHA1 string. But if I call openssl_sign() with EC key
 then I have an error: key type not supported in this PHP build!.

 After some time of digging I discover that this error is rises in the
 php_openssl_is_private_key() in the openssl.c file. This function
 simply don't includes check for EVP_PKEY_EC. All signature related
 actions are performed by OpenSSL library by self and don't depend on
 any internal code.

 Is any chance that EVP_PKEY_EC check would be added in the next
 release? Could I do something to speed up ECDSA adding process?


Hello, Sergey,

Best you can do is to open a bug with your question in bugtracker and
send a patch fixing your problem (with test case attached) against php
5.4 branch. Now it's even easier since php-src has finally moved to
git, so you can use github's pull requests mechanism, see
https://wiki.php.net/vcs/gitworkflow#workflow_for_external_contributors
for the workflow and https://wiki.php.net/vcs/gitfaq for general
questions.

Thank you.
 --
 With best wishes
 Sergey Ryazanov

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Regards,
Shein Alexey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4

2012-03-21 Thread Dmitry Stogov

Hi Eric,

Sorry, I don't read @internals every day. Please CC me if you need quick 
answer.


Really I don't see the reason why wincache stores the PHP file source. 
Storing compiled opcodes must be enough. To avoid re-reading of already 
cached file. opcode cache should override zend_stream_open() and return 
stream of type ZEND_HANDLE_FILENAME.


Anyway, I don't see a way to fix PHP to support custom streams without 
BC break, because zend_streams doesn't provide handlers for seeking.


The best solution would be handling shebang lines by parser/scanner. It 
even was done few years ago, but than was reverted.


Thanks. Dmitry.


On 03/15/2012 10:56 PM, Eric Stenson wrote:

PHP Internals folks--

My name is Eric Stenson, and I'm a developer at Microsoft working on IIS.
I've been given the task of upgrading our php_wincache extension to work
on PHP5.4, and I've run into a problem.

The problem I'm running into is the php_cgi!main() on PHP5.4 has changed
behavior.  The php_cgi!main() function is seeing us return a ZEND_HANDLE_STREAM,
and it's assuming that the zend_file_handle.handle.stream.handle (void *)
is a (php_stream*), when in fact it's php_wincache's (fcache_handle *).
It then attempts to access the php_stream.ops (a v-table-ish struct), which
is not in the fcache_handle, and it jumps off into an invalid address and
promptly AV's.

I'm trying to understand why our php_wincache!fcache_useval() thinks it's
okay to set zend_file_handle.handle.stream.handle to (fcache_handle *).
I'm having trouble understanding what the responsibilities are of a PHP
extension that extends the file system as php_wincache does.  Could you
point me at any developer documents for PHP extension developers that explains
what php_wincache *should* be doing?

I'm very much a novice at PHP code, or writing a PHP extension, so I feel
like I'm flailing around without understanding what PHP extensions are
supposed to do.  Any pointers, guidance, and architecture advice would be
massively helpful!

Thank you!
   --E.




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Sergey Ryazanov
21 марта 2012 г. 10:27 пользователь Alexey Shein con...@gmail.com написал:
 21 марта 2012 г. 3:34 пользователь Sergey Ryazanov
 ryazanov@gmail.com написал:
 Hello all.

 Openssl starting from version 0.9.8 supports the ECDSA signature
 algorithm. Return value of the openssl_get_md_methods() also includes
 ecdsa-with-SHA1 string. But if I call openssl_sign() with EC key
 then I have an error: key type not supported in this PHP build!.

 After some time of digging I discover that this error is rises in the
 php_openssl_is_private_key() in the openssl.c file. This function
 simply don't includes check for EVP_PKEY_EC. All signature related
 actions are performed by OpenSSL library by self and don't depend on
 any internal code.

 Is any chance that EVP_PKEY_EC check would be added in the next
 release? Could I do something to speed up ECDSA adding process?


 Hello, Sergey,

 Best you can do is to open a bug with your question in bugtracker and
 send a patch fixing your problem (with test case attached) against php
 5.4 branch. Now it's even easier since php-src has finally moved to
 git, so you can use github's pull requests mechanism, see
 https://wiki.php.net/vcs/gitworkflow#workflow_for_external_contributors
 for the workflow and https://wiki.php.net/vcs/gitfaq for general
 questions.


Thank you for advice. I do so in couple of days.

Btw is 5.3 branch in development state or only maintenance? If new
feature could be added to the 5.3 branch. I preferred upgrade from
5.3.10 to 5.3.11 instead of 5.3.10 - 5.4.

-- 
With best wishes
Sergey Ryazanov

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] readline extension bug fixes and enhancements

2012-03-21 Thread Osama Abu Elsorour
Hello

On Mar 20, 2012, at 9:43 PM, Johannes Schlüter wrote:

 
 Have you read Nikita's and my comments on your mail from last week?
 

I just did. There was a problem with my mailing list subscription (wasn't 
confirmed) so I thought it didn't go through. But the good thing is that I had 
ported it to 5.4 and found the memory corruption bug.

Here are my answers to your comments:

On Mar 14, 2012, at 10:28 PM, Johannes Schlüter wrote:

 A) for licensing reasons we should try to keep as few readline only things as 
 possible in there (gpl vs. php license)

I understand the issue of licensing but the extension already has 
readline-specific functionality so I thought why not. However if this is going 
to be a problem then I can take out all readline-sepcific functions into a 
separate module altogether and keep this one for editline functions only.

 B) thread safty isn't an issue for readline but you still should do the init 
 and deinit in rinit/rshutdown not minit/mshutdown, probably also do only 
 bind_key_functions =NULL in rinit and init the hashtable on demand later.

Roger that.

 C) don't compare the r result of  zend_hash_find and others against -1 or 
 such but use SUCCESS/FAILURE

Roger that.

 D) i don't really like new features in 5.3 anymore at this stage

This last patch is ported to 5.4.

 E) please log a bug and attach the patch so we can track this

Roger that. After I clear out which direction to take based on your answers.

And as for Nikita's comments:

On Mar 14, 2012, at 10:47 PM, Nikita Popov wrote:

 May I ask where you got this pattern for copying zvals from? Is this
 kind of code shown in some tutorial / manual / etc? Such code is used
 all other the place, instead of the MAKE_COPY_ZVAL macro and I wonder
 why. Doing manual copying has a good chance of leaking memory. Just
 from glancing I'd say that your code will leak if arg has a refcount 
 1 (but I could be wrong) as it does not PINIT the zval after it was
 copied.

Two points here:
A) The new patch does not use this at all because it really isn't needed
B) I got this from the same readline.c file lines 521 and 574 and 579. But I 
will change it accordingly


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4

2012-03-21 Thread Gustavo Lopes

On Wed, 21 Mar 2012 07:46:31 +0100, Dmitry Stogov dmi...@zend.com wrote:

Anyway, I don't see a way to fix PHP to support custom streams without  
BC break, because zend_streams doesn't provide handlers for seeking.




Couldn't you at least check whether e.g. the closer function pointer is  
php_zend_stream_closer and only then assume it wraps a php_stream? If it  
was not, you'd have to abandon shebang detection, but I think that's a  
minor problem.


--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] TSRMLS_* keywords in PHP source

2012-03-21 Thread Yannick Komotir
Hi,

You can find some additional information in this blog post
http://blog.golemon.com/2006/06/what-heck-is-tsrmlscc-anyway.html

Regards,

2012/3/19 Barbu Paul Gheorghe paullik.p...@gmail.com

 Hello!

 What role does the keywords TSRMLS_CC, TSRMLS_DC, TSRMLS_D have when
 passed along with a argument in PHP's source?
 For example in this random file:

 http://lxr.php.net/opengrok/**xref/PHP_5_4/ext/intl/**
 formatter/formatter_data.chttp://lxr.php.net/opengrok/xref/PHP_5_4/ext/intl/formatter/formatter_data.c


 I don't even know if keyword is the right technical term for it because
 it's the first time I see this kind of call in C:

 foo(data_type variable_name keyword);

 --
 Barbu Paul - Gheorghe
 Common sense is not so common - Voltaire
 Visit My GitHub profile to see my open-source projects -
 https://github.com/paullik

-- 
Yannick

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: com php-src: Fixed bug #61461 (missing checks around malloc() calls).: NEWS sapi/cli/php_cli_server.c

2012-03-21 Thread David Soria Parra
On 2012-03-21, Ilia Alshanetsky il...@php.net wrote:
 Commit:9dcfb8c73fd639485182497ae5a8fc7d7ca7eb11
 Author:Ilia Alshanetsky ili...@php.net Tue, 20 Mar 2012 
 21:07:08 -0400
 Parents:   f3f76e5e8af265cd59d8edb7fb0827be6abc9a5a
 Branches:  PHP-5.4

Please merge this into master in the future. I did the merge for now.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Alexey Shein
21 марта 2012 г. 12:43 пользователь Sergey Ryazanov
ryazanov@gmail.com написал:
 21 марта 2012 г. 10:27 пользователь Alexey Shein con...@gmail.com написал:
 21 марта 2012 г. 3:34 пользователь Sergey Ryazanov
 ryazanov@gmail.com написал:
 Hello all.

 Openssl starting from version 0.9.8 supports the ECDSA signature
 algorithm. Return value of the openssl_get_md_methods() also includes
 ecdsa-with-SHA1 string. But if I call openssl_sign() with EC key
 then I have an error: key type not supported in this PHP build!.

 After some time of digging I discover that this error is rises in the
 php_openssl_is_private_key() in the openssl.c file. This function
 simply don't includes check for EVP_PKEY_EC. All signature related
 actions are performed by OpenSSL library by self and don't depend on
 any internal code.

 Is any chance that EVP_PKEY_EC check would be added in the next
 release? Could I do something to speed up ECDSA adding process?


 Hello, Sergey,

 Best you can do is to open a bug with your question in bugtracker and
 send a patch fixing your problem (with test case attached) against php
 5.4 branch. Now it's even easier since php-src has finally moved to
 git, so you can use github's pull requests mechanism, see
 https://wiki.php.net/vcs/gitworkflow#workflow_for_external_contributors
 for the workflow and https://wiki.php.net/vcs/gitfaq for general
 questions.


 Thank you for advice. I do so in couple of days.

 Btw is 5.3 branch in development state or only maintenance? If new
 feature could be added to the 5.3 branch. I preferred upgrade from
 5.3.10 to 5.3.11 instead of 5.3.10 - 5.4.


Can't say for sure, it's better ask maintainers, I've CC'ed David and Johannes.


 --
 With best wishes
 Sergey Ryazanov



-- 
Regards,
Shein Alexey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Antony Dovgal

On 03/21/2012 02:34 AM, Sergey Ryazanov wrote:

After some time of digging I discover that this error is rises in the
php_openssl_is_private_key() in the openssl.c file. This function
simply don't includes check for EVP_PKEY_EC. All signature related
actions are performed by OpenSSL library by self and don't depend on
any internal code.

Is any chance that EVP_PKEY_EC check would be added in the next
release? Could I do something to speed up ECDSA adding process?


Yes!
You can always provide a patch and attach it to the bug report =)

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread David Soria Parra
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/21/2012 02:44 PM, Alexey Shein wrote:
 21 марта 2012 г. 12:43 пользователь Sergey Ryazanov 
 ryazanov@gmail.com написал:
 21 марта 2012 г. 10:27 пользователь Alexey Shein
 con...@gmail.com написал:
 21 марта 2012 г. 3:34 пользователь Sergey Ryazanov 
 ryazanov@gmail.com написал:
 Hello all.
 
 Openssl starting from version 0.9.8 supports the ECDSA
 signature algorithm. Return value of the
 openssl_get_md_methods() also includes ecdsa-with-SHA1
 string. But if I call openssl_sign() with EC key then I have
 an error: key type not supported in this PHP build!.
 
 After some time of digging I discover that this error is
 rises in the php_openssl_is_private_key() in the openssl.c
 file. This function simply don't includes check for
 EVP_PKEY_EC. All signature related actions are performed by
 OpenSSL library by self and don't depend on any internal
 code.
 
 Is any chance that EVP_PKEY_EC check would be added in the
 next release? Could I do something to speed up ECDSA adding
 process?
 
 
 Hello, Sergey,
 
 Best you can do is to open a bug with your question in
 bugtracker and send a patch fixing your problem (with test case
 attached) against php 5.4 branch. Now it's even easier since
 php-src has finally moved to git, so you can use github's pull
 requests mechanism, see 
 https://wiki.php.net/vcs/gitworkflow#workflow_for_external_contributors

 
for the workflow and https://wiki.php.net/vcs/gitfaq for general
 questions.
 
 
 Thank you for advice. I do so in couple of days.
 
 Btw is 5.3 branch in development state or only maintenance? If
 new feature could be added to the 5.3 branch. I preferred upgrade
 from 5.3.10 to 5.3.11 instead of 5.3.10 - 5.4.
 
 
 Can't say for sure, it's better ask maintainers, I've CC'ed David
 and Johannes.

as long as it doesnt break any  BC and only adds one constant I am
fine with having it in 5.4.2.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPaedHAAoJEAT0aMuPE7Z1q3kP/0HbNS7cguw4AZW/B1iY3VJf
/zHKomY12J5BFEQRHLxNzU2yTne40qyiLYlKB+VjBjXBXhgNKHUpUJKeR+kPjg6t
SsqTDxsqYvmWVnb1TC073DmI4/+xKcTYCuNME85PgAvUmnhlw/Yhxc8XsNvOU5gb
dmLTbh+vB5gQJu4aD67fQQWhPwrw29+riccYeZvPgAJ0AJKzl/e5RIC3WwqxRMbx
kLVMkUY0237kTjq+DRc6/p/WKNGsfx67xyIOsaeBUObsQlFynGcC+89vuf2Og7QL
qHMUIk4zf6UUEXNLDr4yp8n2E9cH65cgoxR1L9c2Nmz9Rwt/VxhJO94/fLHqmGBn
kUA/JUnpKOWT+UozeVSj8PJNSTLkmkhRrilqD8vNLjDn2V7DECHUA6QpXN29Vzl4
UW4tUATBsSFnrn41nnVUQ3NV7vWacL0N0sxNcWbmkidIRdj8pp2sKLOhD0Ez9Ot/
WoaTNwGbij5CxWVpYCF2zXiw5Xkfl8MQeMwANMTlBeJZoMm3XYrx4zI93X5ld2Z+
meubAegmwxqwSMz6lflt1OKD8CC4wTJeuKrxzXecgkCX64pw3l7GQq/nKbFtrhoX
Er1M8VqBL8IHzm2TCYNtWsQv2MEIn0O/nXhBFh2gxiqmcYyopbqy3pJTwoVif5qB
eHsMSfDoDUxFkUgqKBJw
=GNQS
-END PGP SIGNATURE-

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Pierre Joye
hi!

On Tue, Mar 20, 2012 at 11:34 PM, Sergey Ryazanov
ryazanov@gmail.com wrote:

 Is any chance that EVP_PKEY_EC check would be added in the next
 release? Could I do something to speed up ECDSA adding process?

Sure thing! I won't have the time to do it soonish but if you can
provide a patch or a pull request (with test please :), then I can
review and apply it quickly.

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



Re: [PHP-DEV] ECDSA support in the openssl extension

2012-03-21 Thread Johannes Schlüter
On Wed, 2012-03-21 at 18:44 +0500, Alexey Shein wrote:
  Btw is 5.3 branch in development state or only maintenance? If new
  feature could be added to the 5.3 branch. I preferred upgrade from
  5.3.10 to 5.3.11 instead of 5.3.10 - 5.4.
 
 
 Can't say for sure, it's better ask maintainers, I've CC'ed David and
 Johannes.

Probably one could argue that this is a bug fix, no feature addition. In
general I aim for a quite strickt no new feature-rule though in order
to push people to 5.4.

Besides that: hard to say without patch.

johannes



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php