X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=openssl.c;h=8239e3362e8e04c4b30d17f9d075aa1bcad2db33;hb=f5c1a886b7ae20da7eafb77926252eb521260728;hp=e6973103ed057c4208d469564eb15f50941df5ea;hpb=691c4f59e98481dd056abbab8b86d5a4294481a5;p=privoxy.git diff --git a/openssl.c b/openssl.c index e6973103..8239e336 100644 --- a/openssl.c +++ b/openssl.c @@ -697,7 +697,7 @@ exit: * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) * - * Returns : 1 => Error while creating hash + * Returns : -1 => Error while creating hash * 0 => Hash created successfully * *********************************************************************/ @@ -1764,6 +1764,15 @@ static int generate_host_certificate(struct client_state *csp) return -1; } + if (enforce_sane_certificate_state(cert_opt.output_file, + cert_opt.subject_key)) + { + freez(cert_opt.output_file); + freez(cert_opt.subject_key); + + return -1; + } + if (file_exists(cert_opt.output_file) == 1) { /* The file exists, but is it valid? */ @@ -1802,25 +1811,6 @@ static int generate_host_certificate(struct client_state *csp) } } - if (file_exists(cert_opt.output_file) == 0 && - file_exists(cert_opt.subject_key) == 1) - { - log_error(LOG_LEVEL_ERROR, - "A website key already exists but there's no matching certificate. " - "Removing %s before creating a new key and certificate.", - cert_opt.subject_key); - if (unlink(cert_opt.subject_key)) - { - log_error(LOG_LEVEL_ERROR, "Failed to unlink %s: %E", - cert_opt.subject_key); - - freez(cert_opt.output_file); - freez(cert_opt.subject_key); - - return -1; - } - } - /* * Create key for requested host */ @@ -2231,6 +2221,7 @@ extern void ssl_crt_verify_info(char *buf, size_t size, struct client_state *csp } +#ifdef FEATURE_GRACEFUL_TERMINATION /********************************************************************* * * Function : ssl_release @@ -2246,8 +2237,12 @@ extern void ssl_release(void) { if (ssl_inited == 1) { +#if OPENSSL_VERSION_NUMBER >= 0x1000200fL +#ifndef LIBRESSL_VERSION_NUMBER #ifndef OPENSSL_NO_COMP SSL_COMP_free_compression_methods(); +#endif +#endif #endif CONF_modules_free(); CONF_modules_unload(1); @@ -2261,4 +2256,4 @@ extern void ssl_release(void) CRYPTO_cleanup_all_ex_data(); } } - +#endif /* def FEATURE_GRACEFUL_TERMINATION */