ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
crypto.c File Reference

Stub implementations for crypto-related functions in WASM build. More...

Go to the source code of this file.

Functions

asciichat_error_t parse_public_keys (const char *input, public_key_t *keys_out, size_t *num_keys, size_t max_keys)
 Parse all SSH/GPG public keys from any format (returns all keys).
asciichat_error_t check_known_host (const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE])
asciichat_error_t check_known_host_no_identity (const char *server_ip, uint16_t port)
 Check known_hosts for servers without identity key (no-identity entries).
bool display_mitm_warning (const char *server_ip, uint16_t port, const uint8_t expected_key[ED25519_PUBLIC_KEY_SIZE], const uint8_t received_key[ED25519_PUBLIC_KEY_SIZE])
bool prompt_unknown_host (const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE])
bool prompt_unknown_host_no_identity (const char *server_ip, uint16_t port)
 Interactive prompt for unknown host without identity key - returns true if user wants to continue, false to abort.
asciichat_error_t add_known_host (const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE])
const char * get_known_hosts_path (void)
asciichat_error_t prompt_password (const char *prompt_text, char *password_out, size_t password_max_len)
 Prompt the user for a password with secure input.
asciichat_error_t check_known_host_with_key (const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE], uint8_t stored_key[ED25519_PUBLIC_KEY_SIZE], bool *has_stored_key)
void key_identity_announce (const char *label, const public_key_t *key)
void known_hosts_destroy (void)
 Cleanup function to free cached known_hosts path.

Detailed Description

Stub implementations for crypto-related functions in WASM build.

Definition in file lib/wasm/stubs/crypto.c.

Function Documentation

◆ add_known_host()

asciichat_error_t add_known_host ( const char * server_ip,
uint16_t port,
const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE] )

Definition at line 52 of file lib/wasm/stubs/crypto.c.

52 {
53 // Known hosts file updates not supported in WASM
54 return ASCIICHAT_OK;
55}
@ ASCIICHAT_OK
Definition error_codes.h:50

References ASCIICHAT_OK, and ED25519_PUBLIC_KEY_SIZE.

◆ check_known_host()

asciichat_error_t check_known_host ( const char * server_ip,
uint16_t port,
const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE] )

Definition at line 27 of file lib/wasm/stubs/crypto.c.

27 {
28 // Known hosts checking not supported in WASM
29 return ASCIICHAT_OK;
30}

References ASCIICHAT_OK, and ED25519_PUBLIC_KEY_SIZE.

Referenced by check_known_host_with_key().

◆ check_known_host_with_key()

asciichat_error_t check_known_host_with_key ( const char * server_ip,
uint16_t port,
const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE],
uint8_t stored_key[ED25519_PUBLIC_KEY_SIZE],
bool * has_stored_key )

Definition at line 70 of file lib/wasm/stubs/crypto.c.

71 {
72 if (has_stored_key)
73 *has_stored_key = false;
74 if (stored_key)
75 memset(stored_key, 0, sizeof(stored_key));
76 return check_known_host(server_ip, port, server_key);
77}
asciichat_error_t check_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE])

References check_known_host(), and ED25519_PUBLIC_KEY_SIZE.

◆ display_mitm_warning()

bool display_mitm_warning ( const char * server_ip,
uint16_t port,
const uint8_t expected_key[ED25519_PUBLIC_KEY_SIZE],
const uint8_t received_key[ED25519_PUBLIC_KEY_SIZE] )

Definition at line 37 of file lib/wasm/stubs/crypto.c.

37 {
38 // MITM warnings not displayed in WASM (browser console log instead)
39 return false;
40}

References ED25519_PUBLIC_KEY_SIZE.

◆ get_known_hosts_path()

const char * get_known_hosts_path ( void )

Definition at line 57 of file lib/wasm/stubs/crypto.c.

57 {
58 // No filesystem in WASM
59 return NULL;
60}

◆ key_identity_announce()

void key_identity_announce ( const char * label,
const public_key_t * key )

Announce a public identity using the existing notice/logging policy.

Definition at line 79 of file lib/wasm/stubs/crypto.c.

79 {
80 (void)label;
81 (void)key;
82}

◆ prompt_unknown_host()

bool prompt_unknown_host ( const char * server_ip,
uint16_t port,
const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE] )

Definition at line 42 of file lib/wasm/stubs/crypto.c.

42 {
43 // No interactive prompts in WASM - auto-accept
44 return true;
45}

References ED25519_PUBLIC_KEY_SIZE.