Re: [PHP-CVS] cvs: php-src /ext/openssl openssl.c

2009-07-07 Thread Jani Taskinen

I guess this does not happen in PHP_5_2..?

--Jani


Pierre-Alain Joye wrote:

pajoye  Mon Jul  6 23:36:56 2009 UTC

  Modified files:  
/php-src/ext/openssl	openssl.c 
  Log:

  - #48116, fix build with openssl 1.0
  
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.181&r2=1.182&diff_format=u

Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.181 php-src/ext/openssl/openssl.c:1.182
--- php-src/ext/openssl/openssl.c:1.181 Mon Apr 20 09:43:45 2009
+++ php-src/ext/openssl/openssl.c   Mon Jul  6 23:36:56 2009
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: openssl.c,v 1.181 2009/04/20 09:43:45 mkoppanen Exp $ */

+/* $Id: openssl.c,v 1.182 2009/07/06 23:36:56 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H

 #include "config.h"
@@ -484,8 +484,13 @@
 static char default_ssl_conf_filename[MAXPATHLEN];
 
 struct php_x509_request { /* {{{ */

-   LHASH * global_config;  /* Global SSL config */
-   LHASH * req_config; /* SSL config for this request */
+#if OPENSSL_VERSION_NUMBER >= 0x1002L
+   LHASH_OF(CONF_VALUE) * global_config;   /* Global SSL config */
+   LHASH_OF(CONF_VALUE) * req_config;  /* SSL config for this 
request */
+#else
+   LHASH * global_config;  /* Global SSL config */
+   LHASH * req_config; /* SSL config for this request */
+#endif
const EVP_MD * md_alg;
const EVP_MD * digest;
char* section_name,
@@ -674,7 +679,11 @@
 }
 /* }}} */
 
+#if OPENSSL_VERSION_NUMBER >= 0x1002L

