ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
common.c File Reference

Common handshake functions: initialization, cleanup, encryption, rekeying. More...

Go to the source code of this file.

Macros

#define HANDSHAKE_ERROR_PLAINTEXT_CAPACITY   256

Functions

asciichat_error_t crypto_handshake_init (const char *name, crypto_handshake_context_t *ctx, bool is_server)
 Initialize named crypto handshake context.
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.
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.
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.
bool crypto_handshake_is_ready (const crypto_handshake_context_t *ctx)
 Check if handshake is complete and encryption is ready.
const crypto_context_t * crypto_handshake_get_context (const crypto_handshake_context_t *ctx)
 Get the crypto context for encryption/decryption.

Detailed Description

Common handshake functions: initialization, cleanup, encryption, rekeying.

Definition in file crypto/handshake/common.c.

Macro Definition Documentation

◆ HANDSHAKE_ERROR_PLAINTEXT_CAPACITY

#define HANDSHAKE_ERROR_PLAINTEXT_CAPACITY   256

Definition at line 3 of file crypto/handshake/common.c.

Function Documentation

◆ crypto_handshake_destroy()

void crypto_handshake_destroy ( crypto_handshake_context_t * ctx)

Cleanup crypto handshake context with secure memory wiping.

Parameters
ctxHandshake context to cleanup

Definition at line 271 of file crypto/handshake/common.c.

271 {
272 if (!ctx)
273 return;
274
275 // Cleanup core crypto context
277
278 // Zero out sensitive data
279 sodium_memzero(ctx, sizeof(crypto_handshake_context_t));
280}
void crypto_destroy(crypto_context_t *ctx)
Cleanup crypto context with secure memory wiping.
Cryptographic handshake context structure.

References crypto_handshake_context_t::crypto_ctx, and crypto_destroy().

Referenced by acip_security_cleanup(), browser_client_cleanup(), browser_client_generate_keypair(), client_cleanup(), client_generate_keypair(), client_handle_crypto_parameters(), and client_handle_key_exchange_init().

◆ crypto_handshake_get_context()

const crypto_context_t * crypto_handshake_get_context ( const crypto_handshake_context_t * ctx)

Get the crypto context for encryption/decryption.

Parameters
ctxHandshake context
Returns
Pointer to crypto context, or NULL if ctx is NULL

Definition at line 290 of file crypto/handshake/common.c.

290 {
291 if (!ctx || !crypto_handshake_is_ready(ctx))
292 return NULL;
293 return &ctx->crypto_ctx;
294}
bool crypto_handshake_is_ready(const crypto_handshake_context_t *ctx)
Check if handshake is complete and encryption is ready.

References crypto_handshake_context_t::crypto_ctx, and crypto_handshake_is_ready().

◆ crypto_handshake_init()

asciichat_error_t crypto_handshake_init ( const char * name,
crypto_handshake_context_t * ctx,
bool is_server )

Initialize named crypto handshake context.

Parameters
nameDebug name for the crypto context (typically "crypto_client_<id>")
ctxHandshake context to initialize (must not be NULL)
is_serverTrue if this is the server side, false for client
Returns
ASCIICHAT_OK on success, error code on failure

The context is automatically registered with the debug naming system.

Definition at line 25 of file crypto/handshake/common.c.

