mirror of https://github.com/moparisthebest/curl
metalink: fix NSS issue in MultiSSL builds
In MultiSSL mode (i.e. when more than one SSL backend is compiled in), we cannot use the compile time flag `USE_NSS` as indicator that the NSS backend is in use. As far as Metalink is concerned, the SSL backend is only used for MD5, SHA-1 and SHA-256 calculations, therefore one of the available SSL backends is selected at compile time, in a strict order of preference. Let's introduce a new `HAVE_NSS_CONTEXT` constant that can be used to determine whether the SSL backend used for Metalink is the NSS backend, and use that to guard the code that wants to de-initialize the NSS-specific data structure. Ref: https://github.com/curl/curl/pull/1848
This commit is contained in:
parent
6f86022df2
commit
de47158934
|
@ -30,6 +30,8 @@
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef HAVE_NSS_CONTEXT
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
# include <openssl/md5.h>
|
# include <openssl/md5.h>
|
||||||
# include <openssl/sha.h>
|
# include <openssl/sha.h>
|
||||||
|
@ -50,6 +52,7 @@
|
||||||
# define MD5_CTX void *
|
# define MD5_CTX void *
|
||||||
# define SHA_CTX void *
|
# define SHA_CTX void *
|
||||||
# define SHA256_CTX void *
|
# define SHA256_CTX void *
|
||||||
|
# define HAVE_NSS_CONTEXT
|
||||||
static NSSInitContext *nss_context;
|
static NSSInitContext *nss_context;
|
||||||
#elif defined(USE_POLARSSL)
|
#elif defined(USE_POLARSSL)
|
||||||
# include <polarssl/md5.h>
|
# include <polarssl/md5.h>
|
||||||
|
@ -967,7 +970,7 @@ void clean_metalink(struct OperationConfig *config)
|
||||||
|
|
||||||
void metalink_cleanup(void)
|
void metalink_cleanup(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_NSS
|
#ifdef HAVE_NSS_CONTEXT
|
||||||
if(nss_context) {
|
if(nss_context) {
|
||||||
NSS_ShutdownContext(nss_context);
|
NSS_ShutdownContext(nss_context);
|
||||||
nss_context = NULL;
|
nss_context = NULL;
|
||||||
|
|
Loading…
Reference in New Issue