Re: com php-src: Fix bug #55259 (openssl extension does not get the DH parameters from DH key resource): ext/openssl/openssl.c
ext/openssl/tests/bug55259.phpt

From: Date: Tue, 14 Jun 2016 09:30:42 +0000
Subject: Re: com php-src: Fix bug #55259 (openssl extension does not get the DH parameters from DH key resource): ext/openssl/openssl.c
ext/openssl/tests/bug55259.phpt
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92380@lists.php.net to get a copy of this message
Hi Matteo, I have got few ideas why it might have failed but will need to recreate it first. I will try to take a look but might need to prioritise some other things to get some extra features / bigger fixes to 7.1 before beta but then should have definitely time to take a look. Cheers Jakub On Tue, Jun 14, 2016 at 9:56 AM, Matteo Beccati <php@beccati.com> wrote: > Hi Jakub, > > I just wanted to report that sometimes this test is failing. Rarely > even, I would say, but I'm fairly sure it's not the first time I've seen > it fail: > > > > https://revive.beccati.com/bamboo/browse/PHP-SRC-TESTS-828/test/case/26350125 > > Thoughts? > > > Cheers > > On 25/08/2015 21:26, Jakub Zelenka wrote: > > Commit: c39336d1d866866de629695fbd9971fb48f27ea9 > > Author: Jakub Zelenka <bukka@php.net> Tue, 25 Aug 2015 > 20:26:11 +0100 > > Parents: e5adf2b427915ff070ddcba24d7c4ed3014743e9 > > Branches: PHP-5.6 > > > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=c39336d1d866866de629695fbd9971fb48f27ea9 > > > > Log: > > Fix bug #55259 (openssl extension does not get the DH parameters from DH > key resource) > > > > Bugs: > > https://bugs.php.net/55259 > > > > Changed paths: > > M ext/openssl/openssl.c > > A ext/openssl/tests/bug55259.phpt > > > > > > Diff: > > diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c > > index ef51622..0421524 100644 > > --- a/ext/openssl/openssl.c > > +++ b/ext/openssl/openssl.c > > @@ -3597,13 +3597,10 @@ PHP_FUNCTION(openssl_pkey_new) > > > OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, g); > > > OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, priv_key); > > > OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, pub_key); > > - if (dh->p && dh->g) { > > - if (!dh->pub_key) { > > - > DH_generate_key(dh); > > - } > > - if > (EVP_PKEY_assign_DH(pkey, dh)) { > > - > RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); > > - } > > + if (dh->p && dh->g && > > + (dh->pub_key || > DH_generate_key(dh)) && > > + > EVP_PKEY_assign_DH(pkey, dh)) { > > + > RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); > > } > > DH_free(dh); > > } > > diff --git a/ext/openssl/tests/bug55259.phpt > b/ext/openssl/tests/bug55259.phpt > > new file mode 100644 > > index 0000000..27ededd > > --- /dev/null > > +++ b/ext/openssl/tests/bug55259.phpt > > @@ -0,0 +1,29 @@ > > +--TEST-- > > +Bug #55259 (openssl extension does not get the DH parameters from DH > key resource) > > +--SKIPIF-- > > +<?php if (!extension_loaded("openssl")) die("skip"); ?> > > +--FILE-- > > +<?php > > + > > +$phex = > 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' . > > + > 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' . > > + > '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' . > > + > '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'; > > +$dh_details = array( 'p' => $phex, 'g' => '2' ); > > +$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, > > 'g' => '2' > ))); > > +var_dump($dh); > > +$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => > > hex2bin($phex), 'g' > => '2' ))); > > +$details = openssl_pkey_get_details($dh); > > +var_dump(bin2hex($details['dh']['p'])); > > +var_dump($details['dh']['g']); > > +var_dump(strlen($details['dh']['pub_key'])); > > +var_dump(strlen($details['dh']['priv_key'])); > > +echo "Done"; > > +?> > > +--EXPECT-- > > +bool(false) > > +string(256) > > "dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab" > > +string(1) "2" > > +int(128) > > +int(128) > > +Done > > > > > > > -- > Matteo Beccati > > Development & Consulting - http://www.beccati.com/ >

« previous php.cvs (#92380) next »