Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto/AES.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/AES.js | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/frontend/gamma/js/Clipperz/Crypto/AES.js b/frontend/gamma/js/Clipperz/Crypto/AES.js index c811f1c..cb56f11 100644 --- a/frontend/gamma/js/Clipperz/Crypto/AES.js +++ b/frontend/gamma/js/Clipperz/Crypto/AES.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) { |
@@ -119,9 +117,8 @@ Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(nu | |||
119 | return MochiKit.Async.wait(this._pauseTime, aValue); | 117 | return MochiKit.Async.wait(this._pauseTime, aValue); |
120 | }, | 118 | }, |
121 | 119 | ||
122 | 'isDone': function () { | 120 | 'isDone': function () { |
123 | //console.log("isDone", this.executionStep(), this.messageLength()); | ||
124 | return (this._executionStep >= this._messageLength); | 121 | return (this._executionStep >= this._messageLength); |
125 | }, | 122 | }, |
126 | 123 | ||
127 | //----------------------------------------------------------------------------- | 124 | //----------------------------------------------------------------------------- |
@@ -143,9 +140,9 @@ Clipperz.Crypto.AES.Key = function(args) { | |||
143 | } else if (this.keySize() == 256/8) { | 140 | } else if (this.keySize() == 256/8) { |
144 | this._b = 240; | 141 | this._b = 240; |
145 | this._numberOfRounds = 14; | 142 | this._numberOfRounds = 14; |
146 | } else { | 143 | } else { |
147 | MochiKit.Logging.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits"); | 144 | Clipperz.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits"); |
148 | throw Clipperz.Crypto.AES.exception.UnsupportedKeySize; | 145 | throw Clipperz.Crypto.AES.exception.UnsupportedKeySize; |
149 | } | 146 | } |
150 | 147 | ||
151 | this._stretchedKey = null; | 148 | this._stretchedKey = null; |
@@ -807,9 +804,8 @@ MochiKit.Base.update(Clipperz.Crypto.AES, { | |||
807 | 804 | ||
808 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce}); | 805 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce}); |
809 | 806 | ||
810 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncrypt"); | 807 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncrypt"); |
811 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredEncrypt"); return aValue; }); | ||
812 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | 808 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); |
813 | deferredResult.addCallback(function(anExecutionContext) { | 809 | deferredResult.addCallback(function(anExecutionContext) { |
814 | var result; | 810 | var result; |
815 | 811 | ||
@@ -817,9 +813,8 @@ MochiKit.Base.update(Clipperz.Crypto.AES, { | |||
817 | result.appendBytes(anExecutionContext.resultArray()); | 813 | result.appendBytes(anExecutionContext.resultArray()); |
818 | 814 | ||
819 | return result; | 815 | return result; |
820 | }); | 816 | }); |
821 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredEncrypt"); return aValue; }); | ||
822 | deferredResult.callback(executionContext) | 817 | deferredResult.callback(executionContext) |
823 | 818 | ||
824 | return deferredResult; | 819 | return deferredResult; |
825 | }, | 820 | }, |
@@ -837,14 +832,12 @@ MochiKit.Base.update(Clipperz.Crypto.AES, { | |||
837 | message = someData.split(128/8); | 832 | message = someData.split(128/8); |
838 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce}); | 833 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce}); |
839 | 834 | ||
840 | deferredResult = new Clipperz.Async.Deferred("AES.deferredDecrypt"); | 835 | deferredResult = new Clipperz.Async.Deferred("AES.deferredDecrypt"); |
841 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredDecrypt"); return aValue; }); | ||
842 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | 836 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); |
843 | deferredResult.addCallback(function(anExecutionContext) { | 837 | deferredResult.addCallback(function(anExecutionContext) { |
844 | return anExecutionContext.result(); | 838 | return anExecutionContext.result(); |
845 | }); | 839 | }); |
846 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredDecrypt"); return aValue; }); | ||
847 | deferredResult.callback(executionContext); | 840 | deferredResult.callback(executionContext); |
848 | 841 | ||
849 | return deferredResult; | 842 | return deferredResult; |
850 | }, | 843 | }, |