25 {
26 if (!name) {
27 return SET_ERRNO(ERROR_INVALID_PARAM, "Crypto context name is required");
28 }
29
30 if (!ctx) {
31 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid parameters: ctx=%p", ctx);
32 }
33
34 // Register crypto context with debug naming system
35 NAMED_REGISTER_CRYPTO_CONTEXT(ctx, name, NULL);
36
37 // Zero out the context
38 memset(ctx, 0, sizeof(crypto_handshake_context_t));
39
40 // Initialize core crypto context
42 if (result != CRYPTO_OK) {
43 return SET_ERRNO(ERROR_CRYPTO, "Failed to initialize crypto context: %s", crypto_result_to_string(result));
44 }
45
47 ctx->is_server = is_server;
48 ctx->crypto_ctx.server_role = is_server;
49 ctx->crypto_ctx.server_role_known = true;
50 ctx->verify_server_key = false;
51 ctx->require_client_auth = false;
52 ctx->server_uses_client_auth = false; // Set to true only if authenticated packet received
53
54 // Load server keys if this is a server
55 if (is_server) {
56 log_dev("Server crypto handshake initialized (ephemeral keys)");
57 } else {
58 log_dev("Client crypto handshake initialized");
59 }
60
61 return ASCIICHAT_OK;
62}
#define SET_ERRNO(code,...)
crypto_result_t crypto_init(crypto_context_t *ctx)
Initialize libsodium and crypto context.
const char * crypto_result_to_string(crypto_result_t result)
Convert crypto result to human-readable string.
crypto_result_t
Cryptographic operation result codes.
#define NAMED_REGISTER_CRYPTO_CONTEXT(ctx, name, parent_ptr)
Register a crypto context with automatic format specifier.
@ ASCIICHAT_OK
Definition error_codes.h:50
@ ERROR_CRYPTO
Definition error_codes.h:97
@ ERROR_INVALID_PARAM
#define log_dev(...)
Log a DEV message (most verbose, development only).
Definition log/log.h:575

References ASCIICHAT_OK, crypto_handshake_context_t::crypto_ctx, CRYPTO_HANDSHAKE_INIT, crypto_init(), CRYPTO_OK, crypto_result_to_string(), ERROR_CRYPTO, ERROR_INVALID_PARAM, crypto_handshake_context_t::is_server, log_dev, NAMED_REGISTER_CRYPTO_CONTEXT, crypto_handshake_context_t::require_client_auth, crypto_context_t::server_role, crypto_context_t::server_role_known, crypto_handshake_context_t::server_uses_client_auth, SET_ERRNO, crypto_handshake_context_t::state, and crypto_handshake_context_t::verify_server_key.

Referenced by acip_security_init_options(), browser_client_generate_keypair(), browser_session_create(), client_generate_keypair(), client_handle_crypto_parameters(), client_handle_key_exchange_init(), and discovery_session_start().

◆ crypto_handshake_init_with_password()

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.

Parameters
nameDebug name for the crypto context (typically "crypto_client_<id>")
ctxHandshake context to initialize (must not be NULL)
is_serverTrue if this is the server side, false for client
passwordPassword for authentication (must meet length requirements)
Returns
ASCIICHAT_OK on success, error code on failure

The context is automatically registered with the debug naming system.

Definition at line 234 of file crypto/handshake/common.c.

234 {
235 if (!name) {
236 return SET_ERRNO(ERROR_INVALID_PARAM, "Crypto context name is required");
237 }
238
239 if (!ctx || !password) {
240 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid parameters: ctx=%p, password=%p", ctx, password);
241 }
242
243 // Register crypto context with debug naming system
244 NAMED_REGISTER_CRYPTO_CONTEXT(ctx, name, NULL);
245
246 // Zero out the context
247 memset(ctx, 0, sizeof(crypto_handshake_context_t));
248
249 // Initialize core crypto context with password
250 crypto_result_t result = crypto_init_with_password(&ctx->crypto_ctx, password);
251 if (result != CRYPTO_OK) {
252 return SET_ERRNO(ERROR_CRYPTO, "Failed to initialize crypto context with password: %s", crypto_result_to_string(result));
253 }
254
256 ctx->is_server = is_server;
257 ctx->crypto_ctx.server_role = is_server;
258 ctx->crypto_ctx.server_role_known = true;
259 ctx->verify_server_key = false;
260 ctx->require_client_auth = false;
261 ctx->server_uses_client_auth = false; // Set to true only if authenticated packet received
262 ctx->has_password = true;
263
264 // Store password temporarily (will be cleared after key derivation)
265 SAFE_STRNCPY(ctx->password, password, sizeof(ctx->password) - 1);
266
267 return ASCIICHAT_OK;
268}
#define SAFE_STRNCPY(dst, src, size)
crypto_result_t crypto_init_with_password(crypto_context_t *ctx, const char *password)
Initialize with password-based encryption.

