Removing dependency to gnutls, only gcrypt is required now.
This commit is contained in:
+5
-4
@@ -323,7 +323,9 @@ win32 {
|
|||||||
-lSDLmain \
|
-lSDLmain \
|
||||||
-ltinyxml \
|
-ltinyxml \
|
||||||
-lz \
|
-lz \
|
||||||
-lgnutls-openssl -lgnutls -lgcrypt -lgpg-error -lgsasl -lidn
|
-lgcrypt \
|
||||||
|
-lgsasl \
|
||||||
|
-lidn
|
||||||
debug:LIBPATH += debug/lib
|
debug:LIBPATH += debug/lib
|
||||||
release:LIBPATH += release/lib
|
release:LIBPATH += release/lib
|
||||||
win32-g++-cross {
|
win32-g++-cross {
|
||||||
@@ -446,14 +448,13 @@ unix:!mac {
|
|||||||
-lSDL_mixer \
|
-lSDL_mixer \
|
||||||
-lgsasl
|
-lgsasl
|
||||||
!isEmpty( BSD ):isEmpty( kFreeBSD ):LIBS += -lcrypto
|
!isEmpty( BSD ):isEmpty( kFreeBSD ):LIBS += -lcrypto
|
||||||
else:LIBS += -lgnutls-openssl \
|
else:LIBS += -lgcrypt
|
||||||
-lgcrypt
|
|
||||||
TARGETDEPS += ./lib/libpokerth_lib.a \
|
TARGETDEPS += ./lib/libpokerth_lib.a \
|
||||||
./lib/libpokerth_db.a \
|
./lib/libpokerth_db.a \
|
||||||
./lib/libpokerth_protocol.a
|
./lib/libpokerth_protocol.a
|
||||||
|
|
||||||
# #### My release static libs
|
# #### My release static libs
|
||||||
# LIBS += -lgcrypt_static -lgpg-error_static -lgnutls-openssl_static -lgnutls_static -lSDL_mixer_static -lSDL -lmikmod -lcurl
|
# LIBS += -lgcrypt_static -lSDL_mixer_static -lSDL -lmikmod -lcurl
|
||||||
# ### INSTALL ####
|
# ### INSTALL ####
|
||||||
binary.path += $${PREFIX}/bin/
|
binary.path += $${PREFIX}/bin/
|
||||||
binary.files += pokerth
|
binary.files += pokerth
|
||||||
|
|||||||
+2
-2
@@ -126,7 +126,7 @@ win32 {
|
|||||||
debug:LIBPATH += debug/lib
|
debug:LIBPATH += debug/lib
|
||||||
release:LIBPATH += release/lib
|
release:LIBPATH += release/lib
|
||||||
|
|
||||||
LIBS += -lgnutls-openssl -lgnutls -lgcrypt -lgpg-error -lgsasl -lidn -ltinyxml
|
LIBS += -lgcrypt -lgsasl -lidn -ltinyxml
|
||||||
win32-g++-cross {
|
win32-g++-cross {
|
||||||
LIBS += -lsqlite3
|
LIBS += -lsqlite3
|
||||||
LIBS += -lntlm
|
LIBS += -lntlm
|
||||||
@@ -269,7 +269,7 @@ unix : !mac {
|
|||||||
!isEmpty( BSD ): isEmpty( kFreeBSD ){
|
!isEmpty( BSD ): isEmpty( kFreeBSD ){
|
||||||
LIBS += -lcrypto -liconv
|
LIBS += -lcrypto -liconv
|
||||||
} else {
|
} else {
|
||||||
LIBS += -lgnutls-openssl -lgcrypt
|
LIBS += -lgcrypt
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGETDEPS += ./lib/libpokerth_lib.a \
|
TARGETDEPS += ./lib/libpokerth_lib.a \
|
||||||
|
|||||||
@@ -165,16 +165,29 @@ CryptHelper::MD5Sum(const std::string &fileName, MD5Buf &buf)
|
|||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
// Calculate MD5 sum of file.
|
// Calculate MD5 sum of file.
|
||||||
unsigned char readBuf[8192];
|
unsigned char *readBuf = new unsigned char[8192];
|
||||||
MD5_CTX context;
|
|
||||||
int numBytes;
|
int numBytes;
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENSSL
|
||||||
|
MD5_CTX context;
|
||||||
MD5_Init(&context);
|
MD5_Init(&context);
|
||||||
while ((numBytes = fread(readBuf, 1, sizeof(readBuf), file)) > 0)
|
while ((numBytes = fread(readBuf, 1, sizeof(readBuf), file)) > 0) {
|
||||||
MD5_Update(&context, readBuf, numBytes);
|
MD5_Update(&context, readBuf, numBytes);
|
||||||
|
}
|
||||||
MD5_Final(buf.GetData(), &context);
|
MD5_Final(buf.GetData(), &context);
|
||||||
|
#else
|
||||||
|
gcry_md_hd_t hash;
|
||||||
|
gcry_md_open(&hash, GCRY_MD_MD5, 0);
|
||||||
|
while ((numBytes = fread(readBuf, 1, sizeof(readBuf), file)) > 0) {
|
||||||
|
gcry_md_write(hash, readBuf, numBytes);
|
||||||
|
}
|
||||||
|
memcpy(buf.GetData(), gcry_md_read(hash, GCRY_MD_MD5), MD5_DATA_SIZE);
|
||||||
|
gcry_md_close(hash);
|
||||||
|
#endif
|
||||||
|
|
||||||
retVal = ferror(file) == 0;
|
retVal = ferror(file) == 0;
|
||||||
|
|
||||||
|
delete[] readBuf;
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|||||||
@@ -67,10 +67,8 @@ typedef int pid_t;
|
|||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#else
|
#else
|
||||||
// For all other systems, we use GnuTLS.
|
// For all other systems, we use gcrypt.
|
||||||
#include <gnutls/openssl.h>
|
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
#define PKTH_USE_GNUTLS
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -109,9 +109,13 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
|||||||
int counter(0);
|
int counter(0);
|
||||||
while(counter < howMany) {
|
while(counter < howMany) {
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENSSL
|
||||||
if(!RAND_bytes(rand_buf, 4)) {
|
if(!RAND_bytes(rand_buf, 4)) {
|
||||||
LOG_MSG("RAND_bytes failed!");
|
LOG_MSG("RAND_bytes failed!");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
gcry_randomize(rand_buf, 4, GCRY_VERY_STRONG_RANDOM);
|
||||||
|
#endif
|
||||||
|
|
||||||
randNumber = 0;
|
randNumber = 0;
|
||||||
for(i=0; i<4; i++) {
|
for(i=0; i<4; i++) {
|
||||||
@@ -138,9 +142,13 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
|||||||
int counter(0);
|
int counter(0);
|
||||||
while (counter < howMany) {
|
while (counter < howMany) {
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENSSL
|
||||||
if(!RAND_bytes(rand_buf, 4)) {
|
if(!RAND_bytes(rand_buf, 4)) {
|
||||||
LOG_MSG("RAND_bytes failed!");
|
LOG_MSG("RAND_bytes failed!");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
gcry_randomize(rand_buf, 4, GCRY_VERY_STRONG_RANDOM);
|
||||||
|
#endif
|
||||||
|
|
||||||
randNumber = 0;
|
randNumber = 0;
|
||||||
for(i=0; i<4; i++) {
|
for(i=0; i<4; i++) {
|
||||||
|
|||||||
@@ -23,9 +23,7 @@
|
|||||||
#include <net/socket_startup.h>
|
#include <net/socket_startup.h>
|
||||||
#include <core/openssl_wrapper.h>
|
#include <core/openssl_wrapper.h>
|
||||||
|
|
||||||
#ifdef PKTH_USE_GNUTLS
|
#ifndef HAVE_OPENSSL
|
||||||
|
|
||||||
#include <gcrypt.h>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -60,16 +58,20 @@ extern "C" {
|
|||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // PKTH_USE_GNUTLS
|
#endif // not HAVE_OPENSSL
|
||||||
|
|
||||||
bool
|
bool
|
||||||
socket_startup()
|
socket_startup()
|
||||||
{
|
{
|
||||||
#ifdef PKTH_USE_GNUTLS
|
#ifdef HAVE_OPENSSL
|
||||||
|
return SSL_library_init() == 1;
|
||||||
|
#else
|
||||||
|
gcry_check_version(NULL);
|
||||||
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_boost);
|
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_boost);
|
||||||
gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
|
gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
|
||||||
|
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
|
||||||
|
return true;
|
||||||
#endif
|
#endif
|
||||||
return SSL_library_init() == 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user