//#include "KeccakNISTInterface.h"
#include "KeccakF-1600-interface.h"
-static HashReturn Init(hashState *state, int hashbitlen)
+static HashReturn s3Init(hashState *state, int hashbitlen)
{
switch(hashbitlen) {
case 0: // Default parameters, arbitrary length output
return SUCCESS;
}
-static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen)
+static HashReturn s3Update(hashState *state, const BitSequence *data, DataLength databitlen)
{
if ((databitlen % 8) == 0)
return (HashReturn) Absorb((spongeState*)state, data, databitlen);
}
}
-static HashReturn Final(hashState *state, BitSequence *hashval)
+static HashReturn s3Final(hashState *state, BitSequence *hashval)
{
return (HashReturn) Squeeze(state, hashval, state->fixedOutputLength);
}
#ifndef QT_KATIE
-static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval)
+static HashReturn s3Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval)
{
hashState state;
HashReturn result;
if ((hashbitlen != 224) && (hashbitlen != 256) && (hashbitlen != 384) && (hashbitlen != 512))
return BAD_HASHLEN; // Only the four fixed output lengths available through this API
- result = Init(&state, hashbitlen);
+ result = s3Init(&state, hashbitlen);
if (result != SUCCESS)
return result;
- result = Update(&state, data, databitlen);
+ result = s3Update(&state, data, databitlen);
if (result != SUCCESS)
return result;
- result = Final(&state, hashval);
+ result = s3Final(&state, hashval);
return result;
}
#endif
* @pre The value of hashbitlen must be one of 0, 224, 256, 384 and 512.
* @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect.
*/
-static HashReturn Init(hashState *state, int hashbitlen);
+static HashReturn s3Init(hashState *state, int hashbitlen);
/**
* Function to give input data for the sponge function to absorb.
* @param state Pointer to the state of the sponge function initialized by Init().
* @pre In the previous call to Absorb(), databitLen was a multiple of 8.
* @return SUCCESS if successful, FAIL otherwise.
*/
-static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);
+static HashReturn s3Update(hashState *state, const BitSequence *data, DataLength databitlen);
/**
* Function to squeeze output data from the sponge function.
* If @a hashbitlen was not 0 in the call to Init(), the number of output bits is equal to @a hashbitlen.
* @param hashval Pointer to the buffer where to store the output data.
* @return SUCCESS if successful, FAIL otherwise.
*/
-static HashReturn Final(hashState *state, BitSequence *hashval);
+static HashReturn s3Final(hashState *state, BitSequence *hashval);
/**
* Function to compute a hash using the Keccak[r, c] sponge function.
* The rate r and capacity c values are determined from @a hashbitlen.
* @pre The value of hashbitlen must be one of 224, 256, 384 and 512.
* @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect.
*/
-static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
+static HashReturn s3Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
#endif
)
endif()
+set(CORE_HEADERS
+ ${CORE_HEADERS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/qcorecommon_p.h
+)
+
katie_generate_misc("${CORE_HEADERS}" QtCore)
katie_generate_public("${CORE_PUBLIC_HEADERS}" QtCore)
katie_setup_paths()
katie_generate_package(KtCore "")
katie_setup_target(KtCore ${CORE_SOURCES} ${CORE_HEADERS})
+# those are set after katie_setup_target() because they are known to cause
+# trouble for all-in-one-build
+if(WITH_HARFBUZZ AND HARFBUZZ_FOUND)
+ set(EXTRA_CORE_LIBS
+ ${EXTRA_CORE_LIBS}
+ ${HARFBUZZ_LIBRARIES}
+ )
+ include_directories(${HARFBUZZ_INCLUDE_DIRS})
+else()
+ # TODO: move to main CMakeLists?
+ add_definitions(-DHB_EXPORT=Q_CORE_EXPORT)
+ set(CORE_HEADERS
+ ${CORE_HEADERS}
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/qharfbuzz_p.h
+ )
+ set(KtCore_SOURCES
+ ${KtCore_SOURCES}
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-buffer.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gsub.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-impl.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-open.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-stream.c
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/qharfbuzz.cpp
+ )
+ include_directories(
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src
+ )
+endif()
+
add_library(KtCore ${KATIE_TYPE} ${KtCore_SOURCES})
target_link_libraries(KtCore ${EXTRA_CORE_LIBS})
set_target_properties(KtCore PROPERTIES
#include "qstringlist.h"
#include "qdatetime.h"
-#include <qsystemlibrary_p.h>
+#include "qsystemlibrary_p.h"
+#include "qcorecommon_p.h"
#ifndef QT_NO_QOBJECT
#include <qthread_p.h>
}
#endif // QT_USE_SLOG2
-#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
- defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
-namespace {
- // There are two incompatible versions of strerror_r:
- // a) the XSI/POSIX.1 version, which returns an int,
- // indicating success or not
- // b) the GNU version, which returns a char*, which may or may not
- // be the beginning of the buffer we used
- // The GNU libc manpage for strerror_r says you should use the the XSI
- // version in portable code. However, it's impossible to do that if
- // _GNU_SOURCE is defined so we use C++ overloading to decide what to do
- // depending on the return type
- static inline QString fromstrerror_helper(int, const QByteArray &buf)
- {
- return QString::fromLocal8Bit(buf);
- }
- static inline QString fromstrerror_helper(const char *str, const QByteArray &)
- {
- return QString::fromLocal8Bit(str);
- }
-}
-#endif
-
QString qt_error_string(int errorCode)
{
const char *s = 0;
**
****************************************************************************/
-#include <qglobal.h>
+#include "qglobal.h"
#include "qsystemerror_p.h"
+#include "qcorecommon_p.h"
+
#if !defined(Q_OS_WINCE)
# include <errno.h>
# if defined(Q_CC_MSVC)
QT_BEGIN_NAMESPACE
-#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
- defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
-namespace {
- // There are two incompatible versions of strerror_r:
- // a) the XSI/POSIX.1 version, which returns an int,
- // indicating success or not
- // b) the GNU version, which returns a char*, which may or may not
- // be the beginning of the buffer we used
- // The GNU libc manpage for strerror_r says you should use the the XSI
- // version in portable code. However, it's impossible to do that if
- // _GNU_SOURCE is defined so we use C++ overloading to decide what to do
- // depending on the return type
- static inline QString fromstrerror_helper(int, const QByteArray &buf)
- {
- return QString::fromLocal8Bit(buf);
- }
- static inline QString fromstrerror_helper(const char *str, const QByteArray &)
- {
- return QString::fromLocal8Bit(str);
- }
-}
-#endif
-
#ifdef Q_OS_WIN
static QString windowsErrorString(int errorCode)
{
--- /dev/null
+#ifndef QCORECOMMON_P_H
+#define QCORECOMMON_P_H
+
+#include "qstring.h"
+
+#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
+ defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
+namespace {
+ // There are two incompatible versions of strerror_r:
+ // a) the XSI/POSIX.1 version, which returns an int,
+ // indicating success or not
+ // b) the GNU version, which returns a char*, which may or may not
+ // be the beginning of the buffer we used
+ // The GNU libc manpage for strerror_r says you should use the the XSI
+ // version in portable code. However, it's impossible to do that if
+ // _GNU_SOURCE is defined so we use C++ overloading to decide what to do
+ // depending on the return type
+ static inline QString fromstrerror_helper(int, const QByteArray &buf)
+ {
+ return QString::fromLocal8Bit(buf);
+ }
+ static inline QString fromstrerror_helper(const char *str, const QByteArray &)
+ {
+ return QString::fromLocal8Bit(str);
+ }
+}
+#endif
+
+#endif // QCORECOMMON_P_H
typedef HashReturn (SHA3Final)(hashState *state, BitSequence *hashval);
#if QT_POINTER_SIZE == 8 // 64 bit version
-
#include "../../3rdparty/sha3/KeccakF-1600-opt64.c"
-
-static SHA3Init * const sha3Init = Init;
-static SHA3Update * const sha3Update = Update;
-static SHA3Final * const sha3Final = Final;
-
#else // 32 bit optimised fallback
-
#include "../../3rdparty/sha3/KeccakF-1600-opt32.c"
-
-static SHA3Init * const sha3Init = Init;
-static SHA3Update * const sha3Update = Update;
-static SHA3Final * const sha3Final = Final;
-
#endif
+static SHA3Init * const sha3Init = s3Init;
+static SHA3Update * const sha3Update = s3Update;
+static SHA3Final * const sha3Final = s3Final;
/*
These #defines replace the typedefs needed by the RFC6234 code. Normally
include_directories(${ICU_INCLUDES})
endif()
-if(WITH_HARFBUZZ AND HARFBUZZ_FOUND)
- set(EXTRA_CORE_LIBS
- ${EXTRA_CORE_LIBS}
- ${HARFBUZZ_LIBRARIES}
- )
- include_directories(${HARFBUZZ_INCLUDE_DIRS})
-else()
- # TODO: move to main CMakeLists?
- add_definitions(-DHB_EXPORT=Q_CORE_EXPORT)
- set(CORE_HEADERS
- ${CORE_HEADERS}
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz.h
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/qharfbuzz_p.h
- )
- set(CORE_SOURCES
- ${CORE_SOURCES}
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-buffer.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gsub.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-impl.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-open.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-stream.c
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/tools/qharfbuzz.cpp
- )
- include_directories(
- ${CMAKE_SOURCE_DIR}/src/3rdparty/harfbuzz/src
- )
-endif()
-
# Note: libm should be present by default becaue this is C++
if(NOT KATIE_PLATFORM MATCHES "(mac|vxworks)" AND UNIX)
set(EXTRA_CORE_LIBS