References ASCIICHAT_OK, crypto_handshake_context_t::crypto_ctx, CRYPTO_HANDSHAKE_INIT, crypto_init_with_password(), CRYPTO_OK, crypto_result_to_string(), ERROR_CRYPTO, ERROR_INVALID_PARAM, crypto_handshake_context_t::has_password, crypto_handshake_context_t::is_server, NAMED_REGISTER_CRYPTO_CONTEXT, crypto_handshake_context_t::password, crypto_handshake_context_t::require_client_auth, SAFE_STRNCPY, crypto_context_t::server_role, crypto_context_t::server_role_known, crypto_handshake_context_t::server_uses_client_auth, SET_ERRNO, crypto_handshake_context_t::state, and crypto_handshake_context_t::verify_server_key.

Referenced by acip_security_init_options(), and browser_session_create().

◆ crypto_handshake_is_ready()

bool crypto_handshake_is_ready ( const crypto_handshake_context_t * ctx)

Check if handshake is complete and encryption is ready.

Parameters
ctxHandshake context
Returns
true if handshake is complete and encryption is ready, false otherwise

Definition at line 283 of file crypto/handshake/common.c.

283 {
284 if (!ctx)
285 return false;
287}
bool crypto_is_ready(const crypto_context_t *ctx)
Check if key exchange is complete and ready for encryption.

References crypto_handshake_context_t::crypto_ctx, CRYPTO_HANDSHAKE_READY, crypto_is_ready(), and crypto_handshake_context_t::state.

Referenced by crypto_handshake_get_context().

◆ crypto_handshake_set_parameters()

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.

Parameters
ctxHandshake context
paramsNegotiated crypto parameters (from capabilities negotiation)
Returns
ASCIICHAT_OK on success, error code on failure

Definition at line 65 of file crypto/handshake/common.c.

