From 34ecf9b318e3b3238f423e9338f5e24ebaf3892e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 16 Jul 2016 16:52:19 -0700 Subject: [PATCH] aes: minor. --- lib/bcoin/aes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/aes.js b/lib/bcoin/aes.js index 0b46286b..26b71215 100644 --- a/lib/bcoin/aes.js +++ b/lib/bcoin/aes.js @@ -617,6 +617,8 @@ AESDecipher.prototype.update = function update(data) { AESDecipher.prototype.final = function final() { var i, b, n, block; + this.key.destroy(); + assert(!this.waiting, 'Bad decrypt (trailing bytes).'); assert(this.lastBlock, 'Bad decrypt (no data).'); @@ -640,8 +642,6 @@ AESDecipher.prototype.final = function final() { block = block.slice(0, -n); - this.key.destroy(); - return block; };