diff --git a/crypto_aead.js b/crypto_aead.js index 774481a..d0bed22 100644 --- a/crypto_aead.js +++ b/crypto_aead.js @@ -28,7 +28,7 @@ function crypto_aead_chacha20poly1305_ietf_encrypt (c, m, ad, nsec, npub, k) { return m.length + crypto_aead_chacha20poly1305_ietf_ABYTES } - return ret + assert(false, 'could not encrypt data') } function crypto_aead_chacha20poly1305_ietf_encrypt_detached (c, mac, m, ad, nsec, npub, k) { @@ -95,7 +95,7 @@ function crypto_aead_chacha20poly1305_ietf_decrypt (m, nsec, c, ad, npub, k) { return c.length - crypto_aead_chacha20poly1305_ietf_ABYTES } - return ret + assert(false, 'could not verify data') } function crypto_aead_chacha20poly1305_ietf_decrypt_detached (m, nsec, c, mac, ad, npub, k) { @@ -143,7 +143,7 @@ function crypto_aead_chacha20poly1305_ietf_decrypt_detached (m, nsec, c, mac, ad if (ret !== 0) { m.fill(0) - return -1 + assert(false, 'could not verify data') } crypto_stream_chacha20_ietf_xor_ic(m, c, npub, 1, k) diff --git a/crypto_verify.js b/crypto_verify.js index 17db8b0..8dbd105 100644 --- a/crypto_verify.js +++ b/crypto_verify.js @@ -22,7 +22,7 @@ function crypto_verify_32(x, xi, y, yi) { } function sodium_memcmp (a, b) { - assert(a.byteLength = b.byteLength, 'buffers must be the same size') + assert(a.byteLength === b.byteLength, 'buffers must be the same size') return vn(a, 0, b, 0, a.byteLength) === 0 }