+static inline int php_openssl_config_check_syntax(const char * section_label, 
const char * config_filename, const char * section, LHASH_OF(CONF_VALUE) * 
config TSRMLS_DC) /* {{{ */
+#else
 static inline int php_openssl_config_check_syntax(const char * section_label, 
const char * config_filename, const char * section, LHASH * config TSRMLS_DC) 
/* {{{ */
+#endif
 {
X509V3_CTX ctx;

@@ -1177,8 +1186,7 @@
if (in == NULL) {
return NULL;
}
-
-   cert = (X509 *) PEM_ASN1_read_bio((char *(*)())d2i_X509, 
PEM_STRING_X509, in, NULL, NULL, NULL);
+   cert = (X509 *) PEM_ASN1_read_bio((d2i_of_void *)d2i_X509, 
PEM_STRING_X509, in, NULL, NULL, NULL);
BIO_free(in);
}
if (cert && makeresource && resourceval) {
@@ -2931,8 +2939,7 @@
case EVP_PKEY_RSA:
case EVP_PKEY_RSA2:
assert(pkey->pkey.rsa != NULL);
-
-   if (NULL == pkey->pkey.rsa->p || NULL == 
pkey->pkey.rsa->q) {
+   if (pkey->pkey.rsa != NULL && (NULL == pkey->pkey.rsa->p || 
NULL == pkey->pkey.rsa->q)) {
return 0;
}
break;






--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/openssl openssl.c

2009-03-29 Thread Pierre Joye
hi Scott,

How did you reproduce the crash (ssl version, and with which input or
config)? Please add a test case.

Also please keep an eye on the "assign" field of a bug report, it is
here for good  reasons.

Cheers,

On Mon, Mar 30, 2009 at 1:32 AM, Scott MacVicar  wrote:
> scottmac                Sun Mar 29 23:32:17 2009 UTC
>
>  Modified files:
>    /php-src/ext/openssl        openssl.c
>  Log:
>  Fix bug #47828 - Converting to UTF-8 can sometimes fail, check error codes 
> and avoid segfault.
>
>
>
> http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.179&r2=1.180&diff_format=u
> Index: php-src/ext/openssl/openssl.c
> diff -u php-src/ext/openssl/openssl.c:1.179 
> php-src/ext/openssl/openssl.c:1.180
> --- php-src/ext/openssl/openssl.c:1.179 Tue Mar 10 23:39:27 2009
> +++ php-src/ext/openssl/openssl.c       Sun Mar 29 23:32:17 2009
> @@ -20,7 +20,7 @@
>    +--+
>  */
>
> -/* $Id: openssl.c,v 1.179 2009/03/10 23:39:27 helly Exp $ */
> +/* $Id: openssl.c,v 1.180 2009/03/29 23:32:17 scottmac Exp $ */
>
>  #ifdef HAVE_CONFIG_H
>  #include "config.h"
> @@ -557,10 +557,12 @@
>                                str = X509_NAME_ENTRY_get_data(ne);
>                                if (ASN1_STRING_type(str) != 
> V_ASN1_UTF8STRING) {
>                                        to_add_len = 
> ASN1_STRING_to_UTF8(&to_add, str);
> -                                       
> add_next_index_utf8_stringl(subentries, (char *)to_add, to_add_len, 1);
>                                } else {
>                                        to_add = ASN1_STRING_data(str);
>                                        to_add_len = ASN1_STRING_length(str);
> +                               }
> +
> +                               if (to_add_len != -1) {
>                                        
> add_next_index_utf8_stringl(subentries, (char *)to_add, to_add_len, 1);
>                                }
>                        }
> @@ -573,7 +575,7 @@
>                } else {
>                        zval_dtor(subentries);
>                        FREE_ZVAL(subentries);
> -                       if (obj_cnt && str) {
> +                       if (obj_cnt && str && to_add_len != -1) {
>                                add_ascii_assoc_utf8_stringl(subitem, sname, 
> (char *)to_add, to_add_len, 1);
>                        }
>                }
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/openssl openssl.c

2007-08-07 Thread Pierre
Hi Mattias,

Thanks for the patch (we came to the same conclusion yesterday :)

applied

On 8/8/07, Mattias Bengtsson <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Please see attached patch.
>
> Cheers, Mattias.
>
> On Wed, Aug 08, 2007 at 02:18:42AM +0400, Antony Dovgal wrote:
> > Two OpenSSL tests started to fail yesterday:
> >
> > # cat ext/openssl/tests/004.diff
> > 009+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed)
> > in /local/qa/5_2/ext/openssl/tests/004.php on line 7
> > 009- Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min ->
> > 4 (failed) in %s on line %d
> > 011+
> > 012+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed)
> > in /local/qa/5_2/ext/openssl/tests/004.php on line 12
> > 013+ bool(false)
> > 011- resource(%d) of type (OpenSSL X.509 CSR)
> >
> >
> >
> > # cat ext/openssl/tests/bug36732.diff
> > 001+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed)
> > in /local/qa/5_2/ext/openssl/tests/bug36732.php on line 16
> > 002+
> > 001- Ok
> > 002- Ok
> > 003+ Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in
> > /local/qa/5_2/ext/openssl/tests/bug36732.php on line 17
> > 004+
> > 005+ Warning: openssl_csr_export() expects parameter 1 to be resource,
> > boolean given in /local/qa/5_2/ext/openssl/tests/bug36732.php on line 20
> > 006+
> > 007+ Warning: openssl_x509_export(): cannot get cert from parameter 1 in
> > /local/qa/5_2/ext/openssl/tests/bug36732.php on line 25
> >
> >
> > On 06.08.2007 23:50, Pierre-Alain Joye wrote:
> > >pajoye   Mon Aug  6 19:50:16 2007 UTC
> > >
> > >  Modified files:
> > >/php-src/ext/openssl openssl.c
> > >  Log:
> > >  - MFB: #4, forgot this one (thanks mattias)
> > >
> > >http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.147&r2=1.148&diff_format=u
> > >Index: php-src/ext/openssl/openssl.c
> > >diff -u php-src/ext/openssl/openssl.c:1.147
> > >php-src/ext/openssl/openssl.c:1.148
> > >--- php-src/ext/openssl/openssl.c:1.147  Mon Aug  6 19:13:05 2007
> > >+++ php-src/ext/openssl/openssl.cMon Aug  6 19:50:16 2007
> > >@@ -20,7 +20,7 @@
> > >
> > > +--+
> > >  */
> > >
> > >-/* $Id: openssl.c,v 1.147 2007/08/06 19:13:05 pajoye Exp $ */
> > >+/* $Id: openssl.c,v 1.148 2007/08/06 19:50:16 pajoye Exp $ */
> > >
> > > #ifdef HAVE_CONFIG_H
> > > #include "config.h"
> > >@@ -1818,9 +1818,10 @@
> > > len = 200;
> > > }
> > > memcpy(buffer, type, len);
> > >-buffer[len] = '\0';
> > >+buffer[len - 1] = '\0';
> > >+
> > > type = buffer;
> > >-
> > >+
> > > /* Skip past any leading X. X: X, etc to allow for
> > > multiple
> > >  * instances */
> > > for (str = type; *str; str++) {
> > >
> >
> >
> > --
> > Wbr,
> > Antony Dovgal
> >
> > --
> > PHP CVS Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/openssl openssl.c

2007-08-07 Thread Mattias Bengtsson
Hi!

Please see attached patch.

Cheers, Mattias.

On Wed, Aug 08, 2007 at 02:18:42AM +0400, Antony Dovgal wrote:
> Two OpenSSL tests started to fail yesterday:
> 
> # cat ext/openssl/tests/004.diff
> 009+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) 
> in /local/qa/5_2/ext/openssl/tests/004.php on line 7
> 009- Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 
> 4 (failed) in %s on line %d
> 011+
> 012+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) 
> in /local/qa/5_2/ext/openssl/tests/004.php on line 12
> 013+ bool(false)
> 011- resource(%d) of type (OpenSSL X.509 CSR)
> 
> 
> 
> # cat ext/openssl/tests/bug36732.diff
> 001+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) 
> in /local/qa/5_2/ext/openssl/tests/bug36732.php on line 16
> 002+
> 001- Ok
> 002- Ok
> 003+ Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in 
> /local/qa/5_2/ext/openssl/tests/bug36732.php on line 17
> 004+
> 005+ Warning: openssl_csr_export() expects parameter 1 to be resource, 
> boolean given in /local/qa/5_2/ext/openssl/tests/bug36732.php on line 20
> 006+
> 007+ Warning: openssl_x509_export(): cannot get cert from parameter 1 in 
> /local/qa/5_2/ext/openssl/tests/bug36732.php on line 25
> 
> 
> On 06.08.2007 23:50, Pierre-Alain Joye wrote:
> >pajoye   Mon Aug  6 19:50:16 2007 UTC
> >
> >  Modified files:  
> >/php-src/ext/openssl openssl.c 
> >  Log:
> >  - MFB: #4, forgot this one (thanks mattias)
> >  
> >http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.147&r2=1.148&diff_format=u
> >Index: php-src/ext/openssl/openssl.c
> >diff -u php-src/ext/openssl/openssl.c:1.147 
> >php-src/ext/openssl/openssl.c:1.148
> >--- php-src/ext/openssl/openssl.c:1.147  Mon Aug  6 19:13:05 2007
> >+++ php-src/ext/openssl/openssl.cMon Aug  6 19:50:16 2007
> >@@ -20,7 +20,7 @@
> >+--+
> >  */
> > 
> >-/* $Id: openssl.c,v 1.147 2007/08/06 19:13:05 pajoye Exp $ */
> >+/* $Id: openssl.c,v 1.148 2007/08/06 19:50:16 pajoye Exp $ */
> > 
> > #ifdef HAVE_CONFIG_H
> > #include "config.h"
> >@@ -1818,9 +1818,10 @@
> > len = 200;
> > }
> > memcpy(buffer, type, len);
> >-buffer[len] = '\0';
> >+buffer[len - 1] = '\0';
> >+
> > type = buffer;
> >-
> >+
> > /* Skip past any leading X. X: X, etc to allow for 
> > multiple
> >  * instances */
> > for (str = type; *str; str++) {
> >
> 
> 
> -- 
> Wbr, 
> Antony Dovgal
> 
> -- 
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
Index: ext/openssl/openssl.c
===
RCS file: /repository/php-src/ext/openssl/openssl.c,v
retrieving revision 1.98.2.5.2.40
diff -u -a -r1.98.2.5.2.40 openssl.c
--- ext/openssl/openssl.c   6 Aug 2007 19:49:45 -   1.98.2.5.2.40
+++ ext/openssl/openssl.c   8 Aug 2007 06:19:40 -
@@ -1726,7 +1726,7 @@
/* Finally apply defaults from config file */
for(i = 0; i < sk_CONF_VALUE_num(dn_sk); i++) {
int len;
-   char buffer[200];
+   char buffer[200 + 1];

v = sk_CONF_VALUE_value(dn_sk, i);
type = v->name;
@@ -1743,7 +1743,7 @@
len = 200;
}
memcpy(buffer, type, len);
-   buffer[len - 1] = '\0';
+   buffer[len] = '\0';
type = buffer;

/* Skip past any leading X. X: X, etc to allow for 
multiple

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-CVS] cvs: php-src /ext/openssl openssl.c

2007-08-07 Thread Antony Dovgal

Two OpenSSL tests started to fail yesterday:

# cat ext/openssl/tests/004.diff
009+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) in 
/local/qa/5_2/ext/openssl/tests/004.php on line 7
009- Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 
(failed) in %s on line %d
011+
012+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) in 
/local/qa/5_2/ext/openssl/tests/004.php on line 12
013+ bool(false)
011- resource(%d) of type (OpenSSL X.509 CSR)



# cat ext/openssl/tests/bug36732.diff
001+ Warning: openssl_csr_new(): add_entry_by_txt countryNam -> AU (failed) in 
/local/qa/5_2/ext/openssl/tests/bug36732.php on line 16
002+
001- Ok
002- Ok
003+ Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in 
/local/qa/5_2/ext/openssl/tests/bug36732.php on line 17
004+
005+ Warning: openssl_csr_export() expects parameter 1 to be resource, boolean 
given in /local/qa/5_2/ext/openssl/tests/bug36732.php on line 20
006+
007+ Warning: openssl_x509_export(): cannot get cert from parameter 1 in 
/local/qa/5_2/ext/openssl/tests/bug36732.php on line 25


On 06.08.2007 23:50, Pierre-Alain Joye wrote:

pajoye  Mon Aug  6 19:50:16 2007 UTC

  Modified files:  
/php-src/ext/openssl	openssl.c 
  Log:

  - MFB: #4, forgot this one (thanks mattias)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.147&r2=1.148&diff_format=u

Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.147 php-src/ext/openssl/openssl.c:1.148
--- php-src/ext/openssl/openssl.c:1.147 Mon Aug  6 19:13:05 2007
+++ php-src/ext/openssl/openssl.c   Mon Aug  6 19:50:16 2007
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: openssl.c,v 1.147 2007/08/06 19:13:05 pajoye Exp $ */

+/* $Id: openssl.c,v 1.148 2007/08/06 19:50:16 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H

 #include "config.h"
@@ -1818,9 +1818,10 @@
len = 200;
}
memcpy(buffer, type, len);
-   buffer[len] = '\0';
+   buffer[len - 1] = '\0';
+
type = buffer;
-   
+
/* Skip past any leading X. X: X, etc to allow for 
multiple
 * instances */
for (str = type; *str; str++) {




--
Wbr, 
Antony Dovgal


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-CVS] cvs: php-src /ext/openssl openssl.c /ext/openssl/tests 005.phpt 005_crt.txt

2007-04-05 Thread Dmitry Stogov
1) HEAD is broken.
2) PHP_5_2 ZTS build is broken too.
3) ext/openssl/test/stests/005.phpt is broken.

Dmitry.

> -Original Message-
> From: Pierre-Alain Joye [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 05, 2007 1:39 AM
> To: php-cvs@lists.php.net
> Subject: [PHP-CVS] cvs: php-src /ext/openssl openssl.c 
> /ext/openssl/tests 005.phpt 005_crt.txt 
> 
> 
> pajoyeWed Apr  4 21:39:01 2007 UTC
> 
>   Added files: 
> /php-src/ext/openssl/tests005_crt.txt 
> 
>   Modified files:  
> /php-src/ext/openssl  openssl.c 
> /php-src/ext/openssl/tests005.phpt 
>   Log:
>   - MFB:
>- implement #39867, PKCS#12 support
>- Fix possible multibyte issues issue in the add_assoc function
>- add test for openssl_csr_get_subject
>   
>   
> 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php