ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
sizes.h File Reference

Go to the source code of this file.

Macros

#define GPG_SIGNATURE_PACKET_CAPACITY   512
#define ED25519_SIGNATURE_PART_SIZE   (ED25519_SIGNATURE_SIZE / 2)
#define SERVER_AUTH_RESPONSE_SIZE   AUTH_HMAC_SIZE
 Server authentication response size (32 bytes).
#define ED25519_SEED_SIZE   32
#define GPG_FINGERPRINT_SIZE   20
#define GPG_FINGERPRINT_HEX_BUFFER_SIZE   (GPG_FINGERPRINT_SIZE * 2 + 1)
#define GPG_KEY_ID_SIZE   8
#define GPG_KEY_ID_HEX_BUFFER_SIZE   (GPG_KEY_ID_SIZE * 2 + 1)
#define MAX_COMMENT_LEN   256
#define MAX_GPG_KEYGRIP_LEN   64
Password Requirements

Cryptographic storage and wire widths; usable without crypto context types or libsodium.

#define MIN_PASSWORD_LENGTH   8
 Minimum password length (8 characters).
#define MAX_PASSWORD_LENGTH   256
 Maximum password length (256 characters).
Algorithm-Specific Key Sizes
#define X25519_KEY_SIZE   32
 X25519 key size in bytes.
#define ED25519_PUBLIC_KEY_SIZE   32
 Ed25519 public key size in bytes.
#define ED25519_PRIVATE_KEY_SIZE   64
 Ed25519 private key size (seed + public) in bytes.
#define ED25519_SIGNATURE_SIZE   64
 Ed25519 signature size in bytes.
#define XSALSA20_NONCE_SIZE   24
 XSalsa20 nonce size in bytes.
#define POLY1305_MAC_SIZE   16
 Poly1305 MAC size in bytes.
#define HMAC_SHA256_SIZE   32
 HMAC-SHA256 output size in bytes.
#define HMAC_SHA256_KEY_SIZE   32
#define ARGON2ID_SALT_SIZE   32
 Argon2id salt size in bytes.
#define SECRETBOX_KEY_SIZE   32
 Secretbox key size in bytes.
#define AES256_KEY_SIZE   32
 AES-256 key size in bytes.
#define AES_IV_SIZE   16
 AES initialization vector (IV) size in bytes.
#define AES256_DERIVED_SIZE   (AES256_KEY_SIZE + AES_IV_SIZE)
 AES-256 key + IV derived size in bytes (for bcrypt_pbkdf).
Abstracted Cryptographic Constants

These constants abstract the underlying algorithms to allow future changes.

#define CRYPTO_PUBLIC_KEY_SIZE   X25519_KEY_SIZE
 Public key size (X25519).
#define CRYPTO_PRIVATE_KEY_SIZE   X25519_KEY_SIZE
 Private key size (X25519).
#define CRYPTO_SHARED_KEY_SIZE   X25519_KEY_SIZE
 Shared key size (X25519).
#define CRYPTO_ED25519_PUBLIC_KEY_SIZE   ED25519_PUBLIC_KEY_SIZE
 Ed25519 public key size.
#define CRYPTO_ED25519_PRIVATE_KEY_SIZE   ED25519_PRIVATE_KEY_SIZE
 Ed25519 private key size.
#define CRYPTO_ED25519_SIGNATURE_SIZE   ED25519_SIGNATURE_SIZE
 Ed25519 signature size.
#define CRYPTO_NONCE_SIZE   XSALSA20_NONCE_SIZE
 Nonce size (XSalsa20).
#define CRYPTO_SALT_SIZE   ARGON2ID_SALT_SIZE
 Salt size (Argon2id).
#define CRYPTO_ENCRYPTION_KEY_SIZE   SECRETBOX_KEY_SIZE
 Encryption key size (XSalsa20-Poly1305).
#define CRYPTO_MAC_SIZE   POLY1305_MAC_SIZE
 MAC size (Poly1305).
#define CRYPTO_HMAC_SIZE   HMAC_SHA256_SIZE
 HMAC size (HMAC-SHA256).
Authentication Packet Sizes
#define AUTH_HMAC_SIZE   32
 HMAC size in authentication packets (32 bytes).
