summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/Crypto/PRNG.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto/PRNG.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/Crypto/PRNG.js33
1 files changed, 11 insertions, 22 deletions
diff --git a/frontend/gamma/js/Clipperz/Crypto/PRNG.js b/frontend/gamma/js/Clipperz/Crypto/PRNG.js
index adfdb16..c539f06 100644
--- a/frontend/gamma/js/Clipperz/Crypto/PRNG.js
+++ b/frontend/gamma/js/Clipperz/Crypto/PRNG.js
@@ -1,25 +1,23 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
@@ -489,7 +487,6 @@ Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, {
489 487
490 this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); 488 this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed));
491 if (reseedCounter == 1) { 489 if (reseedCounter == 1) {
492//MochiKit.Logging.logDebug("### PRNG.readyToGenerateRandomBytes");
493Clipperz.log("### PRNG.readyToGenerateRandomBytes"); 490Clipperz.log("### PRNG.readyToGenerateRandomBytes");
494 MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); 491 MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes');
495 } 492 }
@@ -560,7 +557,7 @@ Clipperz.log("### PRNG.readyToGenerateRandomBytes");
560 newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); 557 newKey = this.getRandomBlock().appendBlock(this.getRandomBlock());
561 this.setKey(newKey); 558 this.setKey(newKey);
562 } else { 559 } else {
563MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); 560Clipperz.logWarning("Fortuna generator has not enough entropy, yet!");
564 throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; 561 throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy;
565 } 562 }
566 563
@@ -610,21 +607,14 @@ MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!");
610 'deferredEntropyCollection': function(aValue) { 607 'deferredEntropyCollection': function(aValue) {
611 var result; 608 var result;
612 609
613//MochiKit.Logging.logDebug(">>> PRNG.deferredEntropyCollection");
614 610
615 if (this.isReadyToGenerateRandomValues()) { 611 if (this.isReadyToGenerateRandomValues()) {
616//MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 1");
617 result = aValue; 612 result = aValue;
618 } else { 613 } else {
619//MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 2");
620 var deferredResult; 614 var deferredResult;
621 615
622 // Clipperz.NotificationCenter.notify(this, 'updatedProgressState', 'collectingEntropy', true);
623
624 deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); 616 deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection");
625 // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - PRNG.deferredEntropyCollection - 1: " + res); return res;});
626 deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); 617 deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue));
627 // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - PRNG.deferredEntropyCollection - 2: " + res); return res;});
628 MochiKit.Signal.connect(this, 618 MochiKit.Signal.connect(this,
629 'readyToGenerateRandomBytes', 619 'readyToGenerateRandomBytes',
630 deferredResult, 620 deferredResult,
@@ -632,7 +622,6 @@ MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!");
632 622
633 result = deferredResult; 623 result = deferredResult;
634 } 624 }
635//MochiKit.Logging.logDebug("<<< PRNG.deferredEntropyCollection - result: " + result);
636 625
637 return result; 626 return result;
638 }, 627 },