X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=crypto.h;h=ddc00a92cd24e00455e4a69b30acecd120ca7548;hb=4705a94a33f9d320ee8db58f91c1bf01ea3fbbd4;hp=e7e77c603a0939c5481345c911ca710ec94a9e0f;hpb=f7f3c8ac391aa197c33579aa4d9997dbc0712063;p=xonotic%2Fdarkplaces.git diff --git a/crypto.h b/crypto.h index e7e77c60..ddc00a92 100644 --- a/crypto.h +++ b/crypto.h @@ -31,7 +31,10 @@ crypto_t; void Crypto_Init(void); void Crypto_Init_Commands(void); +void Crypto_LoadKeys(void); // NOTE: when this is called, the SV_LockThreadMutex MUST be active void Crypto_Shutdown(void); +qboolean Crypto_Available(void); +void sha256(unsigned char *out, const unsigned char *in, int n); // may ONLY be called if Crypto_Available() 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); 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); #define CRYPTO_NOMATCH 0 // process as usual (packet was not used) @@ -51,9 +54,10 @@ const char *Crypto_GetInfoResponseDataString(void); // retrieves a host key for an address (can be exposed to menuqc, or used by the engine to look up stored keys e.g. for server bookmarking) // pointers may be NULL qboolean Crypto_RetrieveHostKey(lhnetaddress_t *peeraddress, int *keyid, char *keyfp, size_t keyfplen, char *idfp, size_t idfplen, int *aeslevel); -int Crypto_RetrieveLocalKey(int keyid, char *keyfp, size_t keyfplen, char *idfp, size_t idfplen); // return value: -1 if more to come, +1 if valid, 0 if end of list +int Crypto_RetrieveLocalKey(int keyid, char *keyfp, size_t keyfplen, char *idfp, size_t idfplen, qboolean *issigned); // return value: -1 if more to come, +1 if valid, 0 if end of list 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); // netconn protocol: // non-crypto: