diff --git a/groestl.c b/groestl.c index e827278..de736a0 100644 --- a/groestl.c +++ b/groestl.c @@ -17,7 +17,6 @@ void groestl_hash(const char* input, char* output, uint32_t len) sph_groestl512(&ctx_groestl, input, len); sph_groestl512_close(&ctx_groestl, hash1); - sph_groestl512_init(&ctx_groestl); sph_groestl512(&ctx_groestl, hash1, 64); sph_groestl512_close(&ctx_groestl, hash2); @@ -39,7 +38,7 @@ void groestl_myriad_hash(const char* input, char* output, uint32_t len) SHA256_CTX ctx_sha256; SHA256_Init(&ctx_sha256); SHA256_Update(&ctx_sha256, temp, 64); - SHA256_Final(output, &ctx_sha256); + SHA256_Final((unsigned char*) output, &ctx_sha256); free(temp); } diff --git a/quark.c b/quark.c index 498e08f..db85941 100644 --- a/quark.c +++ b/quark.c @@ -114,7 +114,6 @@ void quark_hash(const char* input, char* output, uint32_t len) sph_jh512_context ctx_jh; sph_keccak512_context ctx_keccak; sph_skein512_context ctx_skein; - static unsigned char pblank[1]; uint32_t mask = 8; uint32_t zero = 0; diff --git a/scrypt.c b/scrypt.c index 32139ff..cf71280 100644 --- a/scrypt.c +++ b/scrypt.c @@ -223,7 +223,7 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY) /* cpu and memory intensive function to transform a 80 byte buffer into a 32 byte output scratchpad size needs to be at least 63 + (128 * r * p) + (256 * r + 64) + (128 * r * N) bytes */ -void scrypt_1024_1_1_256_sp(const char* input, char* output, char* scratchpad, size_t len) +void scrypt_1024_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t len) { uint8_t * B; uint32_t * V; @@ -248,10 +248,10 @@ void scrypt_1024_1_1_256_sp(const char* input, char* output, char* scratchpad, s } /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ - PBKDF2_SHA256((const uint8_t*)input, 80, B, p * 128 * r, 1, (uint8_t*)output, 32); + PBKDF2_SHA256((const uint8_t*)input, len, B, p * 128 * r, 1, (uint8_t*)output, 32); } -void scrypt_1024_1_1_256(const char* input, char* output, size_t len) +void scrypt_1024_1_1_256(const char* input, char* output, uint32_t len) { char scratchpad[131583]; scrypt_1024_1_1_256_sp(input, output, scratchpad, len); diff --git a/scrypt.h b/scrypt.h index 1a4ed05..645fbab 100644 --- a/scrypt.h +++ b/scrypt.h @@ -1,10 +1,10 @@ #ifndef SCRYPT_H #define SCRYPT_H -#include +#include -void scrypt_1024_1_1_256(const char* input, char* output, size_t len); -void scrypt_1024_1_1_256_sp(const char* input, char* output, char* scratchpad, size_t len); +void scrypt_1024_1_1_256(const char* input, char* output, uint32_t len); +void scrypt_1024_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t len); #define scrypt_scratchpad_size 131583; #endif \ No newline at end of file diff --git a/scryptn.c b/scryptn.c index 9c89d1c..cef7fca 100644 --- a/scryptn.c +++ b/scryptn.c @@ -217,7 +217,7 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY) /* cpu and memory intensive function to transform a 80 byte buffer into a 32 byte output scratchpad size needs to be at least 63 + (128 * r * p) + (256 * r + 64) + (128 * r * N) bytes */ -void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N, size_t len) +void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N, uint32_t len) { uint8_t * B; uint32_t * V; @@ -242,10 +242,10 @@ void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint } /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ - PBKDF2_SHA256((const uint8_t*)input, 80, B, p * 128 * r, 1, (uint8_t*)output, 32); + PBKDF2_SHA256((const uint8_t*)input, len, B, p * 128 * r, 1, (uint8_t*)output, 32); } -void scrypt_N_1_1_256(const char* input, char* output, uint32_t N, size_t len) +void scrypt_N_1_1_256(const char* input, char* output, uint32_t N, uint32_t len) { //char scratchpad[131583]; char *scratchpad; diff --git a/scryptn.h b/scryptn.h index 3e754fa..3357b95 100644 --- a/scryptn.h +++ b/scryptn.h @@ -5,8 +5,8 @@ extern "C" { #endif -void scrypt_N_1_1_256(const char* input, char* output, uint32_t N, size_t len); -void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N, size_t len); +void scrypt_N_1_1_256(const char* input, char* output, uint32_t N, uint32_t len); +void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N, uint32_t len); //const int scrypt_scratchpad_size = 131583; #ifdef __cplusplus diff --git a/sha256.h b/sha256.h index ddb4ba6..5858f65 100644 --- a/sha256.h +++ b/sha256.h @@ -437,4 +437,4 @@ PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt, /* Clean PShctx, since we never called _Final on it. */ memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX)); } -#endif \ No newline at end of file +#endif diff --git a/sha3/sph_groestl.c b/sha3/sph_groestl.c index 928bc41..91f75d3 100644 --- a/sha3/sph_groestl.c +++ b/sha3/sph_groestl.c @@ -2813,7 +2813,6 @@ static void groestl_small_close(sph_groestl_small_context *sc, unsigned ub, unsigned n, void *dst, size_t out_len) { - unsigned char *buf; unsigned char pad[72]; size_t u, ptr, pad_len; #if SPH_64 @@ -2824,7 +2823,6 @@ groestl_small_close(sph_groestl_small_context *sc, unsigned z; DECL_STATE_SMALL - buf = sc->buf; ptr = sc->ptr; z = 0x80 >> n; pad[0] = ((ub & -z) | z) & 0xFF; @@ -2949,7 +2947,6 @@ static void groestl_big_close(sph_groestl_big_context *sc, unsigned ub, unsigned n, void *dst, size_t out_len) { - unsigned char *buf; unsigned char pad[136]; size_t ptr, pad_len, u; #if SPH_64 @@ -2960,7 +2957,6 @@ groestl_big_close(sph_groestl_big_context *sc, unsigned z; DECL_STATE_BIG - buf = sc->buf; ptr = sc->ptr; z = 0x80 >> n; pad[0] = ((ub & -z) | z) & 0xFF; diff --git a/skein.c b/skein.c index 38fba74..4676a87 100644 --- a/skein.c +++ b/skein.c @@ -21,7 +21,7 @@ void skein_hash(const char* input, char* output, uint32_t len) SHA256_CTX ctx_sha256; SHA256_Init(&ctx_sha256); SHA256_Update(&ctx_sha256, temp, 64); - SHA256_Final(output, &ctx_sha256); + SHA256_Final((unsigned char*) output, &ctx_sha256); free(temp); }