]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Add support for forcing d0_blind_id and d0_rijndael to never be dlopen'd
authorSimon McVittie <smcv@debian.org>
Fri, 20 Jan 2012 09:24:18 +0000 (09:24 +0000)
committernyov <nyov@nexnode.net>
Thu, 27 Nov 2014 09:55:23 +0000 (09:55 +0000)
Until these libraries exist as Debian packages, we'd prefer a local copy
(which might not be compatible) to never be loaded accidentally.

Origin: vendor, Debian

crypto.c
makefile

index 30f8554593991bbe6b6fa1cfc1a4b0a5e3d1c6e7..7a0cc16ac65261eac5b995bd1459e4a02f26b8f9 100644 (file)
--- a/crypto.c
+++ b/crypto.c
@@ -209,6 +209,8 @@ static D0_EXPORT void (*qd0_blind_id_setmallocfuncs)(d0_malloc_t *m, d0_free_t *
 static D0_EXPORT void (*qd0_blind_id_setmutexfuncs)(d0_createmutex_t *c, d0_destroymutex_t *d, d0_lockmutex_t *l, d0_unlockmutex_t *u);
 static D0_EXPORT D0_WARN_UNUSED_RESULT D0_BOOL (*qd0_blind_id_verify_public_id)(const d0_blind_id_t *ctx, D0_BOOL *status);
 static D0_EXPORT D0_WARN_UNUSED_RESULT D0_BOOL (*qd0_blind_id_verify_private_id)(const d0_blind_id_t *ctx);
+
+#ifndef DISABLE_D0_BLIND_ID
 static dllfunction_t d0_blind_id_funcs[] =
 {
        {"d0_blind_id_new", (void **) &qd0_blind_id_new},
@@ -252,11 +254,15 @@ static dllfunction_t d0_blind_id_funcs[] =
        {"d0_blind_id_verify_private_id", (void **) &qd0_blind_id_verify_private_id},
        {NULL, NULL}
 };
+#endif
 // end of d0_blind_id interface
 
 static dllhandle_t d0_blind_id_dll = NULL;
 static qboolean Crypto_OpenLibrary (void)
 {
+#ifdef DISABLE_D0_BLIND_ID
+       return false;
+#else
        const char* dllnames [] =
        {
 #if defined(WIN32)
@@ -276,11 +282,14 @@ static qboolean Crypto_OpenLibrary (void)
 
        // Load the DLL
        return Sys_LoadLibrary (dllnames, &d0_blind_id_dll, d0_blind_id_funcs);
+#endif
 }
 
 static void Crypto_CloseLibrary (void)
 {
+#ifndef DISABLE_D0_BLIND_ID
        Sys_UnloadLibrary (&d0_blind_id_dll);
+#endif
 }
 
 #endif
@@ -313,6 +322,8 @@ D0_EXPORT void (*qd0_rijndael_decrypt) (const unsigned long *rk, int nrounds,
 #define D0_RIJNDAEL_KEYLENGTH(keybits) ((keybits)/8)
 #define D0_RIJNDAEL_RKLENGTH(keybits)  ((keybits)/8+28)
 #define D0_RIJNDAEL_NROUNDS(keybits)   ((keybits)/32+6)
+
+#ifndef DISABLE_D0_RIJNDAEL
 static dllfunction_t d0_rijndael_funcs[] =
 {
        {"d0_rijndael_setup_decrypt", (void **) &qd0_rijndael_setup_decrypt},
@@ -321,11 +332,15 @@ static dllfunction_t d0_rijndael_funcs[] =
        {"d0_rijndael_encrypt", (void **) &qd0_rijndael_encrypt},
        {NULL, NULL}
 };
+#endif
 // end of d0_blind_id interface
 
 static dllhandle_t d0_rijndael_dll = NULL;
 static qboolean Crypto_Rijndael_OpenLibrary (void)
 {
+#ifdef DISABLE_D0_RIJNDAEL
+       return false;
+#else
        const char* dllnames [] =
        {
 #if defined(WIN32)
@@ -345,11 +360,14 @@ static qboolean Crypto_Rijndael_OpenLibrary (void)
 
        // Load the DLL
        return Sys_LoadLibrary (dllnames, &d0_rijndael_dll, d0_rijndael_funcs);
+#endif
 }
 
 static void Crypto_Rijndael_CloseLibrary (void)
 {
+#ifndef DISABLE_D0_RIJNDAEL
        Sys_UnloadLibrary (&d0_rijndael_dll);
+#endif
 }
 
 #endif
index 7a4d33b0d562d76f2251e080f4d6b5f941d37245..e74cce2a791658d952dc1af9ba535615fe002f51 100644 (file)
--- a/makefile
+++ b/makefile
@@ -310,11 +310,21 @@ endif
 ifdef LINK_TO_D0_BLIND_ID
 CFLAGS_CRYPTO=-DLINK_TO_D0_BLIND_ID `pkg-config --cflags d0_blind_id`
 LIB_CRYPTO=`pkg-config --libs d0_blind_id`
+else
+ifdef DISABLE_D0_BLIND_ID
+CFLAGS_CRYPTO=-DDISABLE_D0_BLIND_ID
+LIB_CRYPTO=
+endif
 endif
 
 ifdef LINK_TO_D0_RIJNDAEL
 CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_D0_RIJNDAEL `pkg-config --cflags d0_rijndael`
 LIB_CRYPTO_RIJNDAEL=`pkg-config --libs d0_rijndael`
+else
+ifdef DISABLE_D0_RIJNDAEL
+CFLAGS_CRYPTO_RIJNDAEL=-DDISABLE_D0_RIJNDAEL
+LIB_CRYPTO_RIJNDAEL=
+endif
 endif
 
 ifdef LINK_TO_FREETYPE2