aboutsummaryrefslogtreecommitdiff
path: root/sha256_cryptopp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha256_cryptopp.c')
-rw-r--r--sha256_cryptopp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sha256_cryptopp.c b/sha256_cryptopp.c
index f5f8900..76e178c 100644
--- a/sha256_cryptopp.c
+++ b/sha256_cryptopp.c
@@ -91,7 +91,8 @@ static void runhash(void *state, const void *input, const void *init)
}
/* suspiciously similar to ScanHash* from bitcoin */
-bool scanhash_cryptopp(const unsigned char *midstate, unsigned char *data,
+bool scanhash_cryptopp(int thr_id, const unsigned char *midstate,
+ unsigned char *data,
unsigned char *hash1, unsigned char *hash,
const unsigned char *target,
uint32_t max_nonce, unsigned long *hashes_done)
@@ -101,6 +102,8 @@ bool scanhash_cryptopp(const unsigned char *midstate, unsigned char *data,
uint32_t n = 0;
unsigned long stat_ctr = 0;
+ work_restart[thr_id].restart = 0;
+
while (1) {
n++;
*nonce = n;
@@ -115,7 +118,7 @@ bool scanhash_cryptopp(const unsigned char *midstate, unsigned char *data,
return true;
}
- if (n >= max_nonce) {
+ if ((n >= max_nonce) || work_restart[thr_id].restart) {
*hashes_done = stat_ctr;
return false;
}
@@ -573,7 +576,8 @@ static void runhash32(void *state, const void *input, const void *init)
}
/* suspiciously similar to ScanHash* from bitcoin */
-bool scanhash_asm32(const unsigned char *midstate, unsigned char *data,
+bool scanhash_asm32(int thr_id, const unsigned char *midstate,
+ unsigned char *data,
unsigned char *hash1, unsigned char *hash,
const unsigned char *target,
uint32_t max_nonce, unsigned long *hashes_done)
@@ -583,6 +587,8 @@ bool scanhash_asm32(const unsigned char *midstate, unsigned char *data,
uint32_t n = 0;
unsigned long stat_ctr = 0;
+ work_restart[thr_id].restart = 0;
+
while (1) {
n++;
*nonce = n;
@@ -599,7 +605,7 @@ bool scanhash_asm32(const unsigned char *midstate, unsigned char *data,
return true;
}
- if (n >= max_nonce) {
+ if ((n >= max_nonce) || work_restart[thr_id].restart) {
if (opt_debug)
fprintf(stderr, "DBG: end of nonce range\n");
*hashes_done = stat_ctr;