ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/crypto/handshake/common.h
Go to the documentation of this file.
1#pragma once
2
3/* Storage capacities in elements; text buffers include the terminating NUL. */
4#define CRYPTO_HANDSHAKE_COMMON_EXPECTED_SERVER_KEY_BUFFER_SIZE 256
5
8
14
15#include <stdint.h>
16#include <stdbool.h>
17#include <libplatform/socket.h>
18#include "../../crypto/crypto.h"
19#include "../../crypto/keys.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct acip_transport;
27
34
36#define AUTH_REQUIRE_PASSWORD 0x01
38#define AUTH_REQUIRE_CLIENT_KEY 0x02
39
41
58
136
144
154asciichat_error_t crypto_handshake_init(const char *name, crypto_handshake_context_t *ctx, bool is_server);
155
163
172
183asciichat_error_t crypto_handshake_init_with_password(const char *name, crypto_handshake_context_t *ctx, bool is_server, const char *password);
184
190
197
204
205#ifdef __cplusplus
206}
207#endif
208
Application limits and constraints.
unsigned short uint16_t
#define PLATFORM_MAX_PATH_LENGTH
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
#define HOSTNAME_BUFFER_SIZE
crypto_handshake_state_t
Cryptographic handshake state enumeration.
asciichat_error_t crypto_handshake_init(const char *name, crypto_handshake_context_t *ctx, bool is_server)
Initialize named crypto handshake context.
const crypto_context_t * crypto_handshake_get_context(const crypto_handshake_context_t *ctx)
Get the crypto context for encryption/decryption.
asciichat_error_t crypto_handshake_init_with_password(const char *name, crypto_handshake_context_t *ctx, bool is_server, const char *password)
Initialize named crypto handshake context with password authentication.
void crypto_handshake_destroy(crypto_handshake_context_t *ctx)
Cleanup crypto handshake context with secure memory wiping.
asciichat_error_t crypto_handshake_validate_packet_size(const crypto_handshake_context_t *ctx, uint16_t packet_type, size_t packet_size)
Validate crypto packet size based on session parameters.
bool crypto_handshake_is_ready(const crypto_handshake_context_t *ctx)
Check if handshake is complete and encryption is ready.
#define CRYPTO_HANDSHAKE_COMMON_EXPECTED_SERVER_KEY_BUFFER_SIZE
asciichat_error_t crypto_handshake_set_parameters(crypto_handshake_context_t *ctx, const crypto_parameters_packet_t *params)
Set crypto parameters from crypto_parameters_packet_t.
#define AUTH_CHALLENGE_SIZE
Challenge nonce size (32 bytes).
Definition sizes.h:103
#define GPG_FINGERPRINT_HEX_BUFFER_SIZE
Definition sizes.h:172
#define ED25519_PUBLIC_KEY_SIZE
Ed25519 public key size in bytes.
Definition sizes.h:37
#define PASSWORD_BUFFER_SIZE
Password input buffer size (256 bytes).
Definition sizes.h:162
Endpoint cryptographic state for handshake, packet protection, authentication, and rekeying.
Cryptographic handshake context structure.
bool allow_unlisted_client_identity
Require proof of key possession without whitelist membership (discovery).
Crypto parameters packet structure (Packet Type 15).
Definition packet.h:1056
Private identity-key material used for server authentication and signing.
Definition key_types.h:101
The normalized public identity used by ascii-chat's crypto and key-management code.
Definition key_types.h:76