23 #ifndef CRYPTO_ED25519_h
24 #define CRYPTO_ED25519_h
26 #include "BigNumberUtil.h"
32 static void sign(uint8_t signature[64],
const uint8_t privateKey[32],
33 const uint8_t publicKey[32],
const void *message,
35 static bool verify(
const uint8_t signature[64],
const uint8_t publicKey[32],
36 const void *message,
size_t len);
39 static void derivePublicKey(uint8_t publicKey[32],
const uint8_t privateKey[32]);
49 limb_t x[32 /
sizeof(limb_t)];
50 limb_t y[32 /
sizeof(limb_t)];
51 limb_t z[32 /
sizeof(limb_t)];
52 limb_t t[32 /
sizeof(limb_t)];
55 static void reduceQFromBuffer(limb_t *result,
const uint8_t buf[64], limb_t *temp);
56 static void reduceQ(limb_t *result, limb_t *r);
58 static void mul(Point &result,
const limb_t *s, Point &p,
bool constTime =
true);
59 static void mul(Point &result,
const limb_t *s,
bool constTime =
true);
61 static void add(Point &p,
const Point &q);
63 static bool equal(
const Point &p,
const Point &q);
65 static void encodePoint(uint8_t *buf, Point &point);
66 static bool decodePoint(Point &point,
const uint8_t *buf);
68 static void deriveKeys(
SHA512 *hash, limb_t *a,
const uint8_t privateKey[32]);
Digital signatures based on the elliptic curve modulo 2^255 - 19.
static void sign(uint8_t signature[64], const uint8_t privateKey[32], const uint8_t publicKey[32], const void *message, size_t len)
Signs a message using a specific Ed25519 private key.
static void derivePublicKey(uint8_t publicKey[32], const uint8_t privateKey[32])
Derives the public key from a private key.
static void generatePrivateKey(uint8_t privateKey[32])
Generates a private key for Ed25519 signing operations.
static bool verify(const uint8_t signature[64], const uint8_t publicKey[32], const void *message, size_t len)
Verifies a signature using a specific Ed25519 public key.