author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/Crypto/PRNG.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto/PRNG.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/PRNG.js | 33 |
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,26 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
@@ -488,9 +486,8 @@ Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, { | |||
488 | } | 486 | } |
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"); | ||
493 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | 490 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); |
494 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); | 491 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); |
495 | } | 492 | } |
496 | MochiKit.Signal.signal(this, 'reseeded'); | 493 | MochiKit.Signal.signal(this, 'reseeded'); |
@@ -559,9 +556,9 @@ Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | |||
559 | 556 | ||
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 { |
563 | MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | 560 | Clipperz.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 | ||
567 | return result; | 564 | return result; |
@@ -609,31 +606,23 @@ MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | |||
609 | 606 | ||
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, |
631 | 'callback'); | 621 | 'callback'); |
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 | }, |
639 | 628 | ||