Those functions are used for both X25519 and EdDSA. Moving them up one
section makes it easier for user to delete the X-25519 section without
affecting EdDSA.
(Overall, Monocypher should let users delete the code they don't
need. This wasn't an explicit goal initially, but the code naturally
turned out that way. Supporting this use case cost us nothing.)
return isnonzero;
}
-///////////////
-/// X-25519 /// Taken from Supercop's ref10 implementation.
-///////////////
-
static void trim_scalar(u8 s[32])
{
s[ 0] &= 248;
static int scalar_bit(const u8 s[32], size_t i) {return (s[i>>3] >> (i&7)) & 1;}
+///////////////
+/// X-25519 /// Taken from Supercop's ref10 implementation.
+///////////////
+
int crypto_x25519(u8 raw_shared_secret[32],
const u8 your_secret_key [32],
const u8 their_public_key [32])