Skip to content

Commit

Permalink
fix: defer decryption after tag verification passes
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jul 17, 2021
1 parent 6df5375 commit 0795a87
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/help/crypto_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ if (isMainThread) {
const preAuth = pae('v1.local.', n, c, f)

const t2 = methods.hmac('sha384', preAuth, ak)
if (!timingSafeEqual(t, t2)) return false
const payload = methods.decrypt('aes-256-ctr', c, ek, n.slice(16))

if (!timingSafeEqual(t, t2) || !payload) {
return false
}
if (!payload) return false

return payload
},
Expand Down

0 comments on commit 0795a87

Please sign in to comment.