From: Stig Venaas Date: Fri, 17 Nov 2000 19:17:07 +0000 (+0000) Subject: Renamed openssl_read_privatekey openssl_get_privatekey, and some minor X-Git-Tag: php-4.0.4RC3~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b500cdcdfb111546c98fb62e61b8e1879857bdb;p=php Renamed openssl_read_privatekey openssl_get_privatekey, and some minor fixes including init and shutdown functions --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index fec048fa1a..ece6c7481e 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -39,7 +39,7 @@ static unsigned char arg2and3of4_force_ref[] = 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 @@ PHP_MINIT_FUNCTION(openssl) "OpenSSL X.509", module_number); #endif + OpenSSL_add_all_ciphers(); return SUCCESS; } @@ -98,9 +99,15 @@ PHP_MINFO_FUNCTION(openssl) 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 @@ PHP_FUNCTION(openssl_read_privatekey) } 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) { diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h index 3740a8f177..1c9a418a09 100644 --- a/ext/openssl/php_openssl.h +++ b/ext/openssl/php_openssl.h @@ -26,8 +26,9 @@ extern zend_module_entry openssl_module_entry; #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