Index: code/qcommon/md4.c =================================================================== --- code/qcommon/md4.c (revision 1568) +++ code/qcommon/md4.c (working copy) @@ -30,6 +30,19 @@ #include "q_shared.h" #include "qcommon.h" +#ifdef USE_OPENSSL + +#include + +unsigned Com_BlockChecksum (const void *buffer, int length) +{ + int digest[4]; + MD4((unsigned char *)buffer, length, (unsigned char *)digest); + return digest[0] ^ digest[1] ^ digest[2] ^ digest[3]; +} + +#else /* !USE_OPENSSL */ + struct mdfour { uint32_t A, B, C, D; uint32_t totalN; @@ -206,3 +219,5 @@ return val; } + +#endif /* USE_OPENSSL */ Index: code/qcommon/md5.c =================================================================== --- code/qcommon/md5.c (revision 1568) +++ code/qcommon/md5.c (working copy) @@ -17,6 +17,16 @@ #include "q_shared.h" #include "qcommon.h" +#ifdef USE_OPENSSL + +#include + +#define MD5Init MD5_Init +#define MD5Update MD5_Update +#define MD5Final(ctx, digest) MD5_Final(digest, ctx) /* swap arguments */ + +#else /* !USE_OPENSSL */ + typedef struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; @@ -256,6 +266,7 @@ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } +#endif /* USE_OPENSSL */ char *Com_MD5File( const char *fn, int length, const char *prefix, int prefix_len ) { Index: Makefile =================================================================== --- Makefile (revision 1568) +++ Makefile (working copy) @@ -254,6 +254,11 @@ endif endif + ifeq ($(USE_OPENSSL),1) + BASE_CFLAGS += -DUSE_OPENSSL + LDFLAGS += -lcrypto + endif + ifeq ($(USE_CURL),1) BASE_CFLAGS += -DUSE_CURL ifeq ($(USE_CURL_DLOPEN),1) @@ -382,6 +387,11 @@ endif endif + ifeq ($(USE_OPENSSL),1) + BASE_CFLAGS += -DUSE_OPENSSL + LDFLAGS += -lcrypto + endif + ifeq ($(USE_CURL),1) BASE_CFLAGS += -DUSE_CURL ifneq ($(USE_CURL_DLOPEN),1) @@ -585,6 +595,11 @@ endif endif + ifeq ($(USE_OPENSSL),1) + BASE_CFLAGS += -DUSE_OPENSSL + LDFLAGS += -lcrypto + endif + ifeq ($(USE_CODEC_VORBIS),1) CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif @@ -641,6 +656,11 @@ endif endif + ifeq ($(USE_OPENSSL),1) + BASE_CFLAGS += -DUSE_OPENSSL + LDFLAGS += -lcrypto + endif + ifeq ($(USE_CODEC_VORBIS),1) CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif @@ -674,6 +694,11 @@ BUILD_CLIENT = 0 BUILD_GAME_QVM = 0 + ifeq ($(USE_OPENSSL),1) + BASE_CFLAGS += -DUSE_OPENSSL + LDFLAGS += -lcrypto + endif + else # ifeq netbsd #############################################################################