diff options
Diffstat (limited to 'sand-leek.c')
-rw-r--r-- | sand-leek.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sand-leek.c b/sand-leek.c index e66b91a..e72a0d6 100644 --- a/sand-leek.c +++ b/sand-leek.c @@ -6,6 +6,7 @@ #include <semaphore.h> #include <errno.h> #include <string.h> +#include <endian.h> #include <openssl/bn.h> #include <openssl/rsa.h> #include <openssl/sha.h> @@ -83,6 +84,14 @@ key_update_d(RSA *rsa_key) { BN_mod(true_dmp1, true_d, p1, bn_ctx); BN_mod(true_dmq1, true_d, q1, bn_ctx); + /* cleanup BN structs not managed by RSA internal functions */ + BN_clear_free(gcd); + BN_clear_free(p1); + BN_clear_free(q1); + BN_clear_free(p1q1); + BN_clear_free(lambda_n); + BN_CTX_free(bn_ctx); + if (!RSA_set0_key(rsa_key, NULL, NULL, true_d)) { fprintf(stderr, "setting d failed\n"); return 1; @@ -102,7 +111,7 @@ work(void *arg) { unsigned int e_big_endian = 0; unsigned char *der_data = NULL; unsigned char *tmp_data = NULL; - size_t der_length = 0; + ssize_t der_length = 0; unsigned long volatile *kilo_hashes = arg; unsigned long hashes = 0; BIGNUM *bignum_e = NULL; @@ -273,6 +282,7 @@ main(int argc, char **argv) { khash_count = calloc(thread_count, sizeof(unsigned long)); if (!khash_count) { perror("hash count array calloc"); + free(workers); return 1; } |