Skip to content

Commit

Permalink
fix wrong type warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Oct 24, 2024
1 parent 5ea2f9a commit 49630c2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions deps/libscram/src/scram.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,15 @@ static bool calculate_client_proof(ScramState *scram_state,
&errstr) < 0 ||
scram_ClientKey(scram_state->SaltedPassword, PG_SHA256, SCRAM_KEY_LEN, ClientKey,
&errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute client key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute client key: %s", (const char*) errstr);
goto failed;
}
}

/* Hash it one more time, and compare with StoredKey */
if (scram_H(ClientKey, PG_SHA256, SCRAM_KEY_LEN,
StoredKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", (const char*) errstr);
goto failed;
}
/*
Expand Down Expand Up @@ -656,7 +656,7 @@ bool verify_server_signature(ScramState *scram_state, const PgCredentials *crede
memcpy(ServerKey, credentials->scram_ServerKey, SCRAM_KEY_LEN);
else {
if (scram_ServerKey(scram_state->SaltedPassword, PG_SHA256, SCRAM_KEY_LEN, ServerKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", (const char*) errstr);
goto failed;
}
}
Expand Down Expand Up @@ -907,17 +907,17 @@ static bool build_adhoc_scram_secret(const char *plain_password, ScramState *scr
scram_state->iterations,
salted_password, &errstr) < 0 ||
scram_ClientKey(salted_password, PG_SHA256, SCRAM_KEY_LEN, scram_state->StoredKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", (const char*) errstr);
goto failed;
}

if (scram_H(scram_state->StoredKey, PG_SHA256, SCRAM_KEY_LEN, scram_state->StoredKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", (const char*) errstr);
goto failed;
}

if (scram_ServerKey(salted_password, PG_SHA256, SCRAM_KEY_LEN, scram_state->ServerKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not calculate server key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not calculate server key: %s", (const char*) errstr);
goto failed;
}

Expand Down Expand Up @@ -1209,7 +1209,7 @@ bool verify_client_proof(ScramState *state, const char *ClientProof)

/* Hash it one more time, and compare with StoredKey */
if (scram_H(state->ClientKey, PG_SHA256, SCRAM_KEY_LEN, client_StoredKey, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not hash stored key: %s", (const char*) errstr);
goto failed;
}

Expand Down Expand Up @@ -1271,7 +1271,7 @@ bool scram_verify_plain_password(const char *username, const char *password,
/* Compute Server Key based on the user-supplied plaintext password */
if (scram_SaltedPassword(password, PG_SHA256, SCRAM_KEY_LEN, salt, saltlen, iterations, salted_password, &errstr) < 0 ||
scram_ServerKey(salted_password, PG_SHA256, SCRAM_KEY_LEN, computed_key, &errstr) < 0) {
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", *errstr);
snprintf(errorBuffer, MAX_ERROR_LENGTH, "could not compute server key: %s", (const char*) errstr);
goto failed;
}

Expand Down

0 comments on commit 49630c2

Please sign in to comment.