(data, buf, iv, aad, encFlag)
| 78 | return Bin.xor(t, this.block.encrypt(this.y0)); |
| 79 | }; |
| 80 | process(data, buf, iv, aad, encFlag) { |
| 81 | if (encFlag) { |
| 82 | this.init(iv, aad); |
| 83 | buf = this.encrypt(data, buf); |
| 84 | let tag = this.close(); |
| 85 | if (tag.byteLength > this.tagLength) |
| 86 | tag = tag.slice(0, this.tagLength); |
| 87 | return buf.concat(tag); |
| 88 | } |
| 89 | else { |
| 90 | this.init(iv, aad); |
| 91 | |
| 92 | const subarray = data.subarray(0, data.byteLength - this.tagLength); |
| 93 | buf = this.decrypt(subarray, (buf === data) ? subarray : buf); |
| 94 | const tag = this.close(); |
| 95 | if (Bin.comp(tag, data.subarray(data.byteLength - this.tagLength), this.tagLength) === 0) |
| 96 | return buf; |
| 97 | } |
| 98 | }; |
| 99 | }; |
no test coverage detected