diff options
author | David Phillips <david@sighup.nz> | 2017-04-30 22:31:31 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-04-30 22:31:31 +1200 |
commit | 75e91631cf6e252b8ee2c5bf6aad5cfb9508a23f (patch) | |
tree | e0a25e6a3634082c474a211db6fd913e6450c7d7 | |
parent | 7db08baef7a5a8908bfc946229d2502a82b262c3 (diff) | |
parent | 726300aed61b2d00c433893a78d6497a828212ba (diff) | |
download | sand-leek-75e91631cf6e252b8ee2c5bf6aad5cfb9508a23f.tar.xz |
Merge remote-tracking branch 'alyptik/memleek'
-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; } |