From b9feb0b74d53f04e9b7e2fa55bb8ae2cee67a8e4 Mon Sep 17 00:00:00 2001 From: tarek_saidi Date: Tue, 24 Oct 2006 14:02:34 +0000 Subject: [PATCH] Finished EntropyCollectionDlg. git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@110 b624d157-de02-0410-bad0-e51aec6abb33 --- src/crypto/yarrow.cpp | 29 + src/crypto/yarrow.h | 1 + src/dialogs/CollectEntropyDlg.cpp | 7 +- src/forms/CollectEntropyDlg.ui | 250 ++++++--- src/forms/PasswordGenDlg.ui | 858 +++++++++++++++--------------- src/lib/WaitAnimationWidget.cpp | 4 +- src/mainwindow.cpp | 11 - 7 files changed, 649 insertions(+), 511 deletions(-) diff --git a/src/crypto/yarrow.cpp b/src/crypto/yarrow.cpp index 3132d38..4d68fbd 100644 --- a/src/crypto/yarrow.cpp +++ b/src/crypto/yarrow.cpp @@ -429,3 +429,32 @@ void strongRandomize(void* buffer, unsigned int length){ for(int i=0; il2*4){ + yarrow256_update(&StrongCtx,0,100,100,buffer1); + buffer1=buffer1+100; + l1=l1-100; + } + else + { + yarrow256_update(&StrongCtx,1,100,25,buffer2); + buffer2=buffer2+25; + l2=l2-25; + } + + if(l1>l2*4){ + yarrow256_update(&StrongCtx,0,160,160,buffer1); + l1-=160; + buffer1+=160; + yarrow256_update(&StrongCtx,1,l1,l1,buffer1); + yarrow256_update(&StrongCtx,1,4*l2,l2,buffer2); + } + else{ + yarrow256_update(&StrongCtx,0,160,40,buffer2); + l2-=40; + buffer2+=40; + yarrow256_update(&StrongCtx,1,l2*4,l2,buffer2); + yarrow256_update(&StrongCtx,1,l1,l1,buffer1); + } +} diff --git a/src/crypto/yarrow.h b/src/crypto/yarrow.h index 8473794..4c2c290 100644 --- a/src/crypto/yarrow.h +++ b/src/crypto/yarrow.h @@ -185,6 +185,7 @@ do { \ void initYarrow(); void randomize(void* buffer, unsigned int length); +void reseedStrongPool(quint8* buffer1,int l1,quint8* buffer2,int l2); #endif /* NETTLE_YARROW_COMPAT_H_INCLUDED */ diff --git a/src/dialogs/CollectEntropyDlg.cpp b/src/dialogs/CollectEntropyDlg.cpp index fd533f4..01f030a 100644 --- a/src/dialogs/CollectEntropyDlg.cpp +++ b/src/dialogs/CollectEntropyDlg.cpp @@ -20,12 +20,13 @@ #include #include +#include "crypto/yarrow.h" #include "CollectEntropyDlg.h" #include "main.h" CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){ setupUi(this); - createBanner(&BannerPixmap,NULL,tr("Entropy Collection"),width()); + createBanner(&BannerPixmap,Icon_Key32x32,tr("Entropy Collection"),width()); KeyEntropyBuffer=new unsigned char[105]; MouseEntropyBuffer=new quint16[210]; KeyCounter=0; @@ -72,7 +73,9 @@ void CollectEntropyDlg::updateProgress(){ if(4*KeyCounter+4*MouseCounter>=420){ progressBar->setValue(420); ReseedDone=true; - + reseedStrongPool((quint8*)MouseEntropyBuffer,4*MouseCounter,KeyEntropyBuffer,KeyCounter); + Animation->stop(); + stackedWidget->setCurrentIndex(1); } else progressBar->setValue(4*KeyCounter+4*MouseCounter); diff --git a/src/forms/CollectEntropyDlg.ui b/src/forms/CollectEntropyDlg.ui index ccfdbe4..aaf38c6 100644 --- a/src/forms/CollectEntropyDlg.ui +++ b/src/forms/CollectEntropyDlg.ui @@ -5,81 +5,193 @@ 0 0 - 476 - 279 + 432 + 230 + + + 0 + 0 + 0 + 0 + + + + + 432 + 230 + + + + + 432 + 230 + + - Dialog + Random Number Generator - - - - 10 - 80 - 411 - 51 - - - - Collecting entropy... -Please move the mouse and/or press some keys until enought entropy for a reseed of the random number generator is collected. - - - false - - - true - - - - - - 20 - 240 - 441 - 32 - + + + 9 - - Qt::Horizontal + + 6 - - QDialogButtonBox::Ok - - - - - - 8 - 5 - 41 - 41 - - - - - - - 10 - 140 - 451 - 23 - - - - 420 - - - 0 - - - Qt::Horizontal - - - %v Bits - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 50 + + + + + + + + Collecting entropy... +Please move the mouse and/or press some keys until enought entropy for a reseed of the random number generator is collected. + + + false + + + true + + + + + + + 420 + + + 0 + + + Qt::Horizontal + + + %v Bits + + + + + + + 0 + + + + + 9 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + 0 + 0 + 0 + 0 + + + + + 41 + 41 + + + + + 41 + 41 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + + 9 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Verdana'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#006400;">Random pool successfully reseeded!</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + diff --git a/src/forms/PasswordGenDlg.ui b/src/forms/PasswordGenDlg.ui index f863899..9201aa4 100644 --- a/src/forms/PasswordGenDlg.ui +++ b/src/forms/PasswordGenDlg.ui @@ -1,430 +1,434 @@ - - - - - GenPwDlg - + + GenPwDlg + + + + 0 + 0 + 460 + 470 + + + + + 0 + 0 + 0 + 0 + + + + + 460 + 470 + + + + + 460 + 470 + + + + Password Generator + + + + + 130 + 400 + 180 + 15 + + + + Qt::Horizontal + + + + + + 130 + 370 + 250 + 21 + + + + + + + 320 + 399 + 60 + 16 + + + + + + + + + + 263 + 440 + 90 + 25 + + + + Accep&t + + + + + + 360 + 440 + 90 + 25 + + + + &Cancel + + + + + + 381 + 370 + 70 + 21 + + + + Generate + + + + + + 20 + 370 + 110 + 20 + + + + New Password: + + + + + + 20 + 400 + 110 + 20 + + + + Quality: + + + + + + 0 + 420 + 460 + 20 + + + + QFrame::HLine + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + 10 + 60 + 440 + 280 + + + + Options + + + + + 30 + 170 + 400 + 21 + + + + + + + 120 + 220 + 310 + 21 + + + + 1000 + + + 1 + + + 20 + + + + + + 120 + 40 + 131 + 20 + + + + &Upper Letters + + + Alt+U + + + true + + + + + + 120 + 60 + 140 + 20 + + + + &Lower Letters + + + Alt+L + + + true + + + + + + 120 + 80 + 140 + 20 + + + + &Numbers + + + Alt+N + + + true + + + + + + 120 + 100 + 140 + 20 + + + + &Special Characters + + + true + + + + + + 260 + 60 + 170 + 20 + + + + Minus + + + + + + 260 + 80 + 170 + 20 + + + + U&nderline + + + Alt+N + + + + + + 260 + 100 + 170 + 20 + + + + h&igher ANSI-Characters + + + Alt+H + + + + + + 10 + 150 + 420 + 16 + + + + Use &only following characters: + + + Alt+O + + + - - 0 - 0 - 460 - 470 - - - - - 0 - 0 - 0 - 0 - - - - - 460 - 470 - - - - - 460 - 470 - - - - Password Generator - - - - - 130 - 400 - 180 - 15 - - - - - - - 130 - 370 - 250 - 21 - - - - - - - 320 - 399 - 60 - 16 - - - - - - - - - - 0 - 0 - 460 - 50 - - - - image0 - - - true - - - - - - 263 - 440 - 90 - 25 - - - - Accep&t - - - - - - 360 - 440 - 90 - 25 - - - - &Cancel - - - - - - 381 - 370 - 70 - 21 - - - - Generate - - - - - - 20 - 370 - 110 - 20 - - - - New Password: - - - - - - 20 - 400 - 110 - 20 - - - - Quality: - - - - - - 0 - 420 - 460 - 20 - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - 10 - 60 - 440 - 280 - - - - Options - - - - - 30 - 170 - 400 - 21 - - - - - - - 120 - 220 - 310 - 21 - - - - 1000 - - - 1 - - - 20 - - - - - - 120 - 40 - 131 - 20 - - - - &Upper Letters - - - Alt+U - - - true - - - - - - 120 - 60 - 140 - 20 - - - - &Lower Letters - - - Alt+L - - - true - - - - - - 120 - 80 - 140 - 20 - - - - &Numbers - - - Alt+N - - - true - - - - - - 120 - 100 - 140 - 20 - - - - &Special Characters - - - true - - - - - - 260 - 60 - 170 - 20 - - - - Minus - - - - - - 260 - 80 - 170 - 20 - - - - U&nderline - - - Alt+N - - - - - - 260 - 100 - 170 - 20 - - - - h&igher ANSI-Characters - - - Alt+H - - - - - - 10 - 150 - 420 - 16 - - - - Use &only following characters: - - - Alt+O - - - - - - 10 - 220 - 110 - 21 - - - - Length: - - - - - - 120 - 250 - 310 - 21 - - - - Use "/dev/rando&m" - - - Alt+M - - - true - - - - - - 10 - 20 - 420 - 21 - - - - Use follo&wing character groups: - - - Alt+W - - - - - - 260 - 40 - 170 - 20 - - - - White &Spaces - - - Alt+S - - - + + 10 + 220 + 110 + 21 + + + + Length: + + + + + + 10 + 20 + 420 + 21 + + + + Use follo&wing character groups: + + + Alt+W + + + + + + 260 + 40 + 170 + 20 + + + + White &Spaces + + + Alt+S + + + + + + 120 + 250 + 310 + 21 + + + + Force entropy collection + + + Alt+M + + + true + + + + + + + 0 + 0 + 460 + 50 + + + + + + + true + - - - - Radio_1 - checkBox1 - checkBox2 - checkBox3 - checkBox4 - checkBox5 - checkBox6 - checkBox7 - checkBox8 - Radio_2 - Edit_chars - Spin_Num - Check_strongrandom - Edit_dest - ButtonGenerate - ButtonOK - Button_Cancel - + + + + Radio_1 + checkBox1 + checkBox2 + checkBox3 + checkBox4 + checkBox5 + checkBox6 + checkBox7 + checkBox8 + Radio_2 + Edit_chars + Spin_Num + Check_strongrandom + Edit_dest + ButtonGenerate + ButtonOK + Button_Cancel + + + diff --git a/src/lib/WaitAnimationWidget.cpp b/src/lib/WaitAnimationWidget.cpp index db32b56..6f3d0cc 100644 --- a/src/lib/WaitAnimationWidget.cpp +++ b/src/lib/WaitAnimationWidget.cpp @@ -77,8 +77,8 @@ void WaitAnimationWidget::paintEvent(QPaintEvent* event){ if(timer.isActive()){ QPainter painter(this); painter.setRenderHints(QPainter::Antialiasing,true); - painter.setBrush(config.BannerTextColor); - painter.setPen(config.BannerTextColor); + painter.setBrush(Qt::black); + painter.setPen(Qt::black); for(int i=0;i<6;i++){ float d=CircSizes[i]*5.0; QRectF rect(CircPositions[i].x()-d/2,CircPositions[i].y()-d/2,d,d); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eceefbb..cb5a712 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -372,17 +372,6 @@ return true; void KeepassMainWindow::OnFileNewKdb(){ - - - //Test - /* - CollectEntropyDlg dialog(this); - dialog.exec(); - return; - */ - //~Test - - CPasswordDialog dlg(this,true,false,true); dlg.setWindowTitle("New Database"); if(dlg.exec()==1){