mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:33:31 +03:00
Added handling of CURLINFO_SSL_ENGINES;
Added Curl_SSL_engines_list(), cleanup SSL in url.c (no HAVE_OPENSSL_x etc.).
This commit is contained in:
parent
be9ea07e87
commit
bdb0620529
5 changed files with 102 additions and 45 deletions
39
lib/url.c
39
lib/url.c
|
|
@ -97,9 +97,6 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#include "urldata.h"
|
||||
#include "netrc.h"
|
||||
|
||||
|
|
@ -1150,45 +1147,15 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||
* String that holds the SSL crypto engine.
|
||||
*/
|
||||
argptr = va_arg(param, char *);
|
||||
if (argptr && argptr[0]) {
|
||||
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
|
||||
ENGINE *e = ENGINE_by_id(argptr);
|
||||
if (e) {
|
||||
if (data->engine) {
|
||||
ENGINE_free(data->engine);
|
||||
}
|
||||
data->engine = e;
|
||||
}
|
||||
else {
|
||||
failf(data, "SSL Engine '%s' not found", argptr);
|
||||
result = CURLE_SSL_ENGINE_NOTFOUND;
|
||||
}
|
||||
#else
|
||||
failf(data, "SSL Engine not supported");
|
||||
result = CURLE_SSL_ENGINE_NOTFOUND;
|
||||
#endif
|
||||
}
|
||||
if (argptr && argptr[0])
|
||||
result = Curl_SSL_set_engine(data, argptr);
|
||||
break;
|
||||
|
||||
case CURLOPT_SSLENGINE_DEFAULT:
|
||||
/*
|
||||
* flag to set engine as default.
|
||||
*/
|
||||
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
|
||||
if (data->engine) {
|
||||
if (ENGINE_set_default(data->engine, ENGINE_METHOD_ALL) > 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"set default crypto engine\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
failf(data, "set default crypto engine failed");
|
||||
#endif
|
||||
return CURLE_SSL_ENGINE_SETFAILED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
result = Curl_SSL_set_engine_default(data);
|
||||
break;
|
||||
case CURLOPT_CRLF:
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue