Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-23 Thread Stanislav Malyshev
Hi! > Is the feedback then that we should expose /more/ of the OpenSSL API? Well, not exactly more of the API I think but ways to link bignums to others OpenSSL functions. Think about it this way: what people frequently use bignums for? Doing some kind of crypto-like stuff. But if you want to do

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-23 Thread Sara Golemon
On Sun, Oct 23, 2016 at 5:06 PM, Stanislav Malyshev wrote: >> What are the specific reasons for choosing OpenSSL Bignums over GMP, >> outside of extension availability (which is totally a path I don't want us >> to go down -- see also recent attempts to duplicate ext/mbstring into >> ext/standard)

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-23 Thread Stanislav Malyshev
Hi! > What are the specific reasons for choosing OpenSSL Bignums over GMP, > outside of extension availability (which is totally a path I don't want us > to go down -- see also recent attempts to duplicate ext/mbstring into > ext/standard)? Are there any particular properties of the openssl > impl

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-23 Thread Jakub Zelenka
On Tue, Oct 18, 2016 at 2:35 AM, Sara Golemon wrote: > As it says on the tin: Wrap the BN (BigNumber) library in OpenSSL. > > https://wiki.php.net/rfc/openssl.bignum > > I don't see any reason why we should expose BN API if it's not integrated with PKEY algorithms. This proposal doesn't really fi

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-19 Thread Nikita Popov
On Wed, Oct 19, 2016 at 1:48 AM, Daniel Morris wrote: > On Tue, 18 Oct 2016, at 09:22 AM, Nikita Popov wrote: > > On Tue, Oct 18, 2016 at 3:35 AM, Sara Golemon wrote: > > > > > As it says on the tin: Wrap the BN (BigNumber) library in OpenSSL. > > Why do we need GMP when we have BCMath? Becaus

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-18 Thread Daniel Morris
And sorry for the spam (this should have been mentioned in the last email), as far as I can tell, there is no-way to say "I want a either a signed or unsigned integer with an N bits", I've come across this recently whilst trying to implement Murmur3 (128-bit) in PHP, I can of-course binary AND int

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-18 Thread Daniel Morris
On Tue, 18 Oct 2016, at 09:22 AM, Nikita Popov wrote: > On Tue, Oct 18, 2016 at 3:35 AM, Sara Golemon wrote: > > > As it says on the tin: Wrap the BN (BigNumber) library in OpenSSL. Why do we need GMP when we have BCMath? GMP is faster (from what I've seen so far from various tests and blog post

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-18 Thread Nikita Popov
On Tue, Oct 18, 2016 at 3:35 AM, Sara Golemon wrote: > As it says on the tin: Wrap the BN (BigNumber) library in OpenSSL. > > https://wiki.php.net/rfc/openssl.bignum > Why do we need this when we already have GMP? If the only reason is "not all environments install GMP" then I'm -1 on this. Ni

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-17 Thread Sara Golemon
On Mon, Oct 17, 2016 at 11:41 PM, Sebastian Bergmann wrote: > Am 18.10.2016 um 08:23 schrieb Sara Golemon: >> I'm mostly curious about thoughts on API decisions. > > * public static function createFromBinary(string $number): BigNum; > * public static function createFromInteger(int $number): BigNum

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-17 Thread Sebastian Bergmann
Am 18.10.2016 um 08:23 schrieb Sara Golemon: > I'm mostly curious about thoughts on API decisions. Can we make the constructor non-public and instead only have named constructors? * public static function createFromBinary(string $number): BigNum; * public static function createFromInteger(int $nu

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-17 Thread Sara Golemon
> Looks ok to me. Would probably not hurt also add tests for various error > conditions. > There's one TypeError test in there, but I can easily add more. (And probably will on my flight tomorrow.) > I realise this is only exposing functionality already available with > OpenSSL but is it worth add

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-17 Thread Stanislav Malyshev
Hi! > As it says on the tin: Wrap the BN (BigNumber) library in OpenSSL. > > https://wiki.php.net/rfc/openssl.bignum Looks ok to me. Would probably not hurt also add tests for various error conditions. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing Li

Re: [PHP-DEV] [RFC] OpenSSL BigNum support

2016-10-17 Thread Daniel Morris
I realise this is only exposing functionality already available with OpenSSL but is it worth adding tests that cover some arbitrary precision arithmetic? The tests at the moment cover integers that PHP already handles natively without requiring either GMP or BCMath. There's usage of zend_parse_par