#define AUTH_CHALLENGE_SIZE   32
 Challenge nonce size (32 bytes).
#define AUTH_COMBINED_SIZE   (AUTH_HMAC_SIZE + AUTH_CHALLENGE_SIZE)
 Combined authentication data size (HMAC + challenge, 64 bytes).
#define AUTH_SIGNATURE_SIZE   64
 Ed25519 signature size (64 bytes).
#define AUTH_SIGNATURE_COMBINED_SIZE   (AUTH_SIGNATURE_SIZE + AUTH_CHALLENGE_SIZE)
 Combined signature + challenge size (96 bytes).
Authentication Challenge Packet Structure
#define AUTH_CHALLENGE_FLAGS_SIZE   1
 Authentication flags size (1 byte).
#define AUTH_CHALLENGE_PACKET_SIZE   (AUTH_CHALLENGE_FLAGS_SIZE + AUTH_CHALLENGE_SIZE)
 Complete authentication challenge packet size (1 + 32 = 33 bytes).
Authentication Response Packet Sizes
#define AUTH_RESPONSE_PASSWORD_SIZE   (AUTH_HMAC_SIZE + AUTH_CHALLENGE_SIZE)
 Password-based authentication response size (HMAC + challenge, 64 bytes).
#define AUTH_RESPONSE_SIGNATURE_SIZE   (AUTH_SIGNATURE_SIZE + AUTH_CHALLENGE_SIZE)
 Signature-based authentication response size (signature + challenge, 96 bytes).
Packet Size Limits
#define MAX_AUTH_FAILED_PACKET_SIZE   256
 Maximum AUTH_FAILED packet size (256 bytes).
#define MAX_ENCRYPTED_PACKET_SIZE   65536
 Maximum encrypted packet size (64KB).
Buffer Sizes
#define HEX_STRING_SIZE_32   (32 * 2 + 1)
 Hex string size for 32-byte values (64 hex chars + null terminator).
#define HEX_STRING_SIZE_64   (64 * 2 + 1)
 Hex string size for 64-byte values (128 hex chars + null terminator).
#define PASSWORD_BUFFER_SIZE   256
 Password input buffer size (256 bytes).
#define ZERO_KEY_SIZE   X25519_KEY_SIZE
 Zero key array size (32 bytes, used for no-identity entries).

Macro Definition Documentation

◆ AES256_DERIVED_SIZE

#define AES256_DERIVED_SIZE   (AES256_KEY_SIZE + AES_IV_SIZE)

AES-256 key + IV derived size in bytes (for bcrypt_pbkdf).

Definition at line 55 of file sizes.h.

◆ AES256_KEY_SIZE

#define AES256_KEY_SIZE   32

AES-256 key size in bytes.

Definition at line 51 of file sizes.h.

◆ AES_IV_SIZE

#define AES_IV_SIZE   16

AES initialization vector (IV) size in bytes.

Definition at line 53 of file sizes.h.

◆ ARGON2ID_SALT_SIZE

#define ARGON2ID_SALT_SIZE   32

Argon2id salt size in bytes.

Definition at line 47 of file sizes.h.

Referenced by crypto_derive_password_encryption_key(), crypto_handshake_set_parameters(), crypto_init(), and crypto_verify_password().

◆ AUTH_CHALLENGE_FLAGS_SIZE

#define AUTH_CHALLENGE_FLAGS_SIZE   1

Authentication flags size (1 byte).

Definition at line 115 of file sizes.h.

Referenced by crypto_handshake_server_auth_challenge(), and crypto_handshake_validate_packet_size().

◆ AUTH_CHALLENGE_PACKET_SIZE

#define AUTH_CHALLENGE_PACKET_SIZE   (AUTH_CHALLENGE_FLAGS_SIZE + AUTH_CHALLENGE_SIZE)

Complete authentication challenge packet size (1 + 32 = 33 bytes).

Definition at line 117 of file sizes.h.

◆ AUTH_CHALLENGE_SIZE

◆ AUTH_COMBINED_SIZE

#define AUTH_COMBINED_SIZE   (AUTH_HMAC_SIZE + AUTH_CHALLENGE_SIZE)

