From 919896d2bb350607e13eaf11bfad1c498b1decd6 Mon Sep 17 00:00:00 2001 From: Emil Bay Date: Wed, 24 Jun 2020 14:49:51 +0200 Subject: [PATCH] Revert accidental sign API change --- crypto_sign.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto_sign.js b/crypto_sign.js index c434135..2e11f78 100644 --- a/crypto_sign.js +++ b/crypto_sign.js @@ -254,6 +254,7 @@ function unpackneg (r, p) { return 0 } +/* eslint-disable no-unused-vars */ function crypto_sign_open (msg, sm, pk) { check(msg, sm.length - crypto_sign_BYTES) check(sm, crypto_sign_BYTES) @@ -284,13 +285,15 @@ function crypto_sign_open (msg, sm, pk) { n -= 64 if (crypto_verify_32(sm, 0, t, 0)) { for (i = 0; i < n; i++) m[i] = 0 - throw new Error('crypto_sign_open failed') + return false + // throw new Error('crypto_sign_open failed') } for (i = 0; i < n; i++) msg[i] = sm[i + 64] mlen = n - return mlen + return true } +/* eslint-enable no-unused-vars */ function crypto_sign_verify_detached (sig, m, pk) { check(sig, crypto_sign_BYTES)