Commit 71afcdd7 authored by Robert Ransom's avatar Robert Ransom
Browse files

Add comments marking the beginning and end of coordinate-field operations

This makes it much easier for a simple script to extract the
coordinate-field operations for use in other software operating on the
Curve25519 elliptic curve (or other curves with the same coordinate field).
parent da7b6b82
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
#include <stdint.h>

typedef uint8_t u8;

/* Beginning of Curve25519 coordinate-field operation functions */

typedef uint64_t limb;
typedef limb felem[5];
// This is a special gcc mode for 128-bit integers. It's implemented on 64-bit
@@ -318,6 +321,8 @@ crecip(felem out, const felem z) {
  /* 2^255 - 21 */ fmul(out, t0, a);
}

/* End of Curve25519 coordinate-field operation functions */

/* Input: Q, Q', Q-Q'
 * Output: 2Q, Q+Q'
 *
+5 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@

typedef uint8_t u8;
typedef int32_t s32;

/* Beginning of Curve25519 coordinate-field operation functions */

typedef int64_t limb;

typedef limb felem_short[10];
@@ -585,6 +588,8 @@ crecip(felem_short out, const felem_short z) {
  /* 2^255 - 21 */ fmul(out,t1,z11);
}

/* End of Curve25519 coordinate-field operation functions */

/* Input: Q, Q', Q-Q'
 * Output: 2Q, Q+Q'
 *