]> pd.if.org Git - zpackage/blobdiff - crypto/ref10/fe.h
commit files needed for zpm-fetchurl
[zpackage] / crypto / ref10 / fe.h
diff --git a/crypto/ref10/fe.h b/crypto/ref10/fe.h
new file mode 100644 (file)
index 0000000..eaa5e66
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef FE_H
+#define FE_H
+
+#include <stdint.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.
+*/
+int x25519(unsigned char *q, const unsigned char *n, const unsigned char *p);
+
+void fe_frombytes(int32_t fe[10], const unsigned char *);
+void fe_tobytes(unsigned char *, int32_t fe[10]);
+
+void fe_copy(int32_t dest[10], int32_t src[10]);
+void fe_0(int32_t fe[10]);
+void fe_1(int32_t fe[10]);
+void fe_cswap(int32_t a[10], int32_t b[10], unsigned int);
+
+void fe_add(int32_t dest[10], int32_t a[10], int32_t b[10]);
+void fe_sub(int32_t dest[10], int32_t a[10], int32_t b[10]);
+void fe_mul(int32_t dest[10], int32_t a[10], int32_t b[10]);
+void fe_sq(int32_t dest[10], int32_t a[10]);
+void fe_mul121666(int32_t dest[10], int32_t a[10]);
+void fe_invert(int32_t dest[10], int32_t a[10]);
+
+#endif