From 3fe91ed83f2bd5e95aa94014f952cc4c86d0b04e Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Sat, 29 Jul 2006 22:52:49 +0000 Subject: [PATCH] - vi happiness++ --- ext/openssl/openssl.c | 48 ++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 95d802f61a..bf22e8deac 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -156,10 +156,11 @@ static int le_x509; static int le_csr; static int ssl_stream_data_index; -int php_openssl_get_x509_list_id(void) +int php_openssl_get_x509_list_id(void) /* {{{ */ { return le_x509; } +/* }}} */ /* {{{ resource destructors */ static void php_pkey_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) @@ -202,7 +203,7 @@ inline static int php_openssl_safe_mode_chk(char *filename TSRMLS_DC) /* true global; readonly after module startup */ static char default_ssl_conf_filename[MAXPATHLEN]; -struct php_x509_request { +struct php_x509_request { /* {{{ */ LHASH * global_config; /* Global SSL config */ LHASH * req_config; /* SSL config for this request */ const EVP_MD * md_alg; @@ -219,7 +220,7 @@ struct php_x509_request { EVP_PKEY * priv_key; }; - +/* }}} */ static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC); static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval TSRMLS_DC); @@ -230,7 +231,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long 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) +static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */ { zval *subitem, *subentries; int i, j = -1, last = -1, obj_cnt = 0; @@ -285,13 +286,15 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s } zend_hash_update(HASH_OF(val), key, strlen(key) + 1, (void *)&subitem, sizeof(subitem), NULL); } +/* }}} */ -static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) +static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) /* {{{ */ { add_assoc_stringl(val, key, str->data, str->length, 1); } +/* }}} */ -static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) +static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */ { /* This is how the time string is formatted: @@ -359,12 +362,14 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) return ret; } +/* }}} */ static inline int php_openssl_config_check_syntax( const char * section_label, const char * config_filename, const char * section, - LHASH * config TSRMLS_DC) + LHASH * config TSRMLS_DC + ) /* {{{ */ { X509V3_CTX ctx; @@ -379,8 +384,9 @@ static inline int php_openssl_config_check_syntax( } return SUCCESS; } +/* }}} */ -static int add_oid_section(struct php_x509_request * req TSRMLS_DC) +static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */ { char * str; STACK_OF(CONF_VALUE) * sktmp; @@ -405,6 +411,7 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) } return SUCCESS; } +/* }}} */ #define PHP_SSL_REQ_INIT(req) memset(req, 0, sizeof(*req)) #define PHP_SSL_REQ_DISPOSE(req) php_openssl_dispose_config(req TSRMLS_CC) @@ -431,7 +438,7 @@ static int php_openssl_parse_config( struct php_x509_request * req, zval * optional_args TSRMLS_DC - ) + ) /* {{{ */ { char * str; zval ** item; @@ -509,8 +516,9 @@ static int php_openssl_parse_config( return SUCCESS; } +/* }}} */ -static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC) +static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC) /* {{{ */ { if (req->priv_key) { EVP_PKEY_free(req->priv_key); @@ -525,8 +533,9 @@ static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC) req->req_config = NULL; } } +/* }}} */ -static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded) +static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded) /* {{{ */ { char buffer[MAXPATHLEN]; @@ -556,8 +565,9 @@ static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *se *seeded = 1; return SUCCESS; } +/* }}} */ -static int php_openssl_write_rand_file(const char * file, int egdsocket, int seeded) +static int php_openssl_write_rand_file(const char * file, int egdsocket, int seeded) /* {{{ */ { char buffer[MAXPATHLEN]; @@ -577,6 +587,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see } return SUCCESS; } +/* }}} */ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */ EVP_MD *mdtype; @@ -3156,7 +3167,7 @@ PHP_FUNCTION(openssl_open) #define GET_VER_OPT(name) (stream->context && SUCCESS == php_stream_context_get_option(stream->context, "ssl", name, &val)) #define GET_VER_OPT_STRING(name, str) if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_PP(val); } -static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) +static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ { php_stream *stream; SSL *ssl; @@ -3193,8 +3204,9 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) return ret; } +/* }}} */ -int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream TSRMLS_DC) +int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream TSRMLS_DC) /* {{{ */ { zval **val = NULL; char *cnmatch = NULL; @@ -3262,8 +3274,9 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stre return SUCCESS; } +/* }}} */ -static int passwd_callback(char *buf, int num, int verify, void *data) +static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */ { php_stream *stream = (php_stream *)data; zval **val = NULL; @@ -3280,8 +3293,9 @@ static int passwd_callback(char *buf, int num, int verify, void *data) } return 0; } +/* }}} */ -SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) +SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ */ { zval **val = NULL; char *cafile = NULL; @@ -3371,7 +3385,7 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) return NULL; } - +/* }}} */ /* * Local variables: -- 2.50.1