Browse Source

fix remaining pointer-sign warnings in sc_set_peer_public_key callers

congestion
Evgeny 5 months ago
parent
commit
17e95cc2a3
  1. 2
      src/etcp_connections.c
  2. 2
      src/utun_instance.c
  3. 4
      tests/test_etcp_crypto.c

2
src/etcp_connections.c

@ -2046,7 +2046,7 @@ int init_connections(struct UTUN_INSTANCE* instance) {
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "init_connections: setting peer public key for client %s", client->name); DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "init_connections: setting peer public key for client %s", client->name);
// Set peer public key (assuming hex format) // Set peer public key (assuming hex format)
if (sc_set_peer_public_key(&etcp_conn->crypto_ctx, client->peer_public_key_hex, 1) != SC_OK) { if (sc_set_peer_public_key(&etcp_conn->crypto_ctx, (const uint8_t*)client->peer_public_key_hex, 1) != SC_OK) {
DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "init_connections: failed to set peer public key for client %s", client->name); DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "init_connections: failed to set peer public key for client %s", client->name);
} else { } else {
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "init_connections: successfully set peer public key for client %s", client->name); DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "init_connections: successfully set peer public key for client %s", client->name);

2
src/utun_instance.c

@ -633,7 +633,7 @@ struct UTUN_INSTANCE *utun_instance_reload(struct UTUN_INSTANCE *instance, struc
if (!conn) { if (!conn) {
conn = etcp_connection_create(instance, nc->name); conn = etcp_connection_create(instance, nc->name);
if (conn) { if (conn) {
sc_set_peer_public_key(&conn->crypto_ctx, nc->peer_public_key_hex, 1); sc_set_peer_public_key(&conn->crypto_ctx, (const uint8_t*)nc->peer_public_key_hex, 1);
if (random_bytes((uint8_t*)&conn->session_id, sizeof(conn->session_id)) != 0) { if (random_bytes((uint8_t*)&conn->session_id, sizeof(conn->session_id)) != 0) {
DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "Failed to generate session_id for client %s", nc->name); DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "Failed to generate session_id for client %s", nc->name);
conn->session_id = 0; conn->session_id = 0;

4
tests/test_etcp_crypto.c

@ -37,8 +37,8 @@ int main() {
} }
// Initialize ECC system (may fail with test keys, but needed for RNG) // Initialize ECC system (may fail with test keys, but needed for RNG)
sc_set_peer_public_key(&client_ctx, (const char*)server_keys.public_key, 0); sc_set_peer_public_key(&client_ctx, server_keys.public_key, 0);
sc_set_peer_public_key(&server_ctx, (const char*)client_keys.public_key, 0); sc_set_peer_public_key(&server_ctx, client_keys.public_key, 0);
// Manual setup for test keys // Manual setup for test keys
memcpy(client_ctx.peer_public_key, server_keys.public_key, SC_PUBKEY_SIZE); memcpy(client_ctx.peer_public_key, server_keys.public_key, SC_PUBKEY_SIZE);

Loading…
Cancel
Save