diff --git a/cpu-miner.c b/cpu-miner.c index 1003fe9..5915d9a 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -135,6 +135,7 @@ static int num_processors; static char *rpc_url; static char *rpc_userpass; static char *rpc_user, *rpc_pass; +char *opt_cert; char *opt_proxy; long opt_proxy_type; struct thr_info *thr_info; @@ -172,6 +173,7 @@ Options:\n\ -O, --userpass=U:P username:password pair for mining server\n\ -u, --user=USERNAME username for mining server\n\ -p, --pass=PASSWORD password for mining server\n\ + --cert=FILE certificate for mining server using SSL\n\ -x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy\n\ -t, --threads=N number of miner threads (default: number of processors)\n\ -r, --retries=N number of times to retry if a network call fails\n\ @@ -215,6 +217,7 @@ static struct option const options[] = { { "background", 0, NULL, 'B' }, #endif { "benchmark", 0, NULL, 1005 }, + { "cert", 1, NULL, 1001 }, { "config", 1, NULL, 'c' }, { "debug", 0, NULL, 'D' }, { "help", 0, NULL, 'h' }, @@ -1149,6 +1152,10 @@ static void parse_arg (int key, char *arg) free(opt_proxy); opt_proxy = strdup(arg); break; + case 1001: + free(opt_cert); + opt_cert = strdup(arg); + break; case 1005: opt_benchmark = true; want_longpoll = false; diff --git a/miner.h b/miner.h index 42841a1..867a1e8 100644 --- a/miner.h +++ b/miner.h @@ -167,6 +167,7 @@ extern bool want_longpoll; extern bool have_longpoll; extern bool want_stratum; extern bool have_stratum; +extern char *opt_cert; extern char *opt_proxy; extern long opt_proxy_type; extern bool use_syslog; diff --git a/util.c b/util.c index df84208..2824be3 100644 --- a/util.c +++ b/util.c @@ -314,6 +314,8 @@ json_t *json_rpc_call(CURL *curl, const char *url, if (opt_protocol) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_URL, url); + if (opt_cert) + curl_easy_setopt(curl, CURLOPT_CAINFO, opt_cert); curl_easy_setopt(curl, CURLOPT_ENCODING, ""); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);