]> granicus.if.org Git - apache/commitdiff
* modules/ssl/ssl_util_ssl.c (modssl_read_privatekey): Remove unused
authorJoe Orton <jorton@apache.org>
Fri, 4 May 2018 12:24:11 +0000 (12:24 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 4 May 2018 12:24:11 +0000 (12:24 +0000)
  second argument.

* modules/ssl/ssl_engine_pphrase.c (ssl_load_encrypted_pkey): Adjust
  accordingly.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1830913 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_pphrase.c
modules/ssl/ssl_util_ssl.c
modules/ssl/ssl_util_ssl.h

index 0b8023eb80d7c9a5cf780d38d2b0007bc15cda17..193f3f9e89cab2a4482551a50ce19271025087ac 100644 (file)
@@ -215,7 +215,7 @@ apr_status_t ssl_load_encrypted_pkey(server_rec *s, apr_pool_t *p, int idx,
          * is not empty. */
         ERR_clear_error();
 
-        pPrivateKey = modssl_read_privatekey(ppcb_arg.pkey_file, NULL,
+        pPrivateKey = modssl_read_privatekey(ppcb_arg.pkey_file,
                                              ssl_pphrase_Handle_CB, &ppcb_arg);
         /* If the private key was successfully read, nothing more to
            do here. */
index d6a5a3abeca3cb1771ae32b75e15a3e42d68ad8c..4fa089b96ee0a13cde510f706199ca1d2d09fa89 100644 (file)
@@ -74,7 +74,7 @@ void modssl_set_app_data2(SSL *ssl, void *arg)
 **  _________________________________________________________________
 */
 
-EVP_PKEY *modssl_read_privatekey(const char* filename, EVP_PKEY **key, pem_password_cb *cb, void *s)
+EVP_PKEY *modssl_read_privatekey(const char *filename, pem_password_cb *cb, void *s)
 {
     EVP_PKEY *rc;
     BIO *bioS;
@@ -83,7 +83,7 @@ EVP_PKEY *modssl_read_privatekey(const char* filename, EVP_PKEY **key, pem_passw
     /* 1. try PEM (= DER+Base64+headers) */
     if ((bioS=BIO_new_file(filename, "r")) == NULL)
         return NULL;
-    rc = PEM_read_bio_PrivateKey(bioS, key, cb, s);
+    rc = PEM_read_bio_PrivateKey(bioS, NULL, cb, s);
     BIO_free(bioS);
 
     if (rc == NULL) {
@@ -107,11 +107,6 @@ EVP_PKEY *modssl_read_privatekey(const char* filename, EVP_PKEY **key, pem_passw
             BIO_free(bioS);
         }
     }
-    if (rc != NULL && key != NULL) {
-        if (*key != NULL)
-            EVP_PKEY_free(*key);
-        *key = rc;
-    }
     return rc;
 }
 
index 08fba63fb33979b1eb02f8099bfeb42c556a500d..d6307d971a03ca68e18b05e072591e6d696c7b54 100644 (file)
 void        modssl_init_app_data2_idx(void);
 void       *modssl_get_app_data2(SSL *);
 void        modssl_set_app_data2(SSL *, void *);
-EVP_PKEY   *modssl_read_privatekey(const char *, EVP_PKEY **, pem_password_cb *, void *);
+
+/* Read private key from filename in either PEM or raw base64(DER)
+ * format, using password entry callback cb and userdata. */
+EVP_PKEY   *modssl_read_privatekey(const char *filename, pem_password_cb *cb, void *ud);
+
 int         modssl_smart_shutdown(SSL *ssl);
 BOOL        modssl_X509_getBC(X509 *, int *, int *);
 char       *modssl_X509_NAME_ENTRY_to_string(apr_pool_t *p, X509_NAME_ENTRY *xsne,