Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/aes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,10 @@ export const gcm: TRet<
toClean.push(tag);
// NIST SP 800-38D §7.2 permits equivalent step orderings; verify the
// tag before CTR so unauthenticated plaintext is never materialized.
if (!equalBytes(tag, passedTag)) throw new Error('aes/gcm: invalid ghash tag');
if (!equalBytes(tag, passedTag)) {
clean(...toClean);
throw new Error('aes/gcm: invalid ghash tag');
}
const out = ctr32(xk, false, counter, data);
clean(...toClean);
return out as TRet<Uint8Array>;
Expand Down
Loading