summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-01-14 22:55:37 +0000
committerpixel <pixel>2008-01-14 22:55:37 +0000
commita578df37ca8c4c130f28ccfd12948bc2fe429526 (patch)
treee1d35930f3d61e782886c3f8d9af182cc2ac78d0
parent5847522b96b2bd991c36c9f29638fe9b1c96f984 (diff)
Removing the need for the libssl.
-rw-r--r--MPQCryptography.c8
-rw-r--r--Makefile2
2 files changed, 9 insertions, 1 deletions
diff --git a/MPQCryptography.c b/MPQCryptography.c
index 464a410..9791c0a 100644
--- a/MPQCryptography.c
+++ b/MPQCryptography.c
@@ -16,11 +16,13 @@
#include <string.h>
#include <zlib.h>
+#ifdef USE_SSL
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/md5.h>
#include <openssl/obj_mac.h>
#include <openssl/sha.h>
+#endif
#include "MPQCryptography.h"
#include "inttypes.h"
@@ -31,6 +33,7 @@ static uint32_t crypt_table[0x500];
/****TODO****/
/* Re-implement various endianess fixes. */
+#ifdef USE_SSL
static void memrev(unsigned char *buf, size_t count)
{
unsigned char *r;
@@ -41,6 +44,7 @@ static void memrev(unsigned char *buf, size_t count)
*buf ^= *r;
}
}
+#endif
const uint32_t *__mpqlib_get_cryptography_table()
{
@@ -74,10 +78,12 @@ void __mpqlib_init_cryptography()
}
}
// Load up OpenSSL
+#ifdef USE_SSL
OpenSSL_add_all_digests();
OpenSSL_add_all_algorithms();
OpenSSL_add_all_ciphers();
ERR_load_crypto_strings();
+#endif
}
void __mpqlib_encrypt(void *_data, uint32_t length, uint32_t key, bool disable_input_swapping)
@@ -225,6 +231,7 @@ void __mpqlib_crc32(const unsigned char *buffer, uint32_t length, uint32_t * crc
*crc = local_crc;
}
+#ifdef USE_SSL
int __mpqlib_verify_weak_signature(RSA * public_key, const unsigned char *signature, const unsigned char *digest)
{
unsigned char reversed_signature[__MPQLIB_WEAK_SIGNATURE_SIZE];
@@ -257,3 +264,4 @@ int __mpqlib_verify_strong_signature(RSA * public_key, const unsigned char *sign
return (!error && memcmp(reversed_signature, real_digest, __MPQLIB_STRONG_SIGNATURE_SIZE) == 0);
}
+#endif
diff --git a/Makefile b/Makefile
index 45652a4..5900267 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ LD = gcc
AR = ar rcs
CPPFLAGS = -g -Wall -Werror -D_FILE_OFFSET_BITS=64 -I.
-LDFLAGS = -g -lssl
+LDFLAGS = -g
SOURCE_LIST = \
MPQCryptography.c \