cvs: php4 /ext/openssl openssl.c php_openssl.h

From: Date: Fri, 17 Nov 2000 19:17:07 +0000
Subject: cvs: php4 /ext/openssl openssl.c php_openssl.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2667@lists.php.net to get a copy of this message
venaas Fri Nov 17 11:17:07 2000 EDT Modified files: /php4/ext/openssl php_openssl.h openssl.c Log: Renamed openssl_read_privatekey openssl_get_privatekey, and some minor fixes including init and shutdown functions Index: php4/ext/openssl/php_openssl.h diff -u php4/ext/openssl/php_openssl.h:1.3 php4/ext/openssl/php_openssl.h:1.4 --- php4/ext/openssl/php_openssl.h:1.3 Thu Nov 16 03:16:24 2000 +++ php4/ext/openssl/php_openssl.h Fri Nov 17 11:17:06 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_openssl.h,v 1.3 2000/11/16 11:16:24 sniper Exp $ */ +/* $Id: php_openssl.h,v 1.4 2000/11/17 19:17:06 venaas Exp $ */ #ifndef PHP_OPENSSL_H #define PHP_OPENSSL_H @@ -26,8 +26,9 @@ #define phpext_openssl_ptr &openssl_module_entry PHP_MINIT_FUNCTION(openssl); +PHP_MSHUTDOWN_FUNCTION(openssl); PHP_MINFO_FUNCTION(openssl); -PHP_FUNCTION(openssl_read_privatekey); +PHP_FUNCTION(openssl_get_privatekey); PHP_FUNCTION(openssl_get_publickey); PHP_FUNCTION(openssl_free_key); #if 0 Index: php4/ext/openssl/openssl.c diff -u php4/ext/openssl/openssl.c:1.3 php4/ext/openssl/openssl.c:1.4 --- php4/ext/openssl/openssl.c:1.3 Tue Nov 14 09:05:38 2000 +++ php4/ext/openssl/openssl.c Fri Nov 17 11:17:06 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.3 2000/11/14 17:05:38 venaas Exp $ */ +/* $Id: openssl.c,v 1.4 2000/11/17 19:17:06 venaas Exp $ */ #include "php.h" #include "php_openssl.h" @@ -39,7 +39,7 @@ function_entry openssl_functions[] = { - PHP_FE(openssl_read_privatekey, NULL) + PHP_FE(openssl_get_privatekey, NULL) PHP_FE(openssl_get_publickey, NULL) PHP_FE(openssl_free_key, NULL) #if 0 @@ -87,6 +87,7 @@ "OpenSSL X.509", module_number); #endif + OpenSSL_add_all_ciphers(); return SUCCESS; } @@ -98,9 +99,15 @@ php_info_print_table_end(); } +PHP_MSHUTDOWN_FUNCTION(openssl) +{ + EVP_cleanup(); + return SUCCESS; +} + /* {{{ proto int openssl_get_privatekey(string key) - Read private key */ -PHP_FUNCTION(openssl_read_privatekey) + Get private key */ +PHP_FUNCTION(openssl_get_privatekey) { zval **key; BIO *b; @@ -112,14 +119,14 @@ } convert_to_string_ex(key); - b = BIO_new_mem_buf(Z_STRVAL_PP(key), -1); + b = BIO_new_mem_buf(Z_STRVAL_PP(key), Z_STRLEN_PP(key)); if (b == NULL) { RETURN_FALSE; } pkey = (EVP_PKEY *) PEM_ASN1_read_bio((char *(*)())d2i_PrivateKey, - PEM_STRING_EVP_PKEY, b, - NULL, NULL, NULL); + PEM_STRING_EVP_PKEY, b, + NULL, NULL, NULL); BIO_free(b); if (pkey == NULL) {

« previous php.cvs (#2667) next »