From 7ce5ad1e78ad8c706539e787da2341f4f55df7cf Mon Sep 17 00:00:00 2001 From: Dustin Gedlich Date: Thu, 11 Feb 2021 13:44:08 +0100 Subject: [PATCH] fix: fix gcm tag length truncation --- lib/cipherModes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cipherModes.js b/lib/cipherModes.js index 339915cc1..8c4ea14bd 100644 --- a/lib/cipherModes.js +++ b/lib/cipherModes.js @@ -756,7 +756,7 @@ modes.gcm.prototype.afterFinish = function(output, options) { } // trim tag to length - this.tag.truncate(this.tag.length() % (this._tagLength / 8)); + this.tag.truncate(this.tag.length() - (this._tagLength / 8)); // check authentication tag if(options.decrypt && this.tag.bytes() !== this._tag) {