jedisct1 / libsodium.js

libsodium compiled to Webassembly and pure JavaScript, with convenient wrappers.
Other
969 stars 138 forks source link

Version 0.7.9 is failing ristetto generation. #273

Closed koblas closed 3 years ago

koblas commented 3 years ago

The following test program will return faulty 90% of the time. Reverting back to 0.7.6 return working.

const _sodium = require("libsodium-wrappers-sumo");

async function libsodium() {
  await _sodium.ready;

  return _sodium;
}

async function main() {
  const s = await libsodium();

  const p = s.crypto_core_ristretto255_scalar_random();

  const valid = s.crypto_core_ristretto255_is_valid_point(p);
  if (!valid) {
    console.log("sodium install is faulty");
  } else {
    console.log("sodium install is working");
  }
}

main().then(() => true);
jedisct1 commented 3 years ago

crypto_core_ristretto255_scalar_random()

You're generating a scalar.

crypto_core_ristretto255_is_valid_point()

But checking a group element, not a scalar.