[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
pajoye Mon Jul 6 23:26:23 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: - #48116, restore 0.x compability, thx config.cache. http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.30&r2=1.98.2.5.2.41.2.31&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.30 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.31 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.30Mon Jul 6 23:02:18 2009 +++ php-src/ext/openssl/openssl.c Mon Jul 6 23:26:23 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.30 2009/07/06 23:02:18 pajoye Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.31 2009/07/06 23:26:23 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -502,8 +502,13 @@ static char default_ssl_conf_filename[MAXPATHLEN]; struct php_x509_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, @@ -680,7 +685,11 @@ } /* }}} */ -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) /* {{{ */ +#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; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
pajoye Mon Jul 6 23:02:19 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: - #48116, fix build against openssl 1.0 http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.29&r2=1.98.2.5.2.41.2.30&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.29 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.30 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.29Mon Apr 20 09:44:29 2009 +++ php-src/ext/openssl/openssl.c Mon Jul 6 23:02:18 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.29 2009/04/20 09:44:29 mkoppanen Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.30 2009/07/06 23:02:18 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -502,8 +502,8 @@ 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 */ + LHASH_OF(CONF_VALUE) * global_config; /* Global SSL config */ + LHASH_OF(CONF_VALUE) * req_config; /* SSL config for this request */ const EVP_MD * md_alg; const EVP_MD * digest; char* section_name, @@ -680,7 +680,7 @@ } /* }}} */ -static inline int php_openssl_config_check_syntax(const char * section_label, const char * config_filename,const char * section, LHASH * config TSRMLS_DC) /* {{{ */ +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) /* {{{ */ { X509V3_CTX ctx; @@ -1158,7 +1158,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); } @@ -2787,8 +2787,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
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
mkoppanen Mon Apr 20 09:44:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH: Closes #47991 SSL streams fail if error stack contains items http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.28&r2=1.98.2.5.2.41.2.29&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.28 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.29 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.28Sun Mar 29 23:32:34 2009 +++ php-src/ext/openssl/openssl.c Mon Apr 20 09:44:29 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.28 2009/03/29 23:32:34 scottmac Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.29 2009/04/20 09:44:29 mkoppanen Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4367,6 +4367,7 @@ char *cipherlist = NULL; int ok = 1; + ERR_clear_error(); /* look at context options in the stream and set appropriate verification flags */ if (GET_VER_OPT("verify_peer") && zval_is_true(*val)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
scottmacSun Mar 29 23:32:34 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH 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.98.2.5.2.41.2.27&r2=1.98.2.5.2.41.2.28&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.27 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.28 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.27Wed Dec 31 11:15:40 2008 +++ php-src/ext/openssl/openssl.c Sun Mar 29 23:32:34 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.27 2008/12/31 11:15:40 sebastian Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.28 2009/03/29 23:32:34 scottmac Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -575,7 +575,9 @@ 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_stringl(subentries, (char *)to_add, to_add_len, 1); + if (to_add_len != -1) { + add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1); + } } else { to_add = ASN1_STRING_data(str); to_add_len = ASN1_STRING_length(str); @@ -591,7 +593,7 @@ } else { zval_dtor(subentries); FREE_ZVAL(subentries); - if (obj_cnt && str) { + if (obj_cnt && str && to_add_len > -1) { add_assoc_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
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c /ext/openssl/tests bug41033.pem bug41033.phpt bug41033pub.pem
pajoye Tue Nov 18 01:56:12 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/openssl/tests bug41033.pem bug41033.phpt bug41033pub.pem Modified files: /php-src/ext/opensslopenssl.c Log: - #41033, enable signing with DSA keys http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.25&r2=1.98.2.5.2.41.2.26&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.25 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.26 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.25Mon Nov 17 21:54:25 2008 +++ php-src/ext/openssl/openssl.c Tue Nov 18 01:56:12 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.25 2008/11/17 21:54:25 scottmac Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.26 2008/11/18 01:56:12 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -58,6 +58,7 @@ #define OPENSSL_ALGO_MD5 2 #define OPENSSL_ALGO_MD4 3 #define OPENSSL_ALGO_MD2 4 +#define OPENSSL_ALGO_DSS1 5 #define DEBUG_SMIME0 @@ -904,6 +905,9 @@ case OPENSSL_ALGO_MD2: mdtype = (EVP_MD *) EVP_md2(); break; + case OPENSSL_ALGO_DSS1: + mdtype = (EVP_MD *) EVP_dss1(); + break; default: return NULL; break; @@ -983,6 +987,7 @@ REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); /* flags for S/MIME */ REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); @@ -1470,7 +1475,6 @@ return 0; } X509_STORE_CTX_init(csc, ctx, x, untrustedchain); - if(purpose >= 0) { X509_STORE_CTX_set_purpose(csc, purpose); } http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug41033.pem?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/bug41033.pem +++ php-src/ext/openssl/tests/bug41033.pem http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug41033.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/bug41033.phpt +++ php-src/ext/openssl/tests/bug41033.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug41033pub.pem?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/bug41033pub.pem +++ php-src/ext/openssl/tests/bug41033pub.pem -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
scottmacMon Nov 17 21:54:25 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH Add openssl_random_pseudo_bytes() in order to expose access to a PRG, this wraps around whatever the OS provides. - OpenBSD uses arc4random() - Windows uses the Windows Crypto API - FreeBSD, Linux, etc use /dev/random or /dev/urandom if available [DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.24&r2=1.98.2.5.2.41.2.25&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.24 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.25 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.24Mon Nov 17 11:27:57 2008 +++ php-src/ext/openssl/openssl.c Mon Nov 17 21:54:25 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.24 2008/11/17 11:27:57 felipe Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.25 2008/11/17 21:54:25 scottmac Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -94,6 +94,7 @@ PHP_FUNCTION(openssl_decrypt); PHP_FUNCTION(openssl_dh_compute_key); +PHP_FUNCTION(openssl_random_pseudo_bytes); /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 0, 2) @@ -352,6 +353,11 @@ ZEND_ARG_INFO(0, pub_key) ZEND_ARG_INFO(0, dh_key) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_random_pseudo_bytes, 0, 0, 1) +ZEND_ARG_INFO(0, length) +ZEND_ARG_INFO(1, result_is_strong) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ openssl_functions[] @@ -416,6 +422,7 @@ PHP_FE(openssl_dh_compute_key, arginfo_openssl_dh_compute_key) + PHP_FE(openssl_random_pseudo_bytes, arginfo_openssl_random_pseudo_bytes) PHP_FE(openssl_error_string, arginfo_openssl_error_string) {NULL, NULL, NULL} }; @@ -4704,6 +4711,52 @@ } /* }}} */ +/* {{{ proto string openssl_random_pseudo_bytes(integer length [, &bool returned_strong_result]) + Returns a string of the length specified filled with random pseudo bytes */ +PHP_FUNCTION(openssl_random_pseudo_bytes) +{ + long buffer_length; + unsigned char *buffer = NULL; + zval *zstrong_result_returned = NULL; + int strong_result = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) { + return; + } + + if (buffer_length <= 0) { + RETURN_FALSE; + } + + if (zstrong_result_returned) { + zval_dtor(zstrong_result_returned); + ZVAL_BOOL(zstrong_result_returned, 0); + } + + buffer = emalloc(buffer_length); + + if (!buffer) { + RETURN_FALSE; + } + +#ifdef WINDOWS +RAND_screen(); +#endif + + if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { + RETVAL_FALSE; + } else { + RETVAL_STRINGL((char *)buffer, buffer_length, 1); + + if (zstrong_result_returned) { + ZVAL_BOOL(zstrong_result_returned, strong_result); + } + + } + efree(buffer); +} +/* }}} */ + /* * Local variables: * tab-width: 8 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
iliaa Sun Oct 26 14:35:42 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: Fixed compiler warning http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.21&r2=1.98.2.5.2.41.2.22&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.21 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.22 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.21Fri Oct 24 14:35:36 2008 +++ php-src/ext/openssl/openssl.c Sun Oct 26 14:35:41 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.21 2008/10/24 14:35:36 felipe Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.22 2008/10/26 14:35:41 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3439,7 +3439,7 @@ } } - BIO_reset(infile); + (void)BIO_reset(infile); /* write the encrypted data */ SMIME_write_PKCS7(outfile, p7, infile, flags); @@ -3528,7 +3528,7 @@ goto clean_exit; } - BIO_reset(infile); + (void)BIO_reset(infile); /* tack on extra headers */ if (zheaders) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
iliaa Tue Oct 14 23:38:41 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: Fixed bug #46271 (local_cert option is not resolved to full path) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.18&r2=1.98.2.5.2.41.2.19&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.18 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.19 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.18Tue Sep 30 14:41:49 2008 +++ php-src/ext/openssl/openssl.c Tue Oct 14 23:38:41 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.18 2008/09/30 14:41:49 rrichards Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.19 2008/10/14 23:38:41 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4439,30 +4439,33 @@ X509 *cert = NULL; EVP_PKEY *key = NULL; SSL *tmpssl; + char resolved_path_buff[MAXPATHLEN]; - /* a certificate to use for authentication */ - if (SSL_CTX_use_certificate_chain_file(ctx, certfile) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set local cert chain file `%s'; Check that your cafile/capath settings include details of your certificate and its issuer", certfile); - return NULL; - } + if (VCWD_REALPATH(certfile, resolved_path_buff)) { + /* a certificate to use for authentication */ + if (SSL_CTX_use_certificate_chain_file(ctx, resolved_path_buff) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set local cert chain file `%s'; Check that your cafile/capath settings include details of your certificate and its issuer", certfile); + return NULL; + } - if (SSL_CTX_use_PrivateKey_file(ctx, certfile, SSL_FILETYPE_PEM) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set private key file `%s'", certfile); - return NULL; - } + if (SSL_CTX_use_PrivateKey_file(ctx, resolved_path_buff, SSL_FILETYPE_PEM) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set private key file `%s'", resolved_path_buff); + return NULL; + } - tmpssl = SSL_new(ctx); - cert = SSL_get_certificate(tmpssl); + tmpssl = SSL_new(ctx); + cert = SSL_get_certificate(tmpssl); - if (cert) { - key = X509_get_pubkey(cert); - EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl)); - EVP_PKEY_free(key); - } - SSL_free(tmpssl); + if (cert) { + key = X509_get_pubkey(cert); + EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl)); + EVP_PKEY_free(key); + } + SSL_free(tmpssl); - if (!SSL_CTX_check_private_key(ctx)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!"); + if (!SSL_CTX_check_private_key(ctx)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!"); + } } } if (ok) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
rrichards Tue Sep 30 14:41:49 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH: initialize keyresource http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.17&r2=1.98.2.5.2.41.2.18&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.17 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.18 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.17Thu Sep 18 16:09:19 2008 +++ php-src/ext/openssl/openssl.c Tue Sep 30 14:41:49 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.17 2008/09/18 16:09:19 scottmac Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.18 2008/09/30 14:41:49 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2295,7 +2295,7 @@ X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key = NULL; - long csr_resource, certresource = 0, keyresource; + long csr_resource, certresource = 0, keyresource = -1; int i; struct php_x509_request req; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
tony2001Wed Jul 30 11:59:05 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: fix folding http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.15&r2=1.98.2.5.2.41.2.16&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.15 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.16 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.15Tue Jul 15 03:20:44 2008 +++ php-src/ext/openssl/openssl.c Wed Jul 30 11:59:05 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.15 2008/07/15 03:20:44 hnangelo Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.16 2008/07/30 11:59:05 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -395,6 +395,7 @@ ZEND_ARG_INFO(0, dh_key) ZEND_END_ARG_INFO() /* }}} */ + /* {{{ openssl_functions[] */ const zend_function_entry openssl_functions[] = { @@ -530,7 +531,7 @@ } /* }}} */ -/* {{{ openssl -> PHP "bridging" */ +/* openssl -> PHP "bridging" */ /* true global; readonly after module startup */ static char default_ssl_conf_filename[MAXPATHLEN]; @@ -561,7 +562,6 @@ static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC); static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req TSRMLS_DC); - static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */ { zval *subitem, *subentries; @@ -712,12 +712,7 @@ } /* }}} */ -static inline int php_openssl_config_check_syntax( - const char * section_label, - const char * config_filename, - const char * section, - LHASH * config TSRMLS_DC - ) /* {{{ */ +static inline int php_openssl_config_check_syntax(const char * section_label, const char * config_filename,const char * section, LHASH * config TSRMLS_DC) /* {{{ */ { X509V3_CTX ctx; @@ -780,13 +775,7 @@ else \ varname = defval - - -static int php_openssl_parse_config( - struct php_x509_request * req, - zval * optional_args - TSRMLS_DC - ) /* {{{ */ +static int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args TSRMLS_DC) /* {{{ */ { char * str; zval ** item; @@ -1686,9 +1675,8 @@ /* }}} */ - /* Pop all X509 from Stack and free them, free the stack afterwards */ -static void php_sk_X509_free(STACK_OF(X509) * sk) +static void php_sk_X509_free(STACK_OF(X509) * sk) /* {{{ */ { for (;;) { X509* x = sk_X509_pop(sk); @@ -1697,8 +1685,9 @@ } sk_X509_free(sk); } +/* }}} */ -static STACK_OF(X509) * php_array_to_X509_sk(zval ** zcerts TSRMLS_DC) +static STACK_OF(X509) * php_array_to_X509_sk(zval ** zcerts TSRMLS_DC) /* {{{ */ { HashPosition hpos; zval ** zcertval; @@ -1750,6 +1739,7 @@ clean_exit: return sk; } +/* }}} */ /* {{{ proto bool openssl_pkcs12_export_to_file(mixed x509, string filename, mixed priv_key, string pass[, array args]) Creates and exports a PKCS to file */ @@ -4715,7 +4705,6 @@ } /* }}} */ - /* {{{ proto string openssl_dh_compute_key(string pub_key, resource dh_key) Computes shared sicret for public value of remote DH key and local DH key */ PHP_FUNCTION(openssl_dh_compute_key) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c /ext/openssl/tests 012.phpt public.key
hnangeloTue Jul 15 03:20:45 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/openssl/tests 012.phpt public.key Modified files: /php-src/ext/opensslopenssl.c Log: Fix error message http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.14&r2=1.98.2.5.2.41.2.15&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.14 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.15 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.14Tue Jul 15 02:59:56 2008 +++ php-src/ext/openssl/openssl.c Tue Jul 15 03:20:44 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.14 2008/07/15 02:59:56 hnangelo Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.15 2008/07/15 03:20:44 hnangelo Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4126,7 +4126,7 @@ &pos) == SUCCESS) { pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i] TSRMLS_CC); if (pkeys[i] == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a public key (%dth member of pubkeys)", i); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a public key (%dth member of pubkeys)", i+1); RETVAL_FALSE; goto clean_exit; } http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/012.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/012.phpt +++ php-src/ext/openssl/tests/012.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/public.key?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/public.key +++ php-src/ext/openssl/tests/public.key -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c /ext/openssl/tests 023.phpt 025.phpt cert.crt private.key
hnangeloTue Jul 15 02:59:57 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/openssl/tests 023.phpt 025.phpt cert.crt private.key Modified files: /php-src/ext/opensslopenssl.c Log: Fix uninitilized variables in openssl_pkcs7_encrypt() and openssl_pkcs7_sign() http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.13&r2=1.98.2.5.2.41.2.14&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.13 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.14 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.13Tue Jul 15 02:43:30 2008 +++ php-src/ext/openssl/openssl.c Tue Jul 15 02:59:56 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.13 2008/07/15 02:43:30 hnangelo Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.14 2008/07/15 02:59:56 hnangelo Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3475,6 +3475,7 @@ if (zheaders) { zend_hash_internal_pointer_reset_ex(HASH_OF(zheaders), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(zheaders), (void**)&zcertval, &hpos) == SUCCESS) { + strindex = NULL; zend_hash_get_current_key_ex(HASH_OF(zheaders), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(zcertval); @@ -3584,6 +3585,7 @@ if (zheaders) { zend_hash_internal_pointer_reset_ex(HASH_OF(zheaders), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(zheaders), (void**)&hval, &hpos) == SUCCESS) { + strindex = NULL; zend_hash_get_current_key_ex(HASH_OF(zheaders), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(hval); http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/023.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/023.phpt +++ php-src/ext/openssl/tests/023.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/025.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/025.phpt +++ php-src/ext/openssl/tests/025.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/cert.crt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/cert.crt +++ php-src/ext/openssl/tests/cert.crt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/private.key?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/private.key +++ php-src/ext/openssl/tests/private.key -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c /ext/openssl/tests 006.phpt
hnangeloTue Jul 15 02:43:30 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/openssl/tests 006.phpt Modified files: /php-src/ext/opensslopenssl.c Log: Fix segfault caused by openssl_pkey_new() in ext/openssl/tests/006.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.12&r2=1.98.2.5.2.41.2.13&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.12 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.13 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.12Sat Jun 28 09:17:39 2008 +++ php-src/ext/openssl/openssl.c Tue Jul 15 02:43:30 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.12 2008/06/28 09:17:39 hnangelo Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.13 2008/07/15 02:43:30 hnangelo Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2912,8 +2912,10 @@ OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, dmp1); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, dmq1); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, iqmp); - if (EVP_PKEY_assign_RSA(pkey, rsa)) { - RETURN_RESOURCE(zend_list_insert(pkey, le_key)); + if (rsa->n && rsa->d) { + if (EVP_PKEY_assign_RSA(pkey, rsa)) { + RETURN_RESOURCE(zend_list_insert(pkey, le_key)); + } } RSA_free(rsa); } @@ -2931,11 +2933,13 @@ OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, g); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, priv_key); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, pub_key); - if (!dsa->priv_key && !dsa->pub_key) { - DSA_generate_key(dsa); - } - if (EVP_PKEY_assign_DSA(pkey, dsa)) { - RETURN_RESOURCE(zend_list_insert(pkey, le_key)); + if (dsa->p && dsa->q && dsa->g) { + if (!dsa->priv_key && !dsa->pub_key) { + DSA_generate_key(dsa); + } + if (EVP_PKEY_assign_DSA(pkey, dsa)) { + RETURN_RESOURCE(zend_list_insert(pkey, le_key)); + } } DSA_free(dsa); } @@ -2952,11 +2956,13 @@ 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->pub_key) { - DH_generate_key(dh); - } - if (EVP_PKEY_assign_DH(pkey, dh)) { - RETURN_RESOURCE(zend_list_insert(pkey, le_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)); + } } DH_free(dh); } http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/006.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/006.phpt +++ php-src/ext/openssl/tests/006.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
hnangeloSat Jun 28 09:17:40 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: Fix a memory leak on openssl_decrypt() http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.11&r2=1.98.2.5.2.41.2.12&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.11 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.12 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.11Sun Jun 1 18:24:38 2008 +++ php-src/ext/openssl/openssl.c Sat Jun 28 09:17:39 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.11 2008/06/01 18:24:38 bjori Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.12 2008/06/28 09:17:39 hnangelo Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4653,10 +4653,9 @@ return; } - if (!raw_input) { - base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len); - data_len = base64_str_len; - data = base64_str; + if (!method_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); + RETURN_FALSE; } cipher_type = EVP_get_cipherbyname(method); @@ -4665,6 +4664,12 @@ RETURN_FALSE; } + if (!raw_input) { + base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len); + data_len = base64_str_len; + data = base64_str; + } + keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
bjori Sun Jun 1 18:24:38 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: fix arginfo and proto http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.10&r2=1.98.2.5.2.41.2.11&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.10 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.11 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.10Sun Jun 1 17:54:02 2008 +++ php-src/ext/openssl/openssl.c Sun Jun 1 18:24:38 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.10 2008/06/01 17:54:02 bjori Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.11 2008/06/01 18:24:38 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -291,7 +291,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_private_encrypt, 0, 0, 3) ZEND_ARG_INFO(0, data) -ZEND_ARG_INFO(0, crypted) +ZEND_ARG_INFO(1, crypted) ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(0, padding) ZEND_END_ARG_INFO() @@ -299,7 +299,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_private_decrypt, 0, 0, 3) ZEND_ARG_INFO(0, data) -ZEND_ARG_INFO(0, crypted) +ZEND_ARG_INFO(1, crypted) ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(0, padding) ZEND_END_ARG_INFO() @@ -307,7 +307,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_public_encrypt, 0, 0, 3) ZEND_ARG_INFO(0, data) -ZEND_ARG_INFO(0, crypted) +ZEND_ARG_INFO(1, crypted) ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(0, padding) ZEND_END_ARG_INFO() @@ -315,7 +315,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_public_decrypt, 0, 0, 3) ZEND_ARG_INFO(0, data) -ZEND_ARG_INFO(0, crypted) +ZEND_ARG_INFO(1, crypted) ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(0, padding) ZEND_END_ARG_INFO() @@ -1526,7 +1526,7 @@ } /* }}} */ -/* {{{ proto mixed openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile]) +/* {{{ proto int openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile]) Checks the CERT to see if it can be used for the purpose in purpose. cainfo holds information about trusted CAs */ PHP_FUNCTION(openssl_x509_checkpurpose) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
bjori Sun Jun 1 17:54:02 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: Add arginfo & fix protos http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.9&r2=1.98.2.5.2.41.2.10&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.9 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.10 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.9 Sun May 4 21:17:32 2008 +++ php-src/ext/openssl/openssl.c Sun Jun 1 17:54:02 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.9 2008/05/04 21:17:32 colder Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.10 2008/06/01 17:54:02 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -61,13 +61,6 @@ #define DEBUG_SMIME0 -static - ZEND_BEGIN_ARG_INFO(arg2and3_force_ref, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(1) - ZEND_ARG_PASS_INFO(1) - ZEND_END_ARG_INFO(); - /* FIXME: Use the openssl constants instead of * enum. It is now impossible to match real values * against php constants. Also sorry to break the @@ -102,69 +95,369 @@ PHP_FUNCTION(openssl_dh_compute_key); +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 0, 2) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(0, outfilename) +ZEND_ARG_INFO(0, notext) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(1, out) +ZEND_ARG_INFO(0, notext) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0) +ZEND_ARG_INFO(0, cert) +ZEND_ARG_INFO(0, key) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_parse, 0) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(0, shortname) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 3) +ZEND_ARG_INFO(0, x509cert) +ZEND_ARG_INFO(0, purpose) +ZEND_ARG_INFO(0, cainfo) /* array */ +ZEND_ARG_INFO(0, untrustedfile) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_read, 0) +ZEND_ARG_INFO(0, cert) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_free, 0) +ZEND_ARG_INFO(0, x509) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 0, 4) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(0, filename) +ZEND_ARG_INFO(0, priv_key) +ZEND_ARG_INFO(0, pass) +ZEND_ARG_INFO(0, args) /* array */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkcs12_export, 0) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(1, out) +ZEND_ARG_INFO(0, priv_key) +ZEND_ARG_INFO(0, pass) +ZEND_ARG_INFO(0, args) /* array */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkcs12_read, 0) +ZEND_ARG_INFO(0, PKCS12) +ZEND_ARG_INFO(1, certs) /* array */ +ZEND_ARG_INFO(0, pass) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 0, 2) +ZEND_ARG_INFO(0, csr) +ZEND_ARG_INFO(0, outfilename) +ZEND_ARG_INFO(0, notext) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_export, 0, 0, 2) +ZEND_ARG_INFO(0, csr) +ZEND_ARG_INFO(1, out) +ZEND_ARG_INFO(0, notext) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_sign, 0, 0, 4) +ZEND_ARG_INFO(0, csr) +ZEND_ARG_INFO(0, x509) +ZEND_ARG_INFO(0, priv_key) +ZEND_ARG_INFO(0, days) +ZEND_ARG_INFO(0, config_args) /* array */ +ZEND_ARG_INFO(0, serial) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_new, 0, 0, 2) +ZEND_ARG_INFO(0, dn) /* array */ +ZEND_ARG_INFO(1, privkey) +ZEND_ARG_INFO(0, configargs) +ZEND_ARG_INFO(0, extraattribs) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_csr_get_subject, 0) +ZEND_ARG_INFO(0, csr) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_csr_get_public_key, 0) +ZEND_ARG_INFO(0, csr) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_new, 0, 0, 0) +ZEND_ARG_INFO(0, configargs) /* array */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_export_to_file, 0, 0, 2) +ZEND_ARG_INFO(0, key) +ZEND_ARG_INFO(0, outfilename) +ZEND_ARG_INFO(0, passphrase) +ZEND_ARG_INFO(0, config_args) /* array */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_export, 0, 0, 2) +ZEND_ARG_INFO(0, key) +ZEND_ARG_INFO(1, out) +ZEND_ARG_INFO(0, passphrase) +ZEND_ARG_INFO(0, config_args) /* array */ +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_public, 0) +ZEND_ARG_INFO(0, cert) +ZEN
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
tony2001Wed Apr 2 14:35:29 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH: initialize variable http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.7&r2=1.98.2.5.2.41.2.8&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.7 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.8 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.7 Mon Mar 10 22:12:35 2008 +++ php-src/ext/openssl/openssl.c Wed Apr 2 14:35:29 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.7 2008/03/10 22:12:35 felipe Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.8 2008/04/02 14:35:29 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2014,7 +2014,7 @@ X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key = NULL; - long csr_resource, certresource, keyresource; + long csr_resource, certresource = 0, keyresource; int i; struct php_x509_request req; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
rrichards Tue Jan 15 15:12:47 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH: fix memleak in sign and verify functions http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.5&r2=1.98.2.5.2.41.2.6&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.5 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.6 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.5 Wed Jan 9 16:47:25 2008 +++ php-src/ext/openssl/openssl.c Tue Jan 15 15:12:47 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.5 2008/01/09 16:47:25 rrichards Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.6 2008/01/15 15:12:47 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3716,6 +3716,7 @@ efree(sigbuf); RETVAL_FALSE; } + EVP_MD_CTX_cleanup(&md_ctx); if (keyresource == -1) { EVP_PKEY_free(pkey); } @@ -3766,6 +3767,7 @@ EVP_VerifyInit (&md_ctx, mdtype); EVP_VerifyUpdate (&md_ctx, data, data_len); err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, signature_len, pkey); + EVP_MD_CTX_cleanup(&md_ctx); if (keyresource == -1) { EVP_PKEY_free(pkey); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c
rrichards Wed Jan 9 16:47:26 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/opensslopenssl.c Log: MFH: fix crash when using default algorithm http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.4&r2=1.98.2.5.2.41.2.5&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.4 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.5 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.4 Mon Dec 31 07:17:11 2007 +++ php-src/ext/openssl/openssl.c Wed Jan 9 16:47:25 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.4 2007/12/31 07:17:11 sebastian Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.5 2008/01/09 16:47:25 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3687,7 +3687,7 @@ } if (method == NULL || Z_TYPE_P(method) == IS_LONG) { - if (Z_TYPE_P(method) == IS_LONG) { + if (method != NULL) { signature_algo = Z_LVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); @@ -3742,7 +3742,7 @@ } if (method == NULL || Z_TYPE_P(method) == IS_LONG) { - if (Z_TYPE_P(method) == IS_LONG) { + if (method != NULL) { signature_algo = Z_LVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/openssl openssl.c /ext/standard filestat.c php_filestat.h /ext/standard/tests/file 005_basic.phpt 005_error.phpt bug43137.phpt /main/streams plain_wrapper.c
janiWed Oct 31 13:22:45 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/filebug43137.phpt Modified files: /php-src/ext/opensslopenssl.c /php-src/ext/standard filestat.c php_filestat.h /php-src/ext/standard/tests/file005_basic.phpt 005_error.phpt /php-src/main/streams plain_wrapper.c Log: MFH: - Fixed bug #43137 (rmdir() and rename() do not clear statcache) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41.2.2&r2=1.98.2.5.2.41.2.3&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.2 php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.3 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.2 Thu Sep 27 18:00:42 2007 +++ php-src/ext/openssl/openssl.c Wed Oct 31 13:22:44 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41.2.2 2007/09/27 18:00:42 dmitry Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.41.2.3 2007/10/31 13:22:44 jani Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -48,6 +48,9 @@ #include #include +/* Common */ +#include + #define DEFAULT_KEY_LENGTH 512 #define MIN_KEY_LENGTH 384 @@ -1233,7 +1236,7 @@ } /* }}} */ -/* {{{ proto int openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile]) +/* {{{ proto mixed openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile]) Checks the CERT to see if it can be used for the purpose in purpose. cainfo holds information about trusted CAs */ PHP_FUNCTION(openssl_x509_checkpurpose) { @@ -1244,10 +1247,9 @@ STACK_OF(X509) * untrustedchain = NULL; long purpose; char * untrusted = NULL; - int untrusted_len; + int untrusted_len, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) - == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) { return; } @@ -1268,7 +1270,13 @@ if (cert == NULL) { goto clean_exit; } - RETVAL_LONG(check_cert(cainfo, cert, untrustedchain, purpose)); + + ret = check_cert(cainfo, cert, untrustedchain, purpose); + if (ret != 0 && ret != 1) { + RETVAL_LONG(ret); + } else { + RETVAL_BOOL(ret); + } clean_exit: if (certresource == 1 && cert) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.136.2.8.2.14&r2=1.136.2.8.2.14.2.1&diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.136.2.8.2.14 php-src/ext/standard/filestat.c:1.136.2.8.2.14.2.1 --- php-src/ext/standard/filestat.c:1.136.2.8.2.14 Fri Sep 21 14:05:18 2007 +++ php-src/ext/standard/filestat.c Wed Oct 31 13:22:44 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filestat.c,v 1.136.2.8.2.14 2007/09/21 14:05:18 tony2001 Exp $ */ +/* $Id: filestat.c,v 1.136.2.8.2.14.2.1 2007/10/31 13:22:44 jani Exp $ */ #include "php.h" #include "safe_mode.h" @@ -698,14 +698,10 @@ /* }}} */ #endif -/* {{{ proto void clearstatcache(void) - Clear file stat cache */ -PHP_FUNCTION(clearstatcache) +/* {{{ php_clear_stat_cache() +*/ +PHPAPI void php_clear_stat_cache(TSRMLS_D) { - if (ZEND_NUM_ARGS()) { - WRONG_PARAM_COUNT; - } - if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); BG(CurrentStatFile) = NULL; @@ -718,6 +714,17 @@ } /* }}} */ +/* {{{ proto void clearstatcache(void) + Clear file stat cache */ +PHP_FUNCTION(clearstatcache) +{ + if (ZEND_NUM_ARGS()) { + WRONG_PARAM_COUNT; + } + php_clear_stat_cache(TSRMLS_C); +} +/* }}} */ + #define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT) #define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK) #define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_filestat.h?r1=1.24.2.4.2.1.2.1&r2=1.24.2.4.2.1.2.2&diff_format=u Index: php-src/ext/standard/php_filestat.h diff -u php-src/ext/standard/php_filestat.h:1.24.2.4.2.1.2.1 php-src/ext/standard/php_filestat.h:1.24.2.4.2.1.2.2 --- php-src/ext/standard/php_filestat.h:1.24.2.4.2.1.2.1Sun Oct 7 05:22:07 2007 +++ php-src/ext/standard/php_filestat.h Wed Oct 31 13:22:44 2007 @@ -16,7 +16,7 @@ +-