aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--sand-leek.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 47e684f..aa3b243 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS += -O2 -finline-functions
+CFLAGS += -Wall -Wextra -O2 -finline-functions
LDFLAGS += -lssl -lcrypto -lpthread
all: sand-leek
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];