enabled more warnings

This commit is contained in:
2025-11-09 18:39:50 +05:00
parent b662a85348
commit 083b247329
7 changed files with 21 additions and 9 deletions

View File

@@ -29,12 +29,12 @@ Result(void) ClientCredentials_tryConstruct(ClientCredentials* cred,
// lvl 1 hash - is used as AES key for user data
cred->user_data_key = Array_alloc(u8, PASSWORD_HASH_SIZE);
hash_password(List_castTo_Array(data_to_hash), cred->user_data_key.data, __PASSWORD_HASH_LVL_ROUNDS);
hash_password(List_castTo_Array(data_to_hash), cred->user_data_key.data, PASSWORD_HASH_LVL_ROUNDS);
// concat lvl 1 hash to data_to_hash
List_push_size(&data_to_hash, cred->user_data_key.data, cred->user_data_key.size);
// lvl 2 hash - is used for authentification
cred->token = Array_alloc(u8, PASSWORD_HASH_SIZE);
hash_password(List_castTo_Array(data_to_hash), cred->token.data, __PASSWORD_HASH_LVL_ROUNDS);
hash_password(List_castTo_Array(data_to_hash), cred->token.data, PASSWORD_HASH_LVL_ROUNDS);
AESBlockEncryptor_construct(&cred->user_data_aes_enc, cred->user_data_key, AESBlockEncryptor_DEFAULT_CLASS);
AESBlockDecryptor_construct(&cred->user_data_aes_dec, cred->user_data_key, AESBlockDecryptor_DEFAULT_CLASS);

View File

@@ -41,7 +41,7 @@ Result(void) ServerLink_parse(cstr server_link_cstr, EndpointIPv4* server_end_ou
Return RESULT_VOID;
}
Result(ServerConnection*) ServerConnection_open(ClientCredentials* client_credentials, cstr server_link_cstr){
Result(ServerConnection*) ServerConnection_open(cstr server_link_cstr){
Deferral(16);
ServerConnection* conn = (ServerConnection*)malloc(sizeof(ServerConnection));

View File

@@ -25,6 +25,8 @@ Result(void) Client_createFromConfig(cstr config_path){
bool success = false;
Defer(if(!success) Client_free(client));
(void)config_path;
success = true;
Return RESULT_VALUE(p, client);
}
@@ -152,7 +154,7 @@ static Result(void) commandExec(Client* client, str command, bool* stop){
printf("connecting to server...\n");
try(client->server_connection, p,
ServerConnection_open(&client->cred, new_server_link.data));
ServerConnection_open(new_server_link.data));
printf("connection established\n");
// TODO: request server info

View File

@@ -28,8 +28,7 @@ typedef struct ServerConnection {
EncryptedSocketTCP sock;
} ServerConnection;
Result(ServerConnection*) ServerConnection_open(ClientCredentials* client_credentials,
cstr server_link_cstr);
Result(ServerConnection*) ServerConnection_open(cstr server_link_cstr);
void ServerConnection_close(ServerConnection* conn);

View File

@@ -4,6 +4,8 @@ Result(char*) __sendErrorMessage(ClientConnection* conn, PacketHeader* req_head,
u32 msg_buf_size, cstr format, va_list argv)
{
Deferral(4);
(void)req_head;
//TODO: limit ErrorMessage size to fit into EncryptedSocketTCP.internal_buffer_size
Array(u8) err_buf = Array_alloc(u8, msg_buf_size);
bool err_complete = false;