23 #ifndef CRYPTO_CURVE25519_h
24 #define CRYPTO_CURVE25519_h
26 #include "BigNumberUtil.h"
33 static bool eval(uint8_t result[32],
const uint8_t s[32],
const uint8_t x[32]);
35 static void dh1(uint8_t k[32], uint8_t f[32]);
36 static bool dh2(uint8_t k[32], uint8_t f[32]);
38 #if defined(TEST_CURVE25519_FIELD_OPS)
43 static uint8_t isWeakPoint(
const uint8_t k[32]);
45 static void reduce(limb_t *result, limb_t *x, uint8_t size);
46 static limb_t reduceQuick(limb_t *x);
48 static void mulNoReduce(limb_t *result,
const limb_t *x,
const limb_t *y);
50 static void mul(limb_t *result,
const limb_t *x,
const limb_t *y);
51 static void square(limb_t *result,
const limb_t *x)
56 static void mulA24(limb_t *result,
const limb_t *x);
58 static void mul_P(limb_t *result,
const limb_t *x,
const limb_t *y);
60 static void add(limb_t *result,
const limb_t *x,
const limb_t *y);
61 static void sub(limb_t *result,
const limb_t *x,
const limb_t *y);
63 static void cswap(limb_t select, limb_t *x, limb_t *y);
64 static void cmove(limb_t select, limb_t *x,
const limb_t *y);
66 static void pow250(limb_t *result,
const limb_t *x);
67 static void recip(limb_t *result,
const limb_t *x);
68 static bool sqrt(limb_t *result,
const limb_t *x);
Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19.
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Digital signatures based on the elliptic curve modulo 2^255 - 19.