2
0
Fork 0
mirror of https://git.sr.ht/~sircmpwn/mkproof synced 2024-06-03 11:36:12 +02:00

some remaining C99isms

This commit is contained in:
Samuel Neves 2016-10-06 17:06:22 +01:00
parent 5c430d095e
commit bc17be309b
2 changed files with 5 additions and 3 deletions

View File

@ -184,6 +184,7 @@ int main(int argc, char *argv[]) {
/* Get and check Argon2 type */
const char *type_str = (argc > 1) ? argv[1] : "i";
argon2_type type = Argon2_i;
uint32_t version = ARGON2_VERSION_NUMBER;
if (!strcmp(type_str, "d")) {
type = Argon2_d;
} else if (!strcmp(type_str, "i")) {
@ -195,7 +196,6 @@ int main(int argc, char *argv[]) {
}
/* Get and check Argon2 version number */
uint32_t version = ARGON2_VERSION_NUMBER;
if (argc > 2) {
version = strtoul(argv[2], NULL, 10);
}

View File

@ -92,6 +92,8 @@ static void run(uint32_t outlen, char *pwd, char *salt, uint32_t t_cost,
clock_t start_time, stop_time;
size_t pwdlen, saltlen, encodedlen;
int result;
unsigned char * out = NULL;
char * encoded = NULL;
start_time = clock();
@ -112,14 +114,14 @@ static void run(uint32_t outlen, char *pwd, char *salt, uint32_t t_cost,
UNUSED_PARAMETER(lanes);
unsigned char* out = malloc(outlen + 1);
out = malloc(outlen + 1);
if (!out) {
secure_wipe_memory(pwd, strlen(pwd));
fatal("could not allocate memory for output");
}
encodedlen = argon2_encodedlen(t_cost, m_cost, lanes, (uint32_t)saltlen, outlen, type);
char* encoded = malloc(encodedlen + 1);
encoded = malloc(encodedlen + 1);
if (!encoded) {
secure_wipe_memory(pwd, strlen(pwd));
fatal("could not allocate memory for hash");