This commit is contained in:
parent
19a2481c13
commit
6d5cbf5a32
@ -271,6 +271,8 @@ export function cryptoAeadDecrypt (ciphertext: number[], associatedData: number[
|
|||||||
ciphertext.length -= 16
|
ciphertext.length -= 16
|
||||||
|
|
||||||
let state = zeroedBuffer(16)
|
let state = zeroedBuffer(16)
|
||||||
|
let counter = resetCounter()
|
||||||
|
|
||||||
if (ciphertext.length !== 0) {
|
if (ciphertext.length !== 0) {
|
||||||
state = [...authenticationTag]
|
state = [...authenticationTag]
|
||||||
const parsedCiphertext = parse(ciphertext, 16)
|
const parsedCiphertext = parse(ciphertext, 16)
|
||||||
@ -278,8 +280,6 @@ export function cryptoAeadDecrypt (ciphertext: number[], associatedData: number[
|
|||||||
const finalCiphertextBlockLength = parsedCiphertext[parsedCiphertextLength].length
|
const finalCiphertextBlockLength = parsedCiphertext[parsedCiphertextLength].length
|
||||||
parsedCiphertext[parsedCiphertextLength] = pad(parsedCiphertext[parsedCiphertextLength], 16)
|
parsedCiphertext[parsedCiphertextLength] = pad(parsedCiphertext[parsedCiphertextLength], 16)
|
||||||
|
|
||||||
var counter = resetCounter()
|
|
||||||
|
|
||||||
for (let i = 1; i < parsedCiphertextLength + 1; i++) {
|
for (let i = 1; i < parsedCiphertextLength + 1; i++) {
|
||||||
state = skinnyEncrypt(state, tweakeyEncode(counter, 4, nonce, key))
|
state = skinnyEncrypt(state, tweakeyEncode(counter, 4, nonce, key))
|
||||||
let mBlock
|
let mBlock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user