From e597b14bae59725c6c61f6f159932084be37c555 Mon Sep 17 00:00:00 2001 From: Christian Bundy Date: Fri, 4 Sep 2020 09:23:37 -0700 Subject: [PATCH] Remove unused argument from crypto_kx Problem: randombytes_buf uses the size of the buffer as the number of bytes to output, so we don't need to add an argument about the number of bytes we want. Solution: Remove unused argument and use buffer size assertion to be sure that we're producing the correct number of random bytes. --- crypto_kx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_kx.js b/crypto_kx.js index d9d7e63..d95b237 100644 --- a/crypto_kx.js +++ b/crypto_kx.js @@ -12,7 +12,7 @@ function crypto_kx_keypair (pk, sk) { assert(pk.byteLength === crypto_kx_PUBLICKEYBYTES, "pk must be 'crypto_kx_PUBLICKEYBYTES' bytes") assert(sk.byteLength === crypto_kx_SECRETKEYBYTES, "sk must be 'crypto_kx_SECRETKEYBYTES' bytes") - randombytes_buf(sk, crypto_kx_SECRETKEYBYTES) + randombytes_buf(sk) return crypto_scalarmult_base(pk, sk) }