Added qmake option to disable precompiled header

Disabled precompiled header on FreeBSD by default (closes #1943446)
Use mlock() to protect session key

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@201 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 35dc3772e3
commit e47df76b56
  1. 5
      src/Kdb3Database.cpp
  2. 16
      src/lib/SecString.cpp
  3. 29
      src/src.pro

@ -1741,9 +1741,8 @@ void KeyTransform::transform(quint8* src, quint8* dst, quint8* KeySeed, int roun
KeyTransform* ktRight = new KeyTransform(&src[16], &dst[16], KeySeed, rounds); KeyTransform* ktRight = new KeyTransform(&src[16], &dst[16], KeySeed, rounds);
ktLeft->start(); ktLeft->start();
ktRight->start(); ktRight->start();
while (ktLeft->isRunning() || ktRight->isRunning()){ ktLeft->wait();
QThread::msleep(100); ktRight->wait();
}
SHA256::hashBuffer(dst,dst,32); SHA256::hashBuffer(dst,dst,32);
delete ktLeft; delete ktLeft;
delete ktRight; delete ktRight;

@ -18,7 +18,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifdef Q_WS_X11
#include <sys/mman.h>
#include <limits.h>
#endif
using namespace std; using namespace std;
CArcFour SecString::RC4; CArcFour SecString::RC4;
@ -97,6 +100,17 @@ void SecString::overwrite(QString& str){
void SecString::generateSessionKey(){ void SecString::generateSessionKey(){
CArcFour arc; CArcFour arc;
unsigned char sessionkey[32]; unsigned char sessionkey[32];
#ifdef Q_WS_X11
#ifdef PAGESIZE
mlock(sessionkey - sessionkey%PAGESIZE, 32);
#else
mlock(sessionkey, 32);
#endif
#endif // Q_WS_X11
randomize(sessionkey,32); randomize(sessionkey,32);
RC4.setKey(sessionkey,32); RC4.setKey(sessionkey,32);
overwrite(sessionkey,32); overwrite(sessionkey,32);

@ -1,5 +1,5 @@
CONFIG = qt uic resources thread stl warn_off precompile_header CONFIG = qt uic resources thread stl warn_off
QT += xml QT += xml
DEPENDPATH += crypto dialogs export forms import lib translations res DEPENDPATH += crypto dialogs export forms import lib translations res
@ -17,6 +17,12 @@ else {
CONFIG += release CONFIG += release
} }
# lipo and freebsd cannot handle precompiled headers (yet)
!isEqual(PRECOMPILED,1){
macx : isEqual(ARCH,UNIVERSAL) : PRECOMPILED = 0
freebsd-* : PRECOMPILED = 0
}
win32 : QMAKE_WIN32 = 1 win32 : QMAKE_WIN32 = 1
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -78,9 +84,6 @@ macx {
CONFIG += app_bundle CONFIG += app_bundle
isEqual(ARCH,UNIVERSAL){ isEqual(ARCH,UNIVERSAL){
CONFIG += x86 ppc CONFIG += x86 ppc
# lipo cannot handle precompiled headers (yet)
CONFIG -= precompile_header
QMAKE_CXXFLAGS += -include keepassx.h
} }
isEqual(ARCH,INTEL): CONFIG += x86 isEqual(ARCH,INTEL): CONFIG += x86
isEqual(ARCH,PPC): CONFIG += ppc isEqual(ARCH,PPC): CONFIG += ppc
@ -251,12 +254,18 @@ SOURCES += lib/UrlLabel.cpp \
dialogs/AddBookmarkDlg.cpp \ dialogs/AddBookmarkDlg.cpp \
lib/bookmarks.cpp \ lib/bookmarks.cpp \
dialogs/ManageBookmarksDlg.cpp \ dialogs/ManageBookmarksDlg.cpp \
crypto/aescrypt.c \ crypto/aescrypt.c \
crypto/aeskey.c \ crypto/aeskey.c \
crypto/aes_modes.c \ crypto/aes_modes.c \
crypto/aestab.c \ crypto/aestab.c \
lib/AutoTypeTreeWidget.cpp lib/AutoTypeTreeWidget.cpp
PRECOMPILED_HEADER = keepassx.h isEqual(PRECOMPILED,0) {
QMAKE_CXXFLAGS += -include keepassx.h
}
else {
CONFIG += precompile_header
PRECOMPILED_HEADER = keepassx.h
}
RESOURCES += res/resources.qrc RESOURCES += res/resources.qrc