![]() |
DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
|
|
Go to the source code of this file.
Data Structures | |
struct | crypto_t |
Macros | |
#define | CRYPTO_DISCARD 2 |
#define | CRYPTO_HEADERSIZE 31 |
#define | CRYPTO_MATCH 1 |
#define | CRYPTO_NOMATCH 0 |
#define | CRYPTO_REPLACE 3 |
#define | DHKEY_SIZE 16 |
#define | ENCRYPTION_REQUIRED (crypto_aeslevel.integer >= 3) |
#define | FP64_SIZE 44 |
Functions | |
qbool | Crypto_Available (void) |
int | Crypto_ClientParsePacket (const char *data_in, size_t len_in, char *data_out, size_t *len_out, lhnetaddress_t *peeraddress, const char *peeraddressstring) |
const void * | Crypto_DecryptPacket (crypto_t *crypto, const void *data_src, size_t len_src, void *data_dst, size_t *len_dst, size_t len) |
const void * | Crypto_EncryptPacket (crypto_t *crypto, const void *data_src, size_t len_src, void *data_dst, size_t *len_dst, size_t len) |
qbool | Crypto_FinishInstance (crypto_t *out, crypto_t *in) |
const char * | Crypto_GetInfoResponseDataString (void) |
void | Crypto_Init (void) |
void | Crypto_Init_Commands (void) |
void | Crypto_LoadKeys (void) |
qbool | Crypto_RetrieveHostKey (struct lhnetaddress_s *peeraddress, int *keyid, char *keyfp, size_t keyfplen, char *idfp, size_t idfplen, int *aeslevel, qbool *issigned) |
int | Crypto_RetrieveLocalKey (int keyid, char *keyfp, size_t keyfplen, char *idfp, size_t idfplen, qbool *issigned) |
qbool | Crypto_ServerAppendToChallenge (const char *data_in, size_t len_in, char *data_out, size_t *len_out, size_t maxlen) |
crypto_t * | Crypto_ServerGetInstance (struct lhnetaddress_s *peeraddress) |
int | Crypto_ServerParsePacket (const char *data_in, size_t len_in, char *data_out, size_t *len_out, lhnetaddress_t *peeraddress) |
void | Crypto_Shutdown (void) |
size_t | Crypto_SignData (const void *data, size_t datasize, int keyid, void *signed_data, size_t signed_size) |
size_t | Crypto_SignDataDetached (const void *data, size_t datasize, int keyid, void *signed_data, size_t signed_size) |
void | sha256 (unsigned char *out, const unsigned char *in, int n) |
Variables | |
struct cvar_s | crypto_aeslevel |
struct cvar_s | crypto_developer |
int | crypto_keyfp_recommended_length |
#define CRYPTO_DISCARD 2 |
Definition at line 66 of file crypto.h.
Referenced by Crypto_ClientParsePacket(), Crypto_ServerError(), Crypto_ServerParsePacket(), Crypto_ServerParsePacket_Internal(), Crypto_SoftClientError(), Crypto_SoftServerError(), NetConn_ClientParsePacket(), and NetConn_ServerParsePacket().
#define CRYPTO_HEADERSIZE 31 |
Definition at line 34 of file crypto.h.
Referenced by NetConn_ClientParsePacket(), NetConn_ReceivedMessage(), NetConn_SendUnreliableMessage(), and NetConn_ServerParsePacket().
#define CRYPTO_MATCH 1 |
Definition at line 65 of file crypto.h.
Referenced by Crypto_ServerParsePacket_Internal(), NetConn_ClientParsePacket(), and NetConn_ServerParsePacket().
#define CRYPTO_NOMATCH 0 |
Definition at line 64 of file crypto.h.
Referenced by Crypto_ClientParsePacket(), Crypto_ServerParsePacket_Internal(), NetConn_ClientParsePacket(), and NetConn_ServerParsePacket().
#define CRYPTO_REPLACE 3 |
Definition at line 67 of file crypto.h.
Referenced by Crypto_ClientError(), Crypto_ClientParsePacket(), NetConn_ClientParsePacket(), and NetConn_ServerParsePacket().
#define DHKEY_SIZE 16 |
Definition at line 39 of file crypto.h.
Referenced by aescpy(), Crypto_ClientParsePacket(), Crypto_DecryptPacket(), Crypto_EncryptPacket(), Crypto_ServerParsePacket_Internal(), and seacpy().
#define ENCRYPTION_REQUIRED (crypto_aeslevel.integer >= 3) |
Definition at line 30 of file crypto.h.
Referenced by NetConn_ClientParsePacket(), and NetConn_ServerParsePacket().
#define FP64_SIZE 44 |
Definition at line 38 of file crypto.h.
Referenced by Crypto_ClientParsePacket(), Crypto_KeyGen_f(), Crypto_LoadKeys(), Crypto_ServerParsePacket_Internal(), Crypto_StoreHostKey(), VM_M_crypto_getidfp(), VM_M_crypto_getkeyfp(), VM_M_crypto_getmyidfp(), and VM_M_crypto_getmykeyfp().
Definition at line 1097 of file crypto.c.
References d0_blind_id_dll.
Referenced by checkextension(), and VM_digest_hex().
int Crypto_ClientParsePacket | ( | const char * | data_in, |
size_t | len_in, | ||
char * | data_out, | ||
size_t * | len_out, | ||
lhnetaddress_t * | peeraddress, | ||
const char * | peeraddressstring ) |
Definition at line 2107 of file crypto.c.
References crypto_t::authenticated, bound, BuffLittleLong(), CCREP_PLAYER_INFO, CCREP_RULE_INFO, CCREP_SERVER_INFO, CDATA, cdata_id, CLEAR_CDATA, crypto_t::client_idfp, crypto_t::client_issigned, crypto_t::client_keyfp, cls, client_static_t::connect_address, client_static_t::connect_nextsendtime, client_static_t::connect_trying, client_static_t::crypto, crypto_aeslevel, Crypto_ClientError(), CRYPTO_DISCARD, Crypto_LittleLong(), CRYPTO_NOMATCH, CRYPTO_REPLACE, Crypto_RetrieveHostKey(), Crypto_SoftClientError(), Crypto_StoreHostKey(), d0_blind_id_dll, D0_BOOL, d0_rijndael_dll, crypto_t::dhkey, DHKEY_SIZE, dp_strlcpy, dpsnprintf(), FP64_SIZE, GetUntilNul(), host, i, id, InfoString_GetValue(), cvar_t::integer, LHNETADDRESS_Compare(), MAKE_CDATA, max, MAX_INPUTLINE, MAX_PUBKEYS, net_sourceaddresscheck, NETFLAG_CTL, NULL, PROTOCOL_D0_BLIND_ID, PROTOCOL_VLEN, pubkeys, pubkeys_fp64, pubkeys_havepriv, pubkeys_havesig, pubkeys_priv_fp64, PutWithNul(), qd0_blind_id_authenticate_with_private_id_challenge, qd0_blind_id_authenticate_with_private_id_response, qd0_blind_id_authenticate_with_private_id_start, qd0_blind_id_authenticate_with_private_id_verify, qd0_blind_id_copy, qd0_blind_id_fingerprint64_public_id, qd0_blind_id_new, qd0_blind_id_sessionkey_public_id, host_static_t::realtime, crypto_t::server_idfp, crypto_t::server_issigned, crypto_t::server_keyfp, crypto_t::use_aes, v, and va().
Referenced by NetConn_ClientParsePacket().
const void * Crypto_DecryptPacket | ( | crypto_t * | crypto, |
const void * | data_src, | ||
size_t | len_src, | ||
void * | data_dst, | ||
size_t * | len_dst, | ||
size_t | len ) |
Definition at line 1584 of file crypto.c.
References crypto_t::authenticated, BuffBigLong(), Com_HexDumpToConsole(), Con_Print(), Con_Printf(), developer_networking, crypto_t::dhkey, DHKEY_SIZE, HMAC_SHA256_32BYTES, i, cvar_t::integer, NULL, seacpy(), and crypto_t::use_aes.
Referenced by NetConn_ReceivedMessage().
const void * Crypto_EncryptPacket | ( | crypto_t * | crypto, |
const void * | data_src, | ||
size_t | len_src, | ||
void * | data_dst, | ||
size_t * | len_dst, | ||
size_t | len ) |
Definition at line 1527 of file crypto.c.
References aescpy(), crypto_t::authenticated, BuffBigLong(), Com_HexDumpToConsole(), Con_Print(), Con_Printf(), developer_networking, crypto_t::dhkey, DHKEY_SIZE, HMAC_SHA256_32BYTES, i, cvar_t::integer, NULL, and crypto_t::use_aes.
Referenced by NetConn_ReceivedMessage(), and NetConn_SendUnreliableMessage().
Definition at line 558 of file crypto.c.
References crypto_t::authenticated, CLEAR_CDATA, and Con_Printf().
Referenced by NetConn_ConnectionEstablished(), and NetConn_ServerParsePacket().
const char * Crypto_GetInfoResponseDataString | ( | void | ) |
Definition at line 1689 of file crypto.c.
References crypto_aeslevel, crypto_idstring, crypto_idstring_buf, and cvar_t::integer.
Referenced by NetConn_BuildStatusResponse().
Definition at line 1072 of file crypto.c.
References Con_Printf(), Crypto_CloseLibrary(), Crypto_d0_createmutex(), Crypto_d0_destroymutex(), Crypto_d0_free(), Crypto_d0_lockmutex(), Crypto_d0_malloc(), Crypto_d0_unlockmutex(), Crypto_InitHostKeys(), Crypto_OpenLibrary(), Crypto_Rijndael_CloseLibrary(), Crypto_Rijndael_OpenLibrary(), cryptomempool, Mem_AllocPool, NULL, qd0_blind_id_INITIALIZE, qd0_blind_id_setmallocfuncs, qd0_blind_id_setmutexfuncs, Thread_HasThreads(), and void().
Referenced by Host_Init().
Definition at line 1449 of file crypto.c.
References CF_SHARED, Cmd_AddCommand(), crypto_aeslevel, crypto_developer, Crypto_HostKey_Clear_f(), Crypto_HostKeys_f(), Crypto_KeyGen_f(), Crypto_Keys_f(), Crypto_Reload_f(), crypto_servercpudebug, crypto_servercpumaxtime, crypto_servercpupercent, Cvar_RegisterVariable(), d0_blind_id_dll, d0_rijndael_dll, and cvar_t::integer.
Referenced by Host_Init().
Definition at line 855 of file crypto.c.
References buf, Con_Printf(), Crypto_AddPrivateKey(), Crypto_BuildChallengeAppend(), Crypto_BuildIdString(), crypto_idstring, crypto_keyfp_recommended_length, Crypto_LoadFile(), Crypto_ReadPublicKey(), Crypto_SavePubKeyTextFile(), d0_blind_id_dll, D0_BOOL, FP64_SIZE, Host_LockSession(), i, keygen_i, MAX_PUBKEYS, NULL, pubkeys, pubkeys_fp64, pubkeys_havepriv, pubkeys_havesig, pubkeys_priv_fp64, qd0_blind_id_fingerprint64_public_id, qd0_blind_id_fingerprint64_public_key, qd0_blind_id_free, qd0_blind_id_verify_private_id, qd0_blind_id_verify_public_id, sessionid, cvar_t::string, and va().
Referenced by Crypto_KeyGen_f(), Crypto_Reload_f(), NetConn_OpenClientPorts(), NetConn_OpenServerPorts(), and PRVM_Prog_Load().
qbool Crypto_RetrieveHostKey | ( | struct lhnetaddress_s * | peeraddress, |
int * | keyid, | ||
char * | keyfp, | ||
size_t | keyfplen, | ||
char * | idfp, | ||
size_t | idfplen, | ||
int * | aeslevel, | ||
qbool * | issigned ) |
int Crypto_RetrieveLocalKey | ( | int | keyid, |
char * | keyfp, | ||
size_t | keyfplen, | ||
char * | idfp, | ||
size_t | idfplen, | ||
qbool * | issigned ) |
Definition at line 763 of file crypto.c.
References dp_strlcpy, MAX_PUBKEYS, pubkeys, pubkeys_fp64, pubkeys_havepriv, pubkeys_havesig, and pubkeys_priv_fp64.
Referenced by VM_M_crypto_getmyidfp(), VM_M_crypto_getmyidstatus(), and VM_M_crypto_getmykeyfp().
qbool Crypto_ServerAppendToChallenge | ( | const char * | data_in, |
size_t | len_in, | ||
char * | data_out, | ||
size_t * | len_out, | ||
size_t | maxlen ) |
Definition at line 1696 of file crypto.c.
References challenge_append, challenge_append_length, and d0_blind_id_dll.
Referenced by NetConn_ServerParsePacket().
crypto_t * Crypto_ServerGetInstance | ( | struct lhnetaddress_s * | peeraddress | ) |
int Crypto_ServerParsePacket | ( | const char * | data_in, |
size_t | len_in, | ||
char * | data_out, | ||
size_t * | len_out, | ||
lhnetaddress_t * | peeraddress ) |
Definition at line 2036 of file crypto.c.
References Con_Printf(), CRYPTO_DISCARD, crypto_servercpu_accumulator, crypto_servercpu_lastrealtime, crypto_servercpudebug, crypto_servercpumaxtime, crypto_servercpupercent, Crypto_ServerParsePacket_Internal(), host, InfoString_GetValue(), cvar_t::integer, MAX_INPUTLINE, NULL, host_static_t::realtime, ret, Sys_DirtyTime(), and cvar_t::value.
Referenced by NetConn_ServerParsePacket().
Definition at line 1043 of file crypto.c.
References CLEAR_CDATA, cls, client_static_t::crypto, server_cryptoconnect_t::crypto, Crypto_CloseLibrary(), Crypto_Rijndael_CloseLibrary(), Crypto_UnloadKeys(), cryptoconnects, cryptomempool, d0_blind_id_dll, i, MAX_CRYPTOCONNECTS, Mem_FreePool, and qd0_blind_id_SHUTDOWN.
Referenced by Host_Shutdown().
size_t Crypto_SignData | ( | const void * | data, |
size_t | datasize, | ||
int | keyid, | ||
void * | signed_data, | ||
size_t | signed_size ) |
Definition at line 2634 of file crypto.c.
References data, MAX_PUBKEYS, pubkeys, pubkeys_havepriv, and qd0_blind_id_sign_with_private_id_sign.
size_t Crypto_SignDataDetached | ( | const void * | data, |
size_t | datasize, | ||
int | keyid, | ||
void * | signed_data, | ||
size_t | signed_size ) |
Definition at line 2645 of file crypto.c.
References data, MAX_PUBKEYS, pubkeys, pubkeys_havepriv, and qd0_blind_id_sign_with_private_id_sign_detached.
Referenced by VM_uri_get().
Definition at line 383 of file crypto.c.
References n, and qd0_blind_id_util_sha256.
Referenced by VM_digest_hex().
|
extern |
Definition at line 31 of file crypto.c.
Referenced by Crypto_BuildIdString(), Crypto_ClientParsePacket(), Crypto_GetInfoResponseDataString(), Crypto_Init_Commands(), and Crypto_ServerParsePacket_Internal().
|
extern |
Definition at line 30 of file crypto.c.
Referenced by Crypto_Init_Commands(), and NetConn_ServerParsePacket().
|
extern |
Definition at line 41 of file crypto.c.
Referenced by Crypto_HostKeys_f(), Crypto_LoadKeys(), NetConn_ConnectionEstablished(), NetConn_ServerParsePacket(), and SV_ConnectClient().