aboutsummaryrefslogtreecommitdiff
path: root/sand-leek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sand-leek.c')
-rw-r--r--sand-leek.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sand-leek.c b/sand-leek.c
index f845054..e72a0d6 100644
--- a/sand-leek.c
+++ b/sand-leek.c
@@ -115,11 +115,12 @@ work(void *arg) {
unsigned long volatile *kilo_hashes = arg;
unsigned long hashes = 0;
BIGNUM *bignum_e = NULL;
+ RSA *rsa_key = NULL;
SHA_CTX sha_c;
SHA_CTX working_sha_c;
int sem_val = 0;
- RSA *rsa_key = RSA_new();
+ rsa_key = RSA_new();
if (!rsa_key) {
fprintf(stderr, "Failed to allocate RSA key\n");
goto STOP;
@@ -240,6 +241,7 @@ main(int argc, char **argv) {
size_t offset = 0;
pthread_t *workers = NULL;
unsigned long volatile *khash_count = NULL;
+ unsigned long khashes = 0;
while ((opt = getopt(argc, argv, "t:s:")) != -1) {
switch (opt) {
@@ -296,9 +298,9 @@ main(int argc, char **argv) {
/* workers started; wait on one to finish */
loops = 0;
while (sem_trywait(&working) && errno == EAGAIN) {
- unsigned long khashes = 0;
sleep(1);
loops++;
+ khashes = 0;
/* approximate hashes per second */
for (i = 0; i < thread_count; i++) {
khashes += khash_count[i];