65 {
66 if (!ctx || !params) {
67 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid parameters: ctx=%p, params=%p", ctx, params);
68 }
69
71
72 // Client receives network byte order and must convert
73 // Server uses host byte order and must NOT convert
74 if (ctx->is_server) {
75 // Server: values are already in host byte order
76 // Update crypto context with negotiated parameters directly
81 } else {
82 ctx->require_client_auth = params->verification_enabled != 0;
83 // Client: convert from network byte order
84 // Update crypto context with negotiated parameters directly
89 }
90 // Update crypto context with negotiated parameters directly
91 ctx->crypto_ctx.nonce_size = params->nonce_size;
92 ctx->crypto_ctx.mac_size = params->mac_size;
93 ctx->crypto_ctx.hmac_size = params->hmac_size;
94 ctx->crypto_ctx.auth_challenge_size = AUTH_CHALLENGE_SIZE; // Auth challenge size is fixed for now, could be negotiated later
95 ctx->crypto_ctx.encryption_key_size = (uint8_t)ctx->crypto_ctx.shared_key_size; // Use shared key size as encryption key size
96 ctx->crypto_ctx.private_key_size = ctx->crypto_ctx.public_key_size; // Same as public key for X25519
97 ctx->crypto_ctx.salt_size = ARGON2ID_SALT_SIZE; // Salt size doesn't change
98
99 log_debug("Crypto parameters set: kex_key=%u, auth_key=%u, sig=%u, "
100 "secret=%u, nonce=%u, mac=%u, hmac=%u",
103
104 return ASCIICHAT_OK;
105}
#define NET_TO_HOST_U16(val)
Definition endian.h:115
unsigned char uint8_t
#define log_debug(...)
Log a DEBUG message.
Definition log/log.h:589
#define CIPHER_ALGO_NONE
No encryption (plaintext mode).
Definition packet.h:1143
#define AUTH_CHALLENGE_SIZE
Challenge nonce size (32 bytes).
Definition sizes.h:103
#define ARGON2ID_SALT_SIZE
Argon2id salt size in bytes.
Definition sizes.h:51
uint8_t hmac_size
HMAC size in bytes (e.g., 32 for HMAC-SHA256).
Definition packet.h:1078
uint8_t selected_cipher
Selected cipher algorithm (CIPHER_ALGO_*).
Definition packet.h:1062
uint16_t auth_public_key_size
Authentication public key size in bytes (e.g., 32 for Ed25519, 1952 for Dilithium3).
Definition packet.h:1068
uint8_t verification_enabled
Server verification enabled flag (1=enabled, 0=disabled).
Definition packet.h:1064
uint16_t signature_size
Signature size in bytes (e.g., 64 for Ed25519, 3309 for Dilithium3).
Definition packet.h:1070
uint8_t nonce_size
Nonce size in bytes (e.g., 24 for XSalsa20).
Definition packet.h:1074
uint8_t mac_size
MAC size in bytes (e.g., 16 for Poly1305).
Definition packet.h:1076
uint16_t shared_secret_size
Shared secret size in bytes (e.g., 32 for X25519).
Definition packet.h:1072
uint16_t kex_public_key_size
Key exchange public key size in bytes (e.g., 32 for X25519, 1568 for Kyber1024).
Definition packet.h:1066

References ARGON2ID_SALT_SIZE, ASCIICHAT_OK, AUTH_CHALLENGE_SIZE, crypto_context_t::auth_challenge_size, crypto_context_t::auth_public_key_size, crypto_parameters_packet_t::auth_public_key_size, CIPHER_ALGO_NONE, crypto_handshake_context_t::crypto_ctx, crypto_context_t::encrypt_data, crypto_context_t::encryption_key_size, ERROR_INVALID_PARAM, crypto_context_t::hmac_size, crypto_parameters_packet_t::hmac_size, crypto_handshake_context_t::is_server, crypto_parameters_packet_t::kex_public_key_size, log_debug, crypto_context_t::mac_size, crypto_parameters_packet_t::mac_size, NET_TO_HOST_U16, crypto_context_t::nonce_size, crypto_parameters_packet_t::nonce_size, crypto_context_t::private_key_size, crypto_context_t::public_key_size, crypto_handshake_context_t::require_client_auth, crypto_context_t::salt_size, crypto_parameters_packet_t::selected_cipher, SET_ERRNO, crypto_context_t::shared_key_size, crypto_parameters_packet_t::shared_secret_size, crypto_context_t::signature_size, crypto_parameters_packet_t::signature_size, and crypto_parameters_packet_t::verification_enabled.

Referenced by acds_handshake_receive(), acip_security_receive(), client_handle_crypto_parameters(), and crypto_handshake_server_send_parameters().

◆ crypto_handshake_validate_packet_size()

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.

Parameters
ctxHandshake context (must have parameters set)
packet_typePacket type to validate
packet_sizeActual packet size received
Returns
ASCIICHAT_OK if valid, error code on failure

Definition at line 108 of file crypto/handshake/common.c.

108 {
109 if (!ctx) {
110 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid parameters: ctx=%p", ctx);
111 }
112
113 switch (packet_type) {
115 if (packet_size != sizeof(crypto_capabilities_packet_t)) {
116 // Don't return an error code, just set the errno and return the error code
117 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid crypto capabilities packet size: %zu (expected %zu)", packet_size, sizeof(crypto_capabilities_packet_t));
118 }
119 break;
120
122 if (packet_size != sizeof(crypto_parameters_packet_t)) {
123 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid crypto parameters packet size: %zu (expected %zu)", packet_size, sizeof(crypto_parameters_packet_t));
124 }
125 break;
126
128 // Server can send either:
129 // 1. Simple format: kex_public_key_size (when server has no identity key)
130 // 2. Authenticated format: kex_public_key_size + auth_public_key_size + signature_size
131 {
132 size_t simple_size = ctx->crypto_ctx.public_key_size;
133 size_t authenticated_size = ctx->crypto_ctx.public_key_size + ctx->crypto_ctx.auth_public_key_size + ctx->crypto_ctx.signature_size;
134
135 if (packet_size != simple_size && packet_size != authenticated_size) {
137 "Invalid KEY_EXCHANGE_INIT size: %zu (expected %zu for simple or %zu for authenticated: "
138 "kex=%u + auth=%u + sig=%u)",
139 packet_size, simple_size, authenticated_size, ctx->crypto_ctx.public_key_size, ctx->crypto_ctx.auth_public_key_size, ctx->crypto_ctx.signature_size);
140 }
141 }
142 break;
143
145 // Client can send either:
146 // 1. Simple format: kex_public_key_size (when server has no identity key)
147 // 2. Authenticated format: kex_public_key_size + client_auth_key_size + client_sig_size + [gpg_key_id_len:1] +
148 // [gpg_key_id:0-16]
149 {
150 size_t simple_size = ctx->crypto_ctx.public_key_size;
151 // For authenticated format, use Ed25519 sizes since client has Ed25519 key
152 size_t ed25519_auth_size = ED25519_PUBLIC_KEY_SIZE; // Ed25519 public key is always 32 bytes
153 size_t ed25519_sig_size = ED25519_SIGNATURE_SIZE; // Ed25519 signature is always 64 bytes
154 size_t authenticated_min_size = ctx->crypto_ctx.public_key_size + ed25519_auth_size + ed25519_sig_size;
155 size_t authenticated_max_size = authenticated_min_size + 1 + 40; // +1 for length, +40 for max GPG key ID
156
157 if (packet_size != simple_size && (packet_size < authenticated_min_size || packet_size > authenticated_max_size)) {
159 "Invalid KEY_EXCHANGE_RESP size: %zu (expected %zu for simple or %zu-%zu for authenticated: "
160 "kex=%u + auth=%u + sig=%u + optional GPG key ID)",
161 packet_size, simple_size, authenticated_min_size, authenticated_max_size, ctx->crypto_ctx.public_key_size, ed25519_auth_size, ed25519_sig_size);
162 }
163 }
164 break;
165
167 // Server sends: 1 byte auth_flags + auth_challenge_size byte nonce
168 {
169 size_t expected_size = AUTH_CHALLENGE_FLAGS_SIZE + ctx->crypto_ctx.auth_challenge_size;
170 if (packet_size != expected_size) {
171 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid AUTH_CHALLENGE size: %zu (expected %zu: flags=%d + nonce=%u)", packet_size, expected_size, AUTH_CHALLENGE_FLAGS_SIZE,
173 }
174 }
175 break;
176
178 // Client sends: hmac_size + auth_challenge_size bytes client_nonce + [gpg_key_id_len:1] + [gpg_key_id:0-40]
179 {
180 size_t min_size = ctx->crypto_ctx.hmac_size + ctx->crypto_ctx.auth_challenge_size;
181 size_t max_size = min_size + 1 + 40; // +1 for length, +40 for max GPG key ID
182 if (packet_size < min_size || packet_size > max_size) {
184 "Invalid AUTH_RESPONSE size: %zu (expected %zu-%zu: hmac=%u + "
185 "nonce=%u + optional GPG key ID)",
186 packet_size, min_size, max_size, ctx->crypto_ctx.hmac_size, ctx->crypto_ctx.auth_challenge_size);
187 }
188 }
189 break;
190
192 // Variable size - just check reasonable limits
193 if (packet_size > MAX_AUTH_FAILED_PACKET_SIZE) {
194 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid AUTH_FAILED size: %zu (max %d)", packet_size, MAX_AUTH_FAILED_PACKET_SIZE);
195 }
196 break;
197
199 // Server sends: hmac_size bytes
200 if (packet_size != ctx->crypto_ctx.hmac_size) {
201 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid SERVER_AUTH_RESP size: %zu (expected %u)", packet_size, ctx->crypto_ctx.hmac_size);
202 }
203 break;
204
206 // Empty packet
207 if (packet_size != 0) {
208 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid HANDSHAKE_COMPLETE size: %zu (expected 0)", packet_size);
209 }
210 break;
211
213 // Empty packet
214 if (packet_size != 0) {
215 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid NO_ENCRYPTION size: %zu (expected 0)", packet_size);
216 }
217 break;
218
220 // Variable size - check reasonable limits
221 if (packet_size > MAX_ENCRYPTED_PACKET_SIZE) { // 64KB max for encrypted packets
222 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Invalid ENCRYPTED size: %zu (max %d)", packet_size, MAX_ENCRYPTED_PACKET_SIZE);
223 }
224 break;
225
226 default:
227 return SET_ERRNO(ERROR_NETWORK_PROTOCOL, "Unknown crypto packet type: %u", packet_type);
228 }
229
230 return ASCIICHAT_OK;
231}
@ ERROR_NETWORK_PROTOCOL
Definition error_codes.h:80
@ PACKET_TYPE_CRYPTO_AUTH_RESPONSE
Client -> Server: {HMAC[32]} (UNENCRYPTED).
Definition packet.h:346
@ PACKET_TYPE_CRYPTO_HANDSHAKE_COMPLETE
Server -> Client: "encryption ready" (UNENCRYPTED).
Definition packet.h:352
@ PACKET_TYPE_CRYPTO_KEY_EXCHANGE_INIT
Server -> Client: {server_pubkey[32]} (UNENCRYPTED).
Definition packet.h:340
@ PACKET_TYPE_CRYPTO_KEY_EXCHANGE_RESP
Client -> Server: {client_pubkey[32]} (UNENCRYPTED).
Definition packet.h:342
@ PACKET_TYPE_CRYPTO_AUTH_FAILED
Server -> Client: "authentication failed" (UNENCRYPTED).
Definition packet.h:348
@ PACKET_TYPE_ENCRYPTED
Encrypted packet (after handshake completion).
Definition packet.h:369
@ PACKET_TYPE_CRYPTO_SERVER_AUTH_RESP
Server -> Client: {HMAC[32]} server proves knowledge (UNENCRYPTED).
Definition packet.h:350
@ PACKET_TYPE_CRYPTO_NO_ENCRYPTION
Client -> Server: "I want to proceed without encryption" (UNENCRYPTED).
Definition packet.h:354
@ PACKET_TYPE_CRYPTO_AUTH_CHALLENGE
Server -> Client: {nonce[32]} (UNENCRYPTED).
Definition packet.h:344
@ PACKET_TYPE_CRYPTO_PARAMETERS
Server -> Client: Chosen algorithms + data sizes (UNENCRYPTED).
Definition packet.h:338
@ PACKET_TYPE_CRYPTO_CAPABILITIES
Client -> Server: Supported crypto algorithms (UNENCRYPTED).
Definition packet.h:336
#define ED25519_SIGNATURE_SIZE
Ed25519 signature size in bytes.
Definition sizes.h:41
#define MAX_AUTH_FAILED_PACKET_SIZE
Maximum AUTH_FAILED packet size (256 bytes).
Definition sizes.h:146
#define MAX_ENCRYPTED_PACKET_SIZE
Maximum encrypted packet size (64KB).
Definition sizes.h:148
#define ED25519_PUBLIC_KEY_SIZE
Ed25519 public key size in bytes.
Definition sizes.h:37
#define AUTH_CHALLENGE_FLAGS_SIZE
Authentication flags size (1 byte).
Definition sizes.h:119
Crypto capabilities packet structure (Packet Type 14).
Definition packet.h:1027
Crypto parameters packet structure (Packet Type 15).
Definition packet.h:1056

