ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
client/crypto.h
Go to the documentation of this file.
1
13#pragma once
14
15#include <stdint.h>
16#include <stdbool.h>
17#include <stddef.h>
18
19#include <ascii-chat/crypto/crypto.h>
20#include <ascii-chat/platform/socket.h>
21
32void client_crypto_set_mode(uint8_t mode);
33
44int client_crypto_init(void);
45
58
66bool crypto_client_is_ready(void);
67
75const crypto_context_t *crypto_client_get_context(void);
76
89int crypto_client_encrypt_packet(const uint8_t *plaintext, size_t plaintext_len, uint8_t *ciphertext,
90 size_t ciphertext_size, size_t *ciphertext_len);
91
104int crypto_client_decrypt_packet(const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *plaintext,
105 size_t plaintext_size, size_t *plaintext_len);
106
112void crypto_client_cleanup(void);
113
122
131
141int crypto_client_process_rekey_request(const uint8_t *packet, size_t packet_len);
142
151
161int crypto_client_process_rekey_response(const uint8_t *packet, size_t packet_len);
162
const crypto_context_t * crypto_client_get_context(void)
Get crypto context for encryption/decryption.
bool crypto_client_should_rekey(void)
Check if session rekeying should be triggered.
void crypto_client_cleanup(void)
Cleanup crypto client resources.
int crypto_client_send_rekey_response(void)
Send REKEY_RESPONSE packet to server.
int crypto_client_initiate_rekey(void)
Initiate session rekeying (client-initiated)
void client_crypto_set_mode(uint8_t mode)
Set crypto mode for handshake (encryption + authentication)
int client_crypto_init(void)
Initialize client crypto handshake.
int crypto_client_encrypt_packet(const uint8_t *plaintext, size_t plaintext_len, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_len)
Encrypt a packet for transmission.
int client_crypto_handshake(socket_t socket)
Perform crypto handshake with server.
int crypto_client_decrypt_packet(const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_len)
Decrypt a received packet.
bool crypto_client_is_ready(void)
Check if crypto handshake is ready.
int crypto_client_process_rekey_request(const uint8_t *packet, size_t packet_len)
Process received REKEY_REQUEST packet from server.
int crypto_client_process_rekey_response(const uint8_t *packet, size_t packet_len)
Process received REKEY_RESPONSE packet from server.
int crypto_client_send_rekey_complete(void)
Send REKEY_COMPLETE packet to server and commit to new key.
int socket_t