Combined authentication data size (HMAC + challenge, 64 bytes).

Definition at line 101 of file sizes.h.

◆ AUTH_HMAC_SIZE

#define AUTH_HMAC_SIZE   32

HMAC size in authentication packets (32 bytes).

Definition at line 97 of file sizes.h.

Referenced by crypto_combine_auth_data().

◆ AUTH_RESPONSE_PASSWORD_SIZE

#define AUTH_RESPONSE_PASSWORD_SIZE   (AUTH_HMAC_SIZE + AUTH_CHALLENGE_SIZE)

Password-based authentication response size (HMAC + challenge, 64 bytes).

Definition at line 127 of file sizes.h.

◆ AUTH_RESPONSE_SIGNATURE_SIZE

#define AUTH_RESPONSE_SIGNATURE_SIZE   (AUTH_SIGNATURE_SIZE + AUTH_CHALLENGE_SIZE)

Signature-based authentication response size (signature + challenge, 96 bytes).

Definition at line 129 of file sizes.h.

◆ AUTH_SIGNATURE_COMBINED_SIZE

#define AUTH_SIGNATURE_COMBINED_SIZE   (AUTH_SIGNATURE_SIZE + AUTH_CHALLENGE_SIZE)

Combined signature + challenge size (96 bytes).

Definition at line 105 of file sizes.h.

◆ AUTH_SIGNATURE_SIZE

#define AUTH_SIGNATURE_SIZE   64

Ed25519 signature size (64 bytes).

Definition at line 103 of file sizes.h.

◆ CRYPTO_ED25519_PRIVATE_KEY_SIZE

#define CRYPTO_ED25519_PRIVATE_KEY_SIZE   ED25519_PRIVATE_KEY_SIZE

Ed25519 private key size.

Definition at line 75 of file sizes.h.

◆ CRYPTO_ED25519_PUBLIC_KEY_SIZE

#define CRYPTO_ED25519_PUBLIC_KEY_SIZE   ED25519_PUBLIC_KEY_SIZE

Ed25519 public key size.

Definition at line 73 of file sizes.h.

◆ CRYPTO_ED25519_SIGNATURE_SIZE

#define CRYPTO_ED25519_SIGNATURE_SIZE   ED25519_SIGNATURE_SIZE

Ed25519 signature size.

Definition at line 77 of file sizes.h.

◆ CRYPTO_ENCRYPTION_KEY_SIZE

#define CRYPTO_ENCRYPTION_KEY_SIZE   SECRETBOX_KEY_SIZE

Encryption key size (XSalsa20-Poly1305).

Definition at line 83 of file sizes.h.

Referenced by crypto_derive_password_encryption_key().

◆ CRYPTO_HMAC_SIZE

#define CRYPTO_HMAC_SIZE   HMAC_SHA256_SIZE

HMAC size (HMAC-SHA256).

Definition at line 87 of file sizes.h.

◆ CRYPTO_MAC_SIZE

#define CRYPTO_MAC_SIZE   POLY1305_MAC_SIZE

MAC size (Poly1305).

Definition at line 85 of file sizes.h.

Referenced by acip_packet_plan(), browser_security_packet(), client_encrypt_packet(), and crypto_record_init().

◆ CRYPTO_NONCE_SIZE

#define CRYPTO_NONCE_SIZE   XSALSA20_NONCE_SIZE

Nonce size (XSalsa20).

Definition at line 79 of file sizes.h.

Referenced by acip_packet_plan(), browser_security_packet(), client_encrypt_packet(), and crypto_record_init().

◆ CRYPTO_PRIVATE_KEY_SIZE

#define CRYPTO_PRIVATE_KEY_SIZE   X25519_KEY_SIZE

Private key size (X25519).

Definition at line 69 of file sizes.h.

◆ CRYPTO_PUBLIC_KEY_SIZE

#define CRYPTO_PUBLIC_KEY_SIZE   X25519_KEY_SIZE

◆ CRYPTO_SALT_SIZE

#define CRYPTO_SALT_SIZE   ARGON2ID_SALT_SIZE

Salt size (Argon2id).

Definition at line 81 of file sizes.h.

◆ CRYPTO_SHARED_KEY_SIZE

