From b51d255ce46e75717d1d723ca407ab323b2c2616 Mon Sep 17 00:00:00 2001 From: Christian Bundy Date: Fri, 4 Sep 2020 09:30:20 -0700 Subject: [PATCH] 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`). --- crypto_secretbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_secretbox.js b/crypto_secretbox.js index 05fb264..f7d0ef7 100644 --- a/crypto_secretbox.js +++ b/crypto_secretbox.js @@ -37,7 +37,7 @@ function crypto_secretbox (c, m, n, k) { c.subarray(0, crypto_onetimeauth_KEYBYTES) ) c.fill(0, 0, crypto_secretbox_BOXZEROBYTES) - return 0 + return true } function crypto_secretbox_open (m, c, n, k) {