References ASCIICHAT_OK, AUTH_CHALLENGE_FLAGS_SIZE, crypto_context_t::auth_challenge_size, crypto_context_t::auth_public_key_size, crypto_handshake_context_t::crypto_ctx, ED25519_PUBLIC_KEY_SIZE, ED25519_SIGNATURE_SIZE, ERROR_INVALID_PARAM, ERROR_NETWORK_PROTOCOL, crypto_context_t::hmac_size, MAX_AUTH_FAILED_PACKET_SIZE, MAX_ENCRYPTED_PACKET_SIZE, PACKET_TYPE_CRYPTO_AUTH_CHALLENGE, PACKET_TYPE_CRYPTO_AUTH_FAILED, PACKET_TYPE_CRYPTO_AUTH_RESPONSE, PACKET_TYPE_CRYPTO_CAPABILITIES, PACKET_TYPE_CRYPTO_HANDSHAKE_COMPLETE, PACKET_TYPE_CRYPTO_KEY_EXCHANGE_INIT, PACKET_TYPE_CRYPTO_KEY_EXCHANGE_RESP, PACKET_TYPE_CRYPTO_NO_ENCRYPTION, PACKET_TYPE_CRYPTO_PARAMETERS, PACKET_TYPE_CRYPTO_SERVER_AUTH_RESP, PACKET_TYPE_ENCRYPTED, crypto_context_t::public_key_size, SET_ERRNO, and crypto_context_t::signature_size.

Referenced by crypto_handshake_client_auth_response(), crypto_handshake_client_key_exchange(), crypto_handshake_server_auth_challenge(), and crypto_handshake_server_complete().