aboutsummaryrefslogtreecommitdiff
path: root/lib/ed25519/src/fe.h
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-03-03 11:14:50 +0000
committerMark Haines <mark.haines@matrix.org>2015-03-03 11:14:50 +0000
commit3ce450fc1984ac480ae158a40d60e9d42f77f74a (patch)
treeeb120d958eac8361d3760b9ad680fd8dc826d7a3 /lib/ed25519/src/fe.h
parent8bf99544160b1fd787e666b893c5117ab717bc99 (diff)
parent498dfabf9848286be003b42941c323a045d9fa46 (diff)
Merge commit '498dfabf9848286be003b42941c323a045d9fa46' as 'lib/ed25519'
Diffstat (limited to 'lib/ed25519/src/fe.h')
-rw-r--r--lib/ed25519/src/fe.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ed25519/src/fe.h b/lib/ed25519/src/fe.h
new file mode 100644
index 0000000..b4b62d2
--- /dev/null
+++ b/lib/ed25519/src/fe.h
@@ -0,0 +1,41 @@
+#ifndef FE_H
+#define FE_H
+
+#include "fixedint.h"
+
+
+/*
+ fe means field element.
+ Here the field is \Z/(2^255-19).
+ An element t, entries t[0]...t[9], represents the integer
+ t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
+ Bounds on each t[i] vary depending on context.
+*/
+
+
+typedef int32_t fe[10];
+
+
+void fe_0(fe h);
+void fe_1(fe h);
+
+void fe_frombytes(fe h, const unsigned char *s);
+void fe_tobytes(unsigned char *s, const fe h);
+
+void fe_copy(fe h, const fe f);
+int fe_isnegative(const fe f);
+int fe_isnonzero(const fe f);
+void fe_cmov(fe f, const fe g, unsigned int b);
+void fe_cswap(fe f, fe g, unsigned int b);
+
+void fe_neg(fe h, const fe f);
+void fe_add(fe h, const fe f, const fe g);
+void fe_invert(fe out, const fe z);
+void fe_sq(fe h, const fe f);
+void fe_sq2(fe h, const fe f);
+void fe_mul(fe h, const fe f, const fe g);
+void fe_mul121666(fe h, fe f);
+void fe_pow22523(fe out, const fe z);
+void fe_sub(fe h, const fe f, const fe g);
+
+#endif