#define CRYPTO_SHARED_KEY_SIZE   X25519_KEY_SIZE

◆ ED25519_PRIVATE_KEY_SIZE

◆ ED25519_PUBLIC_KEY_SIZE

#define ED25519_PUBLIC_KEY_SIZE   32

Ed25519 public key size in bytes.

Definition at line 33 of file sizes.h.

Referenced by acds_identity_fingerprint(), acds_identity_generate(), acds_identity_load(), acds_identity_save(), acds_verify_session_create(), acds_verify_session_join(), acip_security_init_options(), add_known_host(), add_known_host(), check_known_host(), check_known_host(), check_known_host_with_key(), check_known_host_with_key(), client_crypto_init(), compute_key_fingerprint(), compute_key_fingerprint(), crypto_handshake_client_key_exchange(), crypto_handshake_server_auth_challenge(), crypto_handshake_server_send_parameters(), crypto_handshake_server_start(), crypto_handshake_validate_packet_size(), database_session_add_key(), database_session_get_keys(), database_session_lookup(), database_session_revoke_key(), database_session_verify_key(), discovery_keys_download_https(), discovery_keys_load_cached(), discovery_keys_load_file(), discovery_keys_save_cached(), discovery_keys_verify(), discovery_keys_verify_change(), discovery_session_create(), discovery_session_start(), display_mitm_warning(), display_mitm_warning(), ed25519_sign_message(), ed25519_to_x25519_private(), ed25519_to_x25519_public(), ed25519_to_x25519_public(), ed25519_verify_signature(), ed25519_verify_signature(), extract_ed25519_from_gpg(), gpg_get_public_key(), gpg_to_x25519_public(), hex_to_pubkey(), key_fingerprint_digest(), key_fingerprint_digest(), openpgp_extract_ed25519_from_mpi(), openpgp_extract_ed25519_from_mpi(), openpgp_parse_armored_pubkey(), openpgp_parse_armored_pubkey(), openpgp_parse_armored_seckey(), openpgp_parse_armored_seckey(), openpgp_parse_binary_pubkey(), openpgp_parse_binary_pubkey(), openpgp_parse_binary_seckey(), openpgp_parse_binary_seckey(), openpgp_parse_public_key_packet(), openpgp_parse_secret_key_packet(), parse_gpg_key(), parse_gpg_key_binary(), parse_private_key(), parse_ssh_ed25519_line(), parse_ssh_ed25519_line(), peer_crypto_create(), peer_crypto_receive(), prompt_unknown_host(), prompt_unknown_host(), pubkey_to_hex(), ssh_agent_add_key(), and ssh_agent_sign().

◆ ED25519_SEED_SIZE

#define ED25519_SEED_SIZE   32

Raw Ed25519 seeds used by OpenPGP, before expansion to a secret key.

Definition at line 165 of file sizes.h.

Referenced by openpgp_parse_armored_seckey(), openpgp_parse_armored_seckey(), openpgp_parse_binary_seckey(), openpgp_parse_binary_seckey(), parse_private_key(), peer_crypto_create(), and ssh_agent_add_key().

◆ ED25519_SIGNATURE_PART_SIZE

#define ED25519_SIGNATURE_PART_SIZE   (ED25519_SIGNATURE_SIZE / 2)

Definition at line 7 of file sizes.h.

Referenced by gpg_agent_sign().

◆ ED25519_SIGNATURE_SIZE

◆ GPG_FINGERPRINT_HEX_BUFFER_SIZE

#define GPG_FINGERPRINT_HEX_BUFFER_SIZE   (GPG_FINGERPRINT_SIZE * 2 + 1)

◆ GPG_FINGERPRINT_SIZE

#define GPG_FINGERPRINT_SIZE   20

OpenPGP v4 fingerprint and long key ID widths.

Definition at line 167 of file sizes.h.

Referenced by get_gpg_fingerprint().

◆ GPG_KEY_ID_HEX_BUFFER_SIZE

#define GPG_KEY_ID_HEX_BUFFER_SIZE   (GPG_KEY_ID_SIZE * 2 + 1)

Definition at line 170 of file sizes.h.

Referenced by parse_gpg_keys_from_response().

