diff --git a/src/etcp_connections.c b/src/etcp_connections.c index 367f7166..60b2c514 100644 --- a/src/etcp_connections.c +++ b/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); // 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); } else { DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "init_connections: successfully set peer public key for client %s", client->name); diff --git a/src/utun_instance.c b/src/utun_instance.c index 48b53c58..703f4a7e 100644 --- a/src/utun_instance.c +++ b/src/utun_instance.c @@ -633,7 +633,7 @@ struct UTUN_INSTANCE *utun_instance_reload(struct UTUN_INSTANCE *instance, struc if (!conn) { conn = etcp_connection_create(instance, nc->name); 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) { DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "Failed to generate session_id for client %s", nc->name); conn->session_id = 0; diff --git a/tests/test_etcp_crypto.c b/tests/test_etcp_crypto.c index 6e5d425b..053d8c78 100644 --- a/tests/test_etcp_crypto.c +++ b/tests/test_etcp_crypto.c @@ -37,8 +37,8 @@ int main() { } // 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(&server_ctx, (const char*)client_keys.public_key, 0); + sc_set_peer_public_key(&client_ctx, server_keys.public_key, 0); + sc_set_peer_public_key(&server_ctx, client_keys.public_key, 0); // Manual setup for test keys memcpy(client_ctx.peer_public_key, server_keys.public_key, SC_PUBKEY_SIZE);