|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
Common handshake functions: initialization, cleanup, encryption, rekeying. More...
Go to the source code of this file.
Functions | |
| asciichat_error_t | crypto_handshake_init (crypto_handshake_context_t *ctx, bool is_server) |
| asciichat_error_t | crypto_handshake_set_parameters (crypto_handshake_context_t *ctx, const crypto_parameters_packet_t *params) |
| asciichat_error_t | crypto_handshake_validate_packet_size (const crypto_handshake_context_t *ctx, uint16_t packet_type, size_t packet_size) |
| asciichat_error_t | crypto_handshake_init_with_password (crypto_handshake_context_t *ctx, bool is_server, const char *password) |
| void | crypto_handshake_destroy (crypto_handshake_context_t *ctx) |
| bool | crypto_handshake_is_ready (const crypto_handshake_context_t *ctx) |
| const crypto_context_t * | crypto_handshake_get_context (const crypto_handshake_context_t *ctx) |
| asciichat_error_t | crypto_handshake_encrypt_packet (const crypto_handshake_context_t *ctx, const uint8_t *plaintext, size_t plaintext_len, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_len) |
| asciichat_error_t | crypto_handshake_decrypt_packet (const crypto_handshake_context_t *ctx, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_len) |
| asciichat_error_t | crypto_encrypt_packet_or_passthrough (const crypto_handshake_context_t *ctx, bool crypto_ready, const uint8_t *plaintext, size_t plaintext_len, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_len) |
| asciichat_error_t | crypto_decrypt_packet_or_passthrough (const crypto_handshake_context_t *ctx, bool crypto_ready, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_len) |
| asciichat_error_t | crypto_handshake_rekey_request (crypto_handshake_context_t *ctx, socket_t socket) |
| asciichat_error_t | crypto_handshake_rekey_response (crypto_handshake_context_t *ctx, socket_t socket) |
| asciichat_error_t | crypto_handshake_rekey_complete (crypto_handshake_context_t *ctx, socket_t socket) |
| asciichat_error_t | crypto_handshake_process_rekey_request (crypto_handshake_context_t *ctx, const uint8_t *packet, size_t packet_len) |
| asciichat_error_t | crypto_handshake_process_rekey_response (crypto_handshake_context_t *ctx, const uint8_t *packet, size_t packet_len) |
| asciichat_error_t | crypto_handshake_process_rekey_complete (crypto_handshake_context_t *ctx, const uint8_t *packet, size_t packet_len) |
| bool | crypto_handshake_should_rekey (const crypto_handshake_context_t *ctx) |
Common handshake functions: initialization, cleanup, encryption, rekeying.
Definition in file crypto/handshake/common.c.
| asciichat_error_t crypto_decrypt_packet_or_passthrough | ( | const crypto_handshake_context_t * | ctx, |
| bool | crypto_ready, | ||
| const uint8_t * | ciphertext, | ||
| size_t | ciphertext_len, | ||
| uint8_t * | plaintext, | ||
| size_t | plaintext_size, | ||
| size_t * | plaintext_len | ||
| ) |
Definition at line 340 of file crypto/handshake/common.c.
References crypto_handshake_decrypt_packet().
Referenced by crypto_client_decrypt_packet(), and crypto_server_decrypt_packet().
| asciichat_error_t crypto_encrypt_packet_or_passthrough | ( | const crypto_handshake_context_t * | ctx, |
| bool | crypto_ready, | ||
| const uint8_t * | plaintext, | ||
| size_t | plaintext_len, | ||
| uint8_t * | ciphertext, | ||
| size_t | ciphertext_size, | ||
| size_t * | ciphertext_len | ||
| ) |
Definition at line 321 of file crypto/handshake/common.c.
References crypto_handshake_encrypt_packet().
Referenced by crypto_client_encrypt_packet(), and crypto_server_encrypt_packet().
| asciichat_error_t crypto_handshake_decrypt_packet | ( | const crypto_handshake_context_t * | ctx, |
| const uint8_t * | ciphertext, | ||
| size_t | ciphertext_len, | ||
| uint8_t * | plaintext, | ||
| size_t | plaintext_size, | ||
| size_t * | plaintext_len | ||
| ) |
Definition at line 303 of file crypto/handshake/common.c.
References crypto_decrypt(), crypto_handshake_is_ready(), and crypto_result_to_string().
Referenced by crypto_decrypt_packet_or_passthrough().
| void crypto_handshake_destroy | ( | crypto_handshake_context_t * | ctx | ) |
Definition at line 259 of file crypto/handshake/common.c.
References crypto_destroy().
Referenced by client_cleanup(), client_crypto_init(), client_generate_keypair(), client_handle_key_exchange_init(), crypto_client_cleanup(), crypto_server_cleanup_client(), remove_client(), and server_connection_close().
| asciichat_error_t crypto_handshake_encrypt_packet | ( | const crypto_handshake_context_t * | ctx, |
| const uint8_t * | plaintext, | ||
| size_t | plaintext_len, | ||
| uint8_t * | ciphertext, | ||
| size_t | ciphertext_size, | ||
| size_t * | ciphertext_len | ||
| ) |
Definition at line 285 of file crypto/handshake/common.c.
References crypto_encrypt(), crypto_handshake_is_ready(), and crypto_result_to_string().
Referenced by crypto_encrypt_packet_or_passthrough().
| const crypto_context_t * crypto_handshake_get_context | ( | const crypto_handshake_context_t * | ctx | ) |
Definition at line 278 of file crypto/handshake/common.c.
References crypto_handshake_is_ready().
Referenced by broadcast_server_state_to_all_clients(), crypto_client_get_context(), crypto_server_get_context(), and disconnect_client_for_bad_data().
| asciichat_error_t crypto_handshake_init | ( | crypto_handshake_context_t * | ctx, |
| bool | is_server | ||
| ) |
Definition at line 17 of file crypto/handshake/common.c.
References crypto_init(), and crypto_result_to_string().
Referenced by acds_client_handler(), client_crypto_init(), client_generate_keypair(), client_handle_key_exchange_init(), and server_crypto_handshake().
| asciichat_error_t crypto_handshake_init_with_password | ( | crypto_handshake_context_t * | ctx, |
| bool | is_server, | ||
| const char * | password | ||
| ) |
Definition at line 229 of file crypto/handshake/common.c.
References crypto_init_with_password(), and crypto_result_to_string().
Referenced by client_crypto_init(), and server_crypto_handshake().
| bool crypto_handshake_is_ready | ( | const crypto_handshake_context_t * | ctx | ) |
Definition at line 271 of file crypto/handshake/common.c.
References crypto_is_ready().
Referenced by add_client(), client_send_thread_func(), crypto_client_is_ready(), crypto_handshake_decrypt_packet(), crypto_handshake_encrypt_packet(), crypto_handshake_get_context(), crypto_handshake_process_rekey_complete(), crypto_handshake_process_rekey_request(), crypto_handshake_process_rekey_response(), crypto_handshake_rekey_complete(), crypto_handshake_rekey_request(), crypto_handshake_rekey_response(), crypto_handshake_should_rekey(), and crypto_server_is_ready().
| asciichat_error_t crypto_handshake_process_rekey_complete | ( | crypto_handshake_context_t * | ctx, |
| const uint8_t * | packet, | ||
| size_t | packet_len | ||
| ) |
Process received REKEY_COMPLETE packet (responder side). Verifies that the packet decrypts with the new shared secret. If successful, commits to the new key.
Definition at line 564 of file crypto/handshake/common.c.
References crypto_decrypt(), crypto_handshake_is_ready(), crypto_rekey_abort(), crypto_rekey_commit(), and crypto_result_to_string().
| asciichat_error_t crypto_handshake_process_rekey_request | ( | crypto_handshake_context_t * | ctx, |
| const uint8_t * | packet, | ||
| size_t | packet_len | ||
| ) |
Process received REKEY_REQUEST packet (responder side). Extracts peer's new ephemeral public key and computes new shared secret.
Definition at line 478 of file crypto/handshake/common.c.
References crypto_handshake_is_ready(), crypto_rekey_abort(), crypto_rekey_init(), crypto_rekey_process_request(), and crypto_result_to_string().
Referenced by crypto_client_process_rekey_request().
| asciichat_error_t crypto_handshake_process_rekey_response | ( | crypto_handshake_context_t * | ctx, |
| const uint8_t * | packet, | ||
| size_t | packet_len | ||
| ) |
Process received REKEY_RESPONSE packet (initiator side). Extracts peer's new ephemeral public key and computes new shared secret.
Definition at line 529 of file crypto/handshake/common.c.
References crypto_handshake_is_ready(), crypto_rekey_abort(), crypto_rekey_process_response(), and crypto_result_to_string().
Referenced by crypto_client_process_rekey_response().
| asciichat_error_t crypto_handshake_rekey_complete | ( | crypto_handshake_context_t * | ctx, |
| socket_t | socket | ||
| ) |
Send REKEY_COMPLETE packet (initiator side). Note: This packet is encrypted with the new shared secret. It proves that both sides have computed the same shared secret.
Definition at line 423 of file crypto/handshake/common.c.
References crypto_encrypt(), crypto_handshake_is_ready(), crypto_rekey_abort(), crypto_rekey_commit(), crypto_result_to_string(), and send_packet().
Referenced by crypto_client_send_rekey_complete().
| asciichat_error_t crypto_handshake_rekey_request | ( | crypto_handshake_context_t * | ctx, |
| socket_t | socket | ||
| ) |
Send REKEY_REQUEST packet (initiator side). Sends the initiator's new ephemeral public key to the peer.
Definition at line 366 of file crypto/handshake/common.c.
References crypto_handshake_is_ready(), crypto_rekey_abort(), crypto_rekey_init(), crypto_result_to_string(), and send_packet().
Referenced by client_send_thread_func(), and crypto_client_initiate_rekey().
| asciichat_error_t crypto_handshake_rekey_response | ( | crypto_handshake_context_t * | ctx, |
| socket_t | socket | ||
| ) |
Send REKEY_RESPONSE packet (responder side). Sends the responder's new ephemeral public key to the peer.
Definition at line 395 of file crypto/handshake/common.c.
References crypto_handshake_is_ready(), crypto_rekey_abort(), and send_packet().
Referenced by crypto_client_send_rekey_response().
| asciichat_error_t crypto_handshake_set_parameters | ( | crypto_handshake_context_t * | ctx, |
| const crypto_parameters_packet_t * | params | ||
| ) |
Definition at line 48 of file crypto/handshake/common.c.
Referenced by client_crypto_handshake(), and server_crypto_handshake().
| bool crypto_handshake_should_rekey | ( | const crypto_handshake_context_t * | ctx | ) |
Check if rekeying should be triggered for this handshake context. Wrapper around crypto_should_rekey() for handshake context.
Definition at line 614 of file crypto/handshake/common.c.
References crypto_handshake_is_ready(), and crypto_should_rekey().
Referenced by client_send_thread_func(), and crypto_client_should_rekey().
| asciichat_error_t crypto_handshake_validate_packet_size | ( | const crypto_handshake_context_t * | ctx, |
| uint16_t | packet_type, | ||
| size_t | packet_size | ||
| ) |
Definition at line 92 of file crypto/handshake/common.c.
Referenced by crypto_handshake_client_auth_response(), crypto_handshake_client_key_exchange(), crypto_handshake_server_auth_challenge(), and crypto_handshake_server_complete().