diff --git a/bower.json b/bower.json index 2d5d339..a995f68 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "crypto-js", - "version": "3.1.8", + "version": "3.1.9", "description": "JavaScript library of crypto standards.", "license": "MIT", "homepage": "http://github.com/brix/crypto-js", diff --git a/cipher-core.js b/cipher-core.js index 4fad569..751c816 100644 --- a/cipher-core.js +++ b/cipher-core.js @@ -1,11 +1,11 @@ -;(function (root, factory) { +;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS - module.exports = exports = factory(require("./core")); + module.exports = exports = factory(require("./core"), require("./evpkdf")); } else if (typeof define === "function" && define.amd) { // AMD - define(["./core"], factory); + define(["./core", "./evpkdf"], factory); } else { // Global (browser) @@ -466,11 +466,16 @@ var modeCreator = mode.createEncryptor; } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { var modeCreator = mode.createDecryptor; - // Keep at least one block in the buffer for unpadding this._minBufferSize = 1; } - this._mode = modeCreator.call(mode, this, iv && iv.words); + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } }, _doProcessBlock: function (words, offset) { diff --git a/crypto-js.js b/crypto-js.js index 3b6c221..17f2b11 100644 --- a/crypto-js.js +++ b/crypto-js.js @@ -3717,11 +3717,16 @@ var modeCreator = mode.createEncryptor; } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { var modeCreator = mode.createDecryptor; - // Keep at least one block in the buffer for unpadding this._minBufferSize = 1; } - this._mode = modeCreator.call(mode, this, iv && iv.words); + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } }, _doProcessBlock: function (words, offset) { diff --git a/package.json b/package.json index 50f9de9..dae37ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crypto-js", - "version": "3.1.8", + "version": "3.1.9", "description": "JavaScript library of crypto standards.", "license": "MIT", "author": {