Constant security_claims::ffi::CLAIM_INTERFACE_H

source ยท
pub const CLAIM_INTERFACE_H: &str = "#ifndef TLSPUFFIN_CLAIM_INTERFACE_H\n#define TLSPUFFIN_CLAIM_INTERFACE_H\n\n#define CLAIM_MAX_AVAILABLE_CIPHERS 256\n#define CLAIM_MAX_SECRET_SIZE 64 /* longest known is SHA512 */\n#define CLAIM_SESSION_ID_LENGTH 32\n\ntypedef enum ClaimTLSVersion\n{\n    CLAIM_TLS_VERSION_UNDEFINED = 0,\n    CLAIM_TLS_VERSION_V1_2 = 1,\n    CLAIM_TLS_VERSION_V1_3 = 2,\n} TLSVersion;\n\ntypedef enum ClaimType\n{\n    CLAIM_NOT_SET = -1,\n    CLAIM_UNKNOWN,\n\n    // Transcript types\n    CLAIM_TRANSCRIPT_UNKNOWN,\n    CLAIM_TRANSCRIPT_CH,\n    CLAIM_TRANSCRIPT_PARTIAL_CH,\n    CLAIM_TRANSCRIPT_CH_SH,\n    CLAIM_TRANSCRIPT_CH_SERVER_FIN,\n    CLAIM_TRANSCRIPT_CH_CERT,\n    CLAIM_TRANSCRIPT_CH_CLIENT_FIN,\n\n    // client types\n    CLAIM_CLIENT_HELLO,\n    CLAIM_CCS,\n    CLAIM_END_OF_EARLY_DATA,\n    CLAIM_CERTIFICATE,\n    CLAIM_KEY_EXCHANGE,\n    CLAIM_CERTIFICATE_VERIFY,\n    CLAIM_FINISHED,\n    CLAIM_KEY_UPDATE,\n\n    // Additional Server types\n    CLAIM_HELLO_REQUEST,\n    CLAIM_SERVER_HELLO,\n    CLAIM_CERTIFICATE_REQUEST,\n    CLAIM_SERVER_DONE,\n    CLAIM_SESSION_TICKET,\n    CLAIM_CERTIFICATE_STATUS,\n    CLAIM_EARLY_DATA,\n    CLAIM_ENCRYPTED_EXTENSIONS,\n} ClaimType;\n\ntypedef enum ClaimKeyType\n{\n    CLAIM_KEY_TYPE_NOT_SET,\n    CLAIM_KEY_TYPE_UNKNOWN,\n    CLAIM_KEY_TYPE_DSA,\n    CLAIM_KEY_TYPE_RSA,\n    CLAIM_KEY_TYPE_DH,\n    CLAIM_KEY_TYPE_EC,\n    CLAIM_KEY_TYPE_POLY1305,\n    CLAIM_KEY_TYPE_SIPHASH,\n    CLAIM_KEY_TYPE_X25519,\n    CLAIM_KEY_TYPE_ED25519,\n    CLAIM_KEY_TYPE_X448,\n    CLAIM_KEY_TYPE_ED448,\n} ClaimKeyType;\n\ntypedef struct ClaimSecret\n{\n    unsigned char secret[CLAIM_MAX_SECRET_SIZE];\n} ClaimSecret;\n\ntypedef struct ClaimCertData\n{\n    ClaimKeyType key_type;\n    int key_length;\n} ClaimCertData;\n\ntypedef struct ClaimCipher\n{\n    unsigned short data;\n} ClaimCipher;\n\ntypedef struct ClaimCiphers\n{\n    // OpenSSL 1.1.1k supports 60 ciphers on arch linux, add roughly double the space here\n    int length;\n    ClaimCipher ciphers[CLAIM_MAX_AVAILABLE_CIPHERS];\n} ClaimCiphers;\n\ntypedef struct ClaimVersion\n{\n    TLSVersion data;\n} ClaimVersion;\n\ntypedef struct ClaimRandom\n{\n    unsigned char data[CLAIM_SESSION_ID_LENGTH];\n} ClaimRandom;\n\ntypedef struct ClaimSessionId\n{\n    int length;\n    unsigned char data[CLAIM_SESSION_ID_LENGTH];\n} ClaimSessionId;\n\ntypedef struct ClaimTranscript\n{\n    int length;\n    unsigned char data[CLAIM_MAX_SECRET_SIZE]; // it contains a hash -> use CLAIM_MAX_SECRET_SIZE\n} ClaimTranscript;\n\ntypedef struct Claim\n{\n    ClaimType typ;\n\n    // writing or processing messages\n    int write;\n\n    ClaimVersion version;\n\n    int server;\n\n    // Session ID\n    ClaimSessionId session_id;\n\n    // Randoms\n    ClaimRandom server_random;\n    ClaimRandom client_random;\n\n    // Cert info\n    ClaimCertData cert;\n    ClaimCertData peer_cert;\n\n    // Peer ephemeral key\n    ClaimKeyType peer_tmp_skey_type;\n    int peer_tmp_skey_security_bits;\n\n    // Ephemeral key\n    ClaimKeyType tmp_skey_type;\n    int tmp_skey_group_id;\n\n    int signature_algorithm;\n    int peer_signature_algorithm;\n\n    // The TLS1.3 secrets.\n    ClaimSecret early_secret;\n    ClaimSecret handshake_secret;\n    ClaimSecret master_secret;\n    ClaimSecret resumption_master_secret;\n    ClaimSecret client_finished_secret;\n    ClaimSecret server_finished_secret;\n    ClaimSecret server_finished_hash;\n    ClaimSecret handshake_traffic_hash;\n    ClaimSecret client_app_traffic_secret;\n    ClaimSecret server_app_traffic_secret;\n    ClaimSecret exporter_master_secret;\n    ClaimSecret early_exporter_master_secret;\n\n    // TLS 1.2\n    ClaimSecret master_secret_12;\n\n    // Ciphers\n    ClaimCiphers available_ciphers;\n    ClaimCipher chosen_cipher;\n\n    // Transcript\n    ClaimTranscript transcript;\n} Claim;\n\ntypedef void (*claim_t)(Claim claim, void *ctx);\n\n/**\n * registers a\n *\n * @param claim function which is called each time a claim is made\n * @param ctx the ctx to pass along\n */\nvoid register_claimer(const void *tls_like, claim_t claimer, void *ctx);\n\n/**\n * Sets the internal callbacks to NULL and returns the reference to the claimer\n */\nvoid *deregister_claimer(const void *tls_like);\n\n#endif // TLSPUFFIN_CLAIM_INTERFACE_H\n";