]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - crypto.h
fs: Stub a struct that'll be used later.
[xonotic/darkplaces.git] / crypto.h
index 0a2d4869cea4679813929d6c33da8b85acd2da36..2d97948a7203e009d7d6a8b774f45d36d66232bc 100644 (file)
--- a/crypto.h
+++ b/crypto.h
@@ -1,6 +1,11 @@
 #ifndef CRYPTO_H
 #define CRYPTO_H
 
+#include <stddef.h>
+#include "qtypes.h"
+#include "cvar.h"
+#include "lhnet.h"
+
 extern cvar_t crypto_developer;
 extern cvar_t crypto_aeslevel;
 #define ENCRYPTION_REQUIRED (crypto_aeslevel.integer >= 3)
@@ -11,8 +16,6 @@ extern int crypto_keyfp_recommended_length; // applies to LOCAL IDs, and to ALL
 // AES case causes 16 to 31 bytes overhead
 // SHA256 case causes 16 bytes overhead as we truncate to 128bit
 
-#include "lhnet.h"
-
 #define FP64_SIZE 44
 #define DHKEY_SIZE 16
 
@@ -21,12 +24,12 @@ typedef struct
        unsigned char dhkey[DHKEY_SIZE]; // shared key, not NUL terminated
        char client_idfp[FP64_SIZE+1];
        char client_keyfp[FP64_SIZE+1];
-       qboolean client_issigned;
+       qbool client_issigned;
        char server_idfp[FP64_SIZE+1];
        char server_keyfp[FP64_SIZE+1];
-       qboolean server_issigned;
-       qboolean authenticated;
-       qboolean use_aes;
+       qbool server_issigned;
+       qbool authenticated;
+       qbool use_aes;
        void *data;
 }
 crypto_t;
@@ -35,7 +38,7 @@ 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);
+qbool 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);
@@ -48,15 +51,15 @@ int Crypto_ServerParsePacket(const char *data_in, size_t len_in, char *data_out,
 
 // if len_out is nonzero, the packet is to be sent to the client
 
-qboolean Crypto_ServerAppendToChallenge(const char *data_in, size_t len_in, char *data_out, size_t *len_out, size_t maxlen);
+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(lhnetaddress_t *peeraddress);
-qboolean Crypto_FinishInstance(crypto_t *out, crypto_t *in); // also clears allocated memory, and frees the instance received by ServerGetInstance
+qbool Crypto_FinishInstance(crypto_t *out, crypto_t *in); // also clears allocated memory, and frees the instance received by ServerGetInstance
 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, qboolean *issigned);
-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
+qbool Crypto_RetrieveHostKey(lhnetaddress_t *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); // 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);