◆ GPG_KEY_ID_SIZE

#define GPG_KEY_ID_SIZE   8

Definition at line 169 of file sizes.h.

Referenced by format_gpg_key_display(), and get_gpg_key_id().

◆ GPG_SIGNATURE_PACKET_CAPACITY

#define GPG_SIGNATURE_PACKET_CAPACITY   512

Definition at line 4 of file sizes.h.

Referenced by gpg_sign_detached_ed25519(), and gpg_verify_detached_ed25519().

◆ HEX_STRING_SIZE_32

◆ HEX_STRING_SIZE_64

#define HEX_STRING_SIZE_64   (64 * 2 + 1)

Hex string size for 64-byte values (128 hex chars + null terminator).

Definition at line 156 of file sizes.h.

Referenced by crypto_handshake_client_key_exchange(), and gpg_agent_sign().

◆ HMAC_SHA256_KEY_SIZE

#define HMAC_SHA256_KEY_SIZE   32

◆ HMAC_SHA256_SIZE

◆ MAX_AUTH_FAILED_PACKET_SIZE

#define MAX_AUTH_FAILED_PACKET_SIZE   256

Maximum AUTH_FAILED packet size (256 bytes).

Definition at line 142 of file sizes.h.

Referenced by crypto_handshake_validate_packet_size().

◆ MAX_COMMENT_LEN

#define MAX_COMMENT_LEN   256

Existing text storage budgets, including NUL.

Definition at line 172 of file sizes.h.

Referenced by validate_private_key(), and validate_public_key().

◆ MAX_ENCRYPTED_PACKET_SIZE

#define MAX_ENCRYPTED_PACKET_SIZE   65536

Maximum encrypted packet size (64KB).

Definition at line 144 of file sizes.h.

Referenced by crypto_handshake_validate_packet_size().

◆ MAX_GPG_KEYGRIP_LEN

#define MAX_GPG_KEYGRIP_LEN   64

Definition at line 173 of file sizes.h.

Referenced by extract_ed25519_from_gpg(), and parse_private_key().

◆ MAX_PASSWORD_LENGTH

#define MAX_PASSWORD_LENGTH   256

Maximum password length (256 characters).

Definition at line 21 of file sizes.h.

Referenced by crypto_validate_password().

◆ MIN_PASSWORD_LENGTH

#define MIN_PASSWORD_LENGTH   8

Minimum password length (8 characters).

Definition at line 19 of file sizes.h.

Referenced by crypto_validate_password().

◆ PASSWORD_BUFFER_SIZE

#define PASSWORD_BUFFER_SIZE   256

Password input buffer size (256 bytes).

Definition at line 158 of file sizes.h.

Referenced by client_connection_start(), crypto_handshake_client_auth_response(), session_connection_establish(), and session_participant_connect().

◆ POLY1305_MAC_SIZE

#define POLY1305_MAC_SIZE   16

Poly1305 MAC size in bytes.

Definition at line 41 of file sizes.h.

Referenced by crypto_handshake_server_send_parameters(), and crypto_init().

◆ SECRETBOX_KEY_SIZE

#define SECRETBOX_KEY_SIZE   32

Secretbox key size in bytes.

Definition at line 49 of file sizes.h.

Referenced by crypto_derive_password_encryption_key(), crypto_init(), and crypto_verify_password().

◆ SERVER_AUTH_RESPONSE_SIZE

#define SERVER_AUTH_RESPONSE_SIZE   AUTH_HMAC_SIZE

Server authentication response size (32 bytes).

Definition at line 134 of file sizes.h.

◆ X25519_KEY_SIZE

◆ XSALSA20_NONCE_SIZE

#define XSALSA20_NONCE_SIZE   24

XSalsa20 nonce size in bytes.

Definition at line 39 of file sizes.h.

Referenced by crypto_encrypt(), crypto_handshake_server_send_parameters(), and crypto_init().

◆ ZERO_KEY_SIZE

#define ZERO_KEY_SIZE   X25519_KEY_SIZE

Zero key array size (32 bytes, used for no-identity entries).

Definition at line 160 of file sizes.h.

Referenced by crypto_handshake_client_key_exchange().