minor updates to pull#17
diff --git a/evhtp.c b/evhtp.c
index 0d77b6a..ece5ac8 100644
--- a/evhtp.c
+++ b/evhtp.c
@@ -4586,20 +4586,23 @@
SSL_CTX_use_certificate_file(htp->ssl_ctx, cfg->pemfile, SSL_FILETYPE_PEM);
- // decrypt the privfile with user's customized decrypt algo.
- if(cfg->customized_privfile_decrypt_cb != NULL) {
- EVP_PKEY *pkey = cfg->customized_privfile_decrypt_cb(cfg->privfile ? cfg->privfile : cfg->pemfile);
- if(pkey == NULL) {
+ char * const key = cfg->privfile ? cfg->privfile : cfg->pemfile;
+
+ if (cfg->decrypt_cb != NULL)
+ {
+ EVP_PKEY * pkey = cfg->decrypt_cb(key);
+
+ if (pkey == NULL)
+ {
return -1;
}
SSL_CTX_use_PrivateKey(htp->ssl_ctx, pkey);
- //cleanup
+ /*cleanup */
EVP_PKEY_free(pkey);
} else {
- SSL_CTX_use_PrivateKey_file(htp->ssl_ctx,
- cfg->privfile ? cfg->privfile : cfg->pemfile, SSL_FILETYPE_PEM);
+ SSL_CTX_use_PrivateKey_file(htp->ssl_ctx, key, SSL_FILETYPE_PEM);
}
SSL_CTX_set_session_id_context(htp->ssl_ctx,
diff --git a/evhtp.h b/evhtp.h
index 98f07d2..cc71e13 100644
--- a/evhtp.h
+++ b/evhtp.h
@@ -194,7 +194,7 @@
#ifndef EVHTP_DISABLE_SSL
typedef int (* evhtp_ssl_verify_cb)(int pre_verify, evhtp_x509_store_ctx_t * ctx);
typedef int (* evhtp_ssl_chk_issued_cb)(evhtp_x509_store_ctx_t * ctx, evhtp_x509_t * x, evhtp_x509_t * issuer);
-typedef EVP_PKEY* (* evhtp_ssl_privfile_decrypt_cb)(char* privfile);
+typedef EVP_PKEY * (* evhtp_ssl_decrypt_cb)(char * privfile);
typedef int (* evhtp_ssl_scache_add)(evhtp_connection_t * connection, unsigned char * sid, int sid_len, evhtp_ssl_sess_t * sess);
typedef void (* evhtp_ssl_scache_del)(evhtp_t * htp, unsigned char * sid, int sid_len);
@@ -520,7 +520,7 @@
int verify_depth;
evhtp_ssl_verify_cb x509_verify_cb;
evhtp_ssl_chk_issued_cb x509_chk_issued_cb;
- evhtp_ssl_privfile_decrypt_cb customized_privfile_decrypt_cb;
+ evhtp_ssl_decrypt_cb decrypt_cb;
long store_flags;
evhtp_ssl_scache_type scache_type;
long scache_timeout;