summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorCalvin Metcalf <cmetcalf@appgeo.com>2014-11-11 13:38:02 -0500
committerFedor Indutny <fedor@indutny.com>2014-11-25 18:53:35 +0300
commitce56dccb99db128c8973642dfd0b47958c30010e (patch)
tree267f7cd69e1ebe5dc36100f548f0dedecce5cd4b /lib/crypto.js
parentd7e7008c1f4318e2ebd375fed75362711ebdbb2c (diff)
downloadandroid-node-v8-ce56dccb99db128c8973642dfd0b47958c30010e.tar.gz
android-node-v8-ce56dccb99db128c8973642dfd0b47958c30010e.tar.bz2
android-node-v8-ce56dccb99db128c8973642dfd0b47958c30010e.zip
crypto: allow creation of GCM ciphers with createCipher
Sets the authenticated encryption specific methods ([set|get]AuthTag and setAAD) on the Cipher prototype not just the Cipheriv prototype. Reviewed-By: Fedor Indutny <fedor@indutny.com> PR-URL: https://github.com/joyent/node/pull/8711
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 91106b35f6..18b1b271d1 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -216,7 +216,18 @@ Cipher.prototype.setAutoPadding = function(ap) {
return this;
};
+Cipher.prototype.getAuthTag = function() {
+ return this._handle.getAuthTag();
+};
+
+
+Cipher.prototype.setAuthTag = function(tagbuf) {
+ this._handle.setAuthTag(tagbuf);
+};
+Cipher.prototype.setAAD = function(aadbuf) {
+ this._handle.setAAD(aadbuf);
+};
exports.createCipheriv = exports.Cipheriv = Cipheriv;
function Cipheriv(cipher, key, iv, options) {
@@ -236,20 +247,9 @@ Cipheriv.prototype._flush = Cipher.prototype._flush;
Cipheriv.prototype.update = Cipher.prototype.update;
Cipheriv.prototype.final = Cipher.prototype.final;
Cipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
-
-Cipheriv.prototype.getAuthTag = function() {
- return this._handle.getAuthTag();
-};
-
-
-Cipheriv.prototype.setAuthTag = function(tagbuf) {
- this._handle.setAuthTag(tagbuf);
-};
-
-Cipheriv.prototype.setAAD = function(aadbuf) {
- this._handle.setAAD(aadbuf);
-};
-
+Cipheriv.prototype.getAuthTag = Cipher.prototype.getAuthTag;
+Cipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;
+Cipheriv.prototype.setAAD = Cipher.prototype.setAAD;
exports.createDecipher = exports.Decipher = Decipher;
function Decipher(cipher, password, options) {
@@ -271,7 +271,9 @@ Decipher.prototype.update = Cipher.prototype.update;
Decipher.prototype.final = Cipher.prototype.final;
Decipher.prototype.finaltol = Cipher.prototype.final;
Decipher.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
-
+Decipher.prototype.getAuthTag = Cipher.prototype.getAuthTag;
+Decipher.prototype.setAuthTag = Cipher.prototype.setAuthTag;
+Decipher.prototype.setAAD = Cipher.prototype.setAAD;
exports.createDecipheriv = exports.Decipheriv = Decipheriv;
@@ -294,9 +296,9 @@ Decipheriv.prototype.update = Cipher.prototype.update;
Decipheriv.prototype.final = Cipher.prototype.final;
Decipheriv.prototype.finaltol = Cipher.prototype.final;
Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
-Decipheriv.prototype.getAuthTag = Cipheriv.prototype.getAuthTag;
-Decipheriv.prototype.setAuthTag = Cipheriv.prototype.setAuthTag;
-Decipheriv.prototype.setAAD = Cipheriv.prototype.setAAD;
+Decipheriv.prototype.getAuthTag = Cipher.prototype.getAuthTag;
+Decipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;
+Decipheriv.prototype.setAAD = Cipher.prototype.setAAD;