summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-27 11:00:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-30 08:39:28 +0200
commitb3db55fa6f2c63fafa421cb217df5038cdd13e98 (patch)
tree63674a83ac0987deecf07caccd7dc23a20038b5e /src
parent68923001279fd3da983dc59e57200e2080cadcb6 (diff)
Remove workaround for MSVC 2008
We don't build on platforms without stdint.h Change-Id: Iee9de3e71a7bcae524f2d1377919cf074a713960 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/rfc6234/sha.h3
-rw-r--r--src/corelib/tools/qcryptographichash.cpp51
-rw-r--r--src/corelib/tools/qmessageauthenticationcode.cpp39
3 files changed, 9 insertions, 84 deletions
diff --git a/src/3rdparty/rfc6234/sha.h b/src/3rdparty/rfc6234/sha.h
index 9c26f0253c..1ffd688079 100644
--- a/src/3rdparty/rfc6234/sha.h
+++ b/src/3rdparty/rfc6234/sha.h
@@ -70,8 +70,7 @@
*
*/
-// stdint.h include commented out by Nokia, it is not available on all platforms.
-// #include <stdint.h>
+#include <stdint.h>
/*
* If you do not have the ISO standard stdint.h header file, then you
* must typedef the following:
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index d5a6c4e5a0..3070ac4b05 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -93,39 +93,7 @@ static SHA3Final * const sha3Final = Final;
#endif
-/*
- These #defines replace the typedefs needed by the RFC6234 code. Normally
- the typedefs would come from from stdint.h, but since this header is not
- available on all platforms (MSVC 2008, for example), we #define them to the
- Qt equivalents.
-*/
-
-#ifdef uint64_t
-#undef uint64_t
-#endif
-
-#define uint64_t QT_PREPEND_NAMESPACE(quint64)
-
-#ifdef uint32_t
-#undef uint32_t
-#endif
-
-#define uint32_t QT_PREPEND_NAMESPACE(quint32)
-
-#ifdef uint8_t
-#undef uint8_t
-#endif
-
-#define uint8_t QT_PREPEND_NAMESPACE(quint8)
-
-#ifdef int_least16_t
-#undef int_least16_t
-#endif
-
-#define int_least16_t QT_PREPEND_NAMESPACE(qint16)
-
-// Header from rfc6234 with 1 modification:
-// sha1.h - commented out '#include <stdint.h>' on line 74
+// Header from rfc6234
#include "../../3rdparty/rfc6234/sha.h"
/*
@@ -149,19 +117,14 @@ static int SHA384_512AddLength(SHA512Context *context, unsigned int length);
// sha384-512.c - appended 'M' to the SHA224_256AddLength macro on line 304
#include "../../3rdparty/rfc6234/sha384-512.c"
-#undef uint64_t
-#undef uint32_t
-#undef uint68_t
-#undef int_least16_t
-
static inline int SHA224_256AddLength(SHA256Context *context, unsigned int length)
{
- QT_PREPEND_NAMESPACE(quint32) addTemp;
+ uint32_t addTemp;
return SHA224_256AddLengthM(context, length);
}
static inline int SHA384_512AddLength(SHA512Context *context, unsigned int length)
{
- QT_PREPEND_NAMESPACE(quint64) addTemp;
+ uint64_t addTemp;
return SHA384_512AddLengthM(context, length);
}
@@ -437,19 +400,19 @@ void QCryptographicHash::addData(const char *data, qsizetype length)
break;
case RealSha3_224:
case Keccak_224:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), uint64_t(length) * 8);
break;
case RealSha3_256:
case Keccak_256:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), uint64_t(length) * 8);
break;
case RealSha3_384:
case Keccak_384:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), uint64_t(length) * 8);
break;
case RealSha3_512:
case Keccak_512:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), uint64_t(length) * 8);
break;
case Blake2b_160:
case Blake2b_256:
diff --git a/src/corelib/tools/qmessageauthenticationcode.cpp b/src/corelib/tools/qmessageauthenticationcode.cpp
index ada502ecb8..addd19d72e 100644
--- a/src/corelib/tools/qmessageauthenticationcode.cpp
+++ b/src/corelib/tools/qmessageauthenticationcode.cpp
@@ -42,39 +42,7 @@
#include "qtcore-config_p.h"
-/*
- These #defines replace the typedefs needed by the RFC6234 code. Normally
- the typedefs would come from from stdint.h, but since this header is not
- available on all platforms (MSVC 2008, for example), we #define them to the
- Qt equivalents.
-*/
-
-#ifdef uint64_t
-#undef uint64_t
-#endif
-
-#define uint64_t QT_PREPEND_NAMESPACE(quint64)
-
-#ifdef uint32_t
-#undef uint32_t
-#endif
-
-#define uint32_t QT_PREPEND_NAMESPACE(quint32)
-
-#ifdef uint8_t
-#undef uint8_t
-#endif
-
-#define uint8_t QT_PREPEND_NAMESPACE(quint8)
-
-#ifdef int_least16_t
-#undef int_least16_t
-#endif
-
-#define int_least16_t QT_PREPEND_NAMESPACE(qint16)
-
-// Header from rfc6234 with 1 modification:
-// sha1.h - commented out '#include <stdint.h>' on line 74
+// Header from rfc6234
#include "../../3rdparty/rfc6234/sha.h"
#if QT_CONFIG(system_libb2)
@@ -83,11 +51,6 @@
#include "../../3rdparty/blake2/src/blake2.h"
#endif
-#undef uint64_t
-#undef uint32_t
-#undef uint68_t
-#undef int_least16_t
-
QT_BEGIN_NAMESPACE
static int qt_hash_block_size(QCryptographicHash::Algorithm method)