Fix crypto_secretbox return value

Problem: This doesn't cause a bug, when crypto_secretbox returns an
integer (`0`) then the check on line 97 always fails because it checks
whether the return value triple-equals `false`.

Solution: Change crypto_secretbox so that it returns booleans rather
than integers, which gives us the ability to make the check on line 97
fail (if we ever return anything other than `true`).
This commit is contained in:
Christian Bundy 2020-09-04 09:30:20 -07:00
parent a546f3e51d
commit b51d255ce4

View File

@ -37,7 +37,7 @@ function crypto_secretbox (c, m, n, k) {
c.subarray(0, crypto_onetimeauth_KEYBYTES) c.subarray(0, crypto_onetimeauth_KEYBYTES)
) )
c.fill(0, 0, crypto_secretbox_BOXZEROBYTES) c.fill(0, 0, crypto_secretbox_BOXZEROBYTES)
return 0 return true
} }
function crypto_secretbox_open (m, c, n, k) { function crypto_secretbox_open (m, c, n, k) {