Don't compile MD4, MD5, SHA-2 and SHA-3 into qmake

We just need one digest algorithm, any algorithm, to generate a
somewhat unique identifier. SHA-1 will suffice.

Change-Id: I3cb26bf866d616df3ef32feace10934f19daa1a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Thiago Macieira 2013-08-13 13:38:45 -07:00 committed by The Qt Project
parent a8467780fb
commit d5ed6936be
7 changed files with 9 additions and 9 deletions

View File

@ -92,7 +92,8 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-I$(SOURCE_PATH)/tools/shared \ -I$(SOURCE_PATH)/tools/shared \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DQT_CRYPTOGRAPHICHASH_ONLY_SHA1
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS) CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS)

View File

@ -41,7 +41,7 @@ CFLAGS_BARE = -c -Fo./ \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DUNICODE -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1
CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS) CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS)
CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS_BARE = $(CFLAGS_BARE)

View File

@ -44,7 +44,6 @@
#include "meta.h" #include "meta.h"
#include <qdir.h> #include <qdir.h>
#include <qregexp.h> #include <qregexp.h>
#include <qcryptographichash.h>
#include <qdebug.h> #include <qdebug.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>

View File

@ -66,9 +66,9 @@ QT_BEGIN_NAMESPACE
using namespace QMakeInternal; using namespace QMakeInternal;
static QString qtMD5(const QByteArray &src) static QString qtSha1(const QByteArray &src)
{ {
QByteArray digest = QCryptographicHash::hash(src, QCryptographicHash::Md5); QByteArray digest = QCryptographicHash::hash(src, QCryptographicHash::Sha1);
return QString::fromLatin1(digest.toHex()); return QString::fromLatin1(digest.toHex());
} }
@ -1545,7 +1545,7 @@ ProjectBuilderMakefileGenerator::keyFor(const QString &block)
#endif #endif
QString ret; QString ret;
if(!keys.contains(block)) { if(!keys.contains(block)) {
ret = qtMD5(block.toUtf8()).left(24).toUpper(); ret = qtSha1(block.toUtf8()).left(24).toUpper();
keys.insert(block, ret); keys.insert(block, ret);
} else { } else {
ret = keys[block]; ret = keys[block];

View File

@ -340,7 +340,7 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename)
// If none, create one based on the MD5 of absolute project path // If none, create one based on the MD5 of absolute project path
if(uuid.isNull() || !filename.isEmpty()) { if(uuid.isNull() || !filename.isEmpty()) {
QString abspath = Option::fixPathToLocalOS(filename.isEmpty()?project->first("QMAKE_MAKEFILE").toQString():filename); QString abspath = Option::fixPathToLocalOS(filename.isEmpty()?project->first("QMAKE_MAKEFILE").toQString():filename);
QByteArray digest = QCryptographicHash::hash(abspath.toUtf8(), QCryptographicHash::Md5); QByteArray digest = QCryptographicHash::hash(abspath.toUtf8(), QCryptographicHash::Sha1);
memcpy((unsigned char*)(&uuid), digest.constData(), sizeof(QUuid)); memcpy((unsigned char*)(&uuid), digest.constData(), sizeof(QUuid));
validUUID = !uuid.isNull(); validUUID = !uuid.isNull();
uuid.data4[0] = (uuid.data4[0] & 0x3F) | 0x80; // UV_DCE variant uuid.data4[0] = (uuid.data4[0] & 0x3F) | 0x80; // UV_DCE variant

View File

@ -147,7 +147,7 @@ bootstrap { #Qt code
CFLAGS += -fhonor-std CFLAGS += -fhonor-std
LFLAGS += -lcpp LFLAGS += -lcpp
} }
DEFINES *= QT_NO_QOBJECT DEFINES *= QT_NO_QOBJECT QT_CRYPTOGRAPHICHASH_ONLY_SHA1
} else { } else {
CONFIG += qt CONFIG += qt
QT = core QT = core

View File

@ -46,7 +46,7 @@
#include "../../3rdparty/sha1/sha1.cpp" #include "../../3rdparty/sha1/sha1.cpp"
#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
// qdoc only needs SHA-1 // qdoc and qmake only need SHA-1
#include "../../3rdparty/md5/md5.h" #include "../../3rdparty/md5/md5.h"
#include "../../3rdparty/md5/md5.cpp" #include "../../3rdparty/md5/md5.cpp"
#include "../../3rdparty/md4/md4.h" #include "../../3rdparty/md4/md4.h"