]> granicus.if.org Git - php/commitdiff
Renamed openssl_read_privatekey openssl_get_privatekey, and some minor
authorStig Venaas <venaas@php.net>
Fri, 17 Nov 2000 19:17:07 +0000 (19:17 +0000)
committerStig Venaas <venaas@php.net>
Fri, 17 Nov 2000 19:17:07 +0000 (19:17 +0000)
fixes including init and shutdown functions

ext/openssl/openssl.c
ext/openssl/php_openssl.h

index fec048fa1aaac67378794e1894088fcb86114c2e..ece6c7481e103dfa1f37cf924ed8f3c51537dbb9 100644 (file)
@@ -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) { 
index 3740a8f17735c8d416b03e3a78f230d31d2687ba..1c9a418a09de38415571cdb2517c43de348010eb 100644 (file)
@@ -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