mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
Remove unused OpenSSL dependency.
Also, turn a few strings into #define'd constants.
This commit is contained in:
parent
23cd22a5a5
commit
a614823fa7
@ -7,5 +7,5 @@ EXTRA_DIST = sha256_generic.c
|
|||||||
|
|
||||||
minerd_SOURCES = cpu-miner.c
|
minerd_SOURCES = cpu-miner.c
|
||||||
minerd_LDFLAGS = -pthread
|
minerd_LDFLAGS = -pthread
|
||||||
minerd_LDADD = @CRYPTO_LIBS@ @LIBCURL@ @JANSSON_LIBS@
|
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@
|
||||||
|
|
||||||
|
1
README
1
README
@ -6,7 +6,6 @@ License: GPLv2. See COPYING for details.
|
|||||||
Dependencies:
|
Dependencies:
|
||||||
libcurl http://curl.haxx.se/libcurl/
|
libcurl http://curl.haxx.se/libcurl/
|
||||||
jansson http://www.digip.org/jansson/
|
jansson http://www.digip.org/jansson/
|
||||||
OpenSSL libcrypto http://www.openssl.org/
|
|
||||||
|
|
||||||
Basic build instructions:
|
Basic build instructions:
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
@ -16,7 +16,6 @@ AM_PROG_CC_C_O
|
|||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
AC_CHECK_LIB(crypto, MD5_Init, CRYPTO_LIBS=-lcrypto)
|
|
||||||
AC_CHECK_LIB(jansson, json_loads, JANSSON_LIBS=-ljansson)
|
AC_CHECK_LIB(jansson, json_loads, JANSSON_LIBS=-ljansson)
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG()
|
PKG_PROG_PKG_CONFIG()
|
||||||
@ -24,7 +23,6 @@ PKG_PROG_PKG_CONFIG()
|
|||||||
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
|
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
|
||||||
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
[AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
|
||||||
|
|
||||||
AC_SUBST(CRYPTO_LIBS)
|
|
||||||
AC_SUBST(JANSSON_LIBS)
|
AC_SUBST(JANSSON_LIBS)
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
|
21
cpu-miner.c
21
cpu-miner.c
@ -21,9 +21,10 @@
|
|||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <openssl/bn.h>
|
|
||||||
|
|
||||||
#define PROGRAM_NAME "minerd"
|
#define PROGRAM_NAME "minerd"
|
||||||
|
#define DEF_RPC_URL "http://127.0.0.1:8332/"
|
||||||
|
#define DEF_RPC_USERPASS "rpcuser:rpcpass"
|
||||||
|
|
||||||
#include "sha256_generic.c"
|
#include "sha256_generic.c"
|
||||||
|
|
||||||
@ -39,8 +40,8 @@ static const bool opt_time = true;
|
|||||||
static int opt_n_threads = 1;
|
static int opt_n_threads = 1;
|
||||||
static pthread_mutex_t stats_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t stats_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static uint64_t hash_ctr;
|
static uint64_t hash_ctr;
|
||||||
static char *rpc_url = "http://127.0.0.1:8332/";
|
static char *rpc_url = DEF_RPC_URL;
|
||||||
static char *userpass = "rpcuser:rpcpass";
|
static char *userpass = DEF_RPC_USERPASS;
|
||||||
|
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
@ -55,11 +56,11 @@ static struct argp_option options[] = {
|
|||||||
|
|
||||||
{ "url", 1001, "URL", 0,
|
{ "url", 1001, "URL", 0,
|
||||||
"URL for bitcoin JSON-RPC server "
|
"URL for bitcoin JSON-RPC server "
|
||||||
"(default: http://127.0.0.1:8332/)" },
|
"(default: " DEF_RPC_URL ")" },
|
||||||
|
|
||||||
{ "userpass", 1002, "USER:PASS", 0,
|
{ "userpass", 1002, "USER:PASS", 0,
|
||||||
"Username:Password pair for bitcoin JSON-RPC server "
|
"Username:Password pair for bitcoin JSON-RPC server "
|
||||||
"(default: rpcuser:rpcpass)" },
|
"(default: " DEF_RPC_USERPASS ")" },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ struct work {
|
|||||||
unsigned char data[128];
|
unsigned char data[128];
|
||||||
unsigned char hash[32];
|
unsigned char hash[32];
|
||||||
unsigned char hash1[64];
|
unsigned char hash1[64];
|
||||||
BIGNUM *target;
|
unsigned char target[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void databuf_free(struct data_buffer *db)
|
static void databuf_free(struct data_buffer *db)
|
||||||
@ -286,9 +287,6 @@ static void work_free(struct work *work)
|
|||||||
if (!work)
|
if (!work)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (work->target)
|
|
||||||
BN_free(work->target);
|
|
||||||
|
|
||||||
free(work);
|
free(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,8 +314,7 @@ static struct work *work_decode(const json_t *val)
|
|||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BN_hex2bn(&work->target,
|
if (!jobj_binary(val, "target", work->target, sizeof(work->target))) {
|
||||||
json_string_value(json_object_get(val, "target")))) {
|
|
||||||
fprintf(stderr, "JSON inval target\n");
|
fprintf(stderr, "JSON inval target\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user