commit d40f1cb45fc2cde8f7aa8967c05ecf37e89787ba
parent e5ec961535a84ee3f3661b0b107292b03c7cf339
Author: finwo <finwo@pm.me>
Date: Sun, 29 Jan 2023 20:58:37 +0100
Added orlp/ed25519
Diffstat:
5 files changed, 182 insertions(+), 0 deletions(-)
diff --git a/edge.cnf b/edge.cnf
@@ -4,4 +4,5 @@ cofyc/argparse=https://raw.githubusercontent.com/finwo/dep-repository/main/cofyc
finwo/assert=https://github.com/finwo/c-assert/archive/refs/tags/edge.tar.gz
finwo/http-parser=https://github.com/finwo/http-parser/archive/refs/tags/edge.tar.gz
finwo/matter=https://github.com/finwo/matter/archive/refs/tags/edge.tar.gz
+orlp/ed25519=https://raw.githubusercontent.com/finwo/dep-repository/main/orlp/ed25519/package.ini
rxi/dyad=https://raw.githubusercontent.com/finwo/dep-repository/main/rxi/dyad/package.ini
diff --git a/orlp/ed25519/config.mk b/orlp/ed25519/config.mk
@@ -0,0 +1,10 @@
+# SRC+=__DIRNAME/src/add_scalar.c
+SRC+=__DIRNAME/src/fe.c
+SRC+=__DIRNAME/src/ge.c
+SRC+=__DIRNAME/src/key_exchange.c
+SRC+=__DIRNAME/src/keypair.c
+SRC+=__DIRNAME/src/sc.c
+SRC+=__DIRNAME/src/seed.c
+SRC+=__DIRNAME/src/sha512.c
+SRC+=__DIRNAME/src/sign.c
+SRC+=__DIRNAME/src/verify.c
diff --git a/orlp/ed25519/package.ini b/orlp/ed25519/package.ini
@@ -0,0 +1,14 @@
+[package]
+name=orlp/ed25519
+src=https://github.com/orlp/ed25519/archive/refs/heads/master.tar.gz
+
+[fetch]
+config.mk=https://raw.githubusercontent.com/finwo/dep-repository/main/orlp/ed25519/config.mk
+patch/00-single-file-compile.patch=https://raw.githubusercontent.com/finwo/dep-repository/main/orlp/ed25519/patch/00-single-file-compile.patch
+
+[export]
+config.mk=config.mk
+include/orlp/ed25519.h=src/ed25519.h
+
+[build]
+0000=patch -p1 < patch/00-single-file-compile.patch
diff --git a/orlp/ed25519/patch/00-single-file-compile.patch b/orlp/ed25519/patch/00-single-file-compile.patch
@@ -0,0 +1,156 @@
+diff --git a/src/sc.c b/src/sc.c
+index ca5bad2..3d2ab56 100644
+--- a/src/sc.c
++++ b/src/sc.c
+@@ -1,7 +1,7 @@
+ #include "fixedint.h"
+ #include "sc.h"
+
+-static uint64_t load_3(const unsigned char *in) {
++static uint64_t sc_load_3(const unsigned char *in) {
+ uint64_t result;
+
+ result = (uint64_t) in[0];
+@@ -11,7 +11,7 @@ static uint64_t load_3(const unsigned char *in) {
+ return result;
+ }
+
+-static uint64_t load_4(const unsigned char *in) {
++static uint64_t sc_load_4(const unsigned char *in) {
+ uint64_t result;
+
+ result = (uint64_t) in[0];
+@@ -33,30 +33,30 @@ Output:
+ */
+
+ void sc_reduce(unsigned char *s) {
+- int64_t s0 = 2097151 & load_3(s);
+- int64_t s1 = 2097151 & (load_4(s + 2) >> 5);
+- int64_t s2 = 2097151 & (load_3(s + 5) >> 2);
+- int64_t s3 = 2097151 & (load_4(s + 7) >> 7);
+- int64_t s4 = 2097151 & (load_4(s + 10) >> 4);
+- int64_t s5 = 2097151 & (load_3(s + 13) >> 1);
+- int64_t s6 = 2097151 & (load_4(s + 15) >> 6);
+- int64_t s7 = 2097151 & (load_3(s + 18) >> 3);
+- int64_t s8 = 2097151 & load_3(s + 21);
+- int64_t s9 = 2097151 & (load_4(s + 23) >> 5);
+- int64_t s10 = 2097151 & (load_3(s + 26) >> 2);
+- int64_t s11 = 2097151 & (load_4(s + 28) >> 7);
+- int64_t s12 = 2097151 & (load_4(s + 31) >> 4);
+- int64_t s13 = 2097151 & (load_3(s + 34) >> 1);
+- int64_t s14 = 2097151 & (load_4(s + 36) >> 6);
+- int64_t s15 = 2097151 & (load_3(s + 39) >> 3);
+- int64_t s16 = 2097151 & load_3(s + 42);
+- int64_t s17 = 2097151 & (load_4(s + 44) >> 5);
+- int64_t s18 = 2097151 & (load_3(s + 47) >> 2);
+- int64_t s19 = 2097151 & (load_4(s + 49) >> 7);
+- int64_t s20 = 2097151 & (load_4(s + 52) >> 4);
+- int64_t s21 = 2097151 & (load_3(s + 55) >> 1);
+- int64_t s22 = 2097151 & (load_4(s + 57) >> 6);
+- int64_t s23 = (load_4(s + 60) >> 3);
++ int64_t s0 = 2097151 & sc_load_3(s);
++ int64_t s1 = 2097151 & (sc_load_4(s + 2) >> 5);
++ int64_t s2 = 2097151 & (sc_load_3(s + 5) >> 2);
++ int64_t s3 = 2097151 & (sc_load_4(s + 7) >> 7);
++ int64_t s4 = 2097151 & (sc_load_4(s + 10) >> 4);
++ int64_t s5 = 2097151 & (sc_load_3(s + 13) >> 1);
++ int64_t s6 = 2097151 & (sc_load_4(s + 15) >> 6);
++ int64_t s7 = 2097151 & (sc_load_3(s + 18) >> 3);
++ int64_t s8 = 2097151 & sc_load_3(s + 21);
++ int64_t s9 = 2097151 & (sc_load_4(s + 23) >> 5);
++ int64_t s10 = 2097151 & (sc_load_3(s + 26) >> 2);
++ int64_t s11 = 2097151 & (sc_load_4(s + 28) >> 7);
++ int64_t s12 = 2097151 & (sc_load_4(s + 31) >> 4);
++ int64_t s13 = 2097151 & (sc_load_3(s + 34) >> 1);
++ int64_t s14 = 2097151 & (sc_load_4(s + 36) >> 6);
++ int64_t s15 = 2097151 & (sc_load_3(s + 39) >> 3);
++ int64_t s16 = 2097151 & sc_load_3(s + 42);
++ int64_t s17 = 2097151 & (sc_load_4(s + 44) >> 5);
++ int64_t s18 = 2097151 & (sc_load_3(s + 47) >> 2);
++ int64_t s19 = 2097151 & (sc_load_4(s + 49) >> 7);
++ int64_t s20 = 2097151 & (sc_load_4(s + 52) >> 4);
++ int64_t s21 = 2097151 & (sc_load_3(s + 55) >> 1);
++ int64_t s22 = 2097151 & (sc_load_4(s + 57) >> 6);
++ int64_t s23 = (sc_load_4(s + 60) >> 3);
+ int64_t carry0;
+ int64_t carry1;
+ int64_t carry2;
+@@ -360,42 +360,42 @@ Output:
+ */
+
+ void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c) {
+- int64_t a0 = 2097151 & load_3(a);
+- int64_t a1 = 2097151 & (load_4(a + 2) >> 5);
+- int64_t a2 = 2097151 & (load_3(a + 5) >> 2);
+- int64_t a3 = 2097151 & (load_4(a + 7) >> 7);
+- int64_t a4 = 2097151 & (load_4(a + 10) >> 4);
+- int64_t a5 = 2097151 & (load_3(a + 13) >> 1);
+- int64_t a6 = 2097151 & (load_4(a + 15) >> 6);
+- int64_t a7 = 2097151 & (load_3(a + 18) >> 3);
+- int64_t a8 = 2097151 & load_3(a + 21);
+- int64_t a9 = 2097151 & (load_4(a + 23) >> 5);
+- int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
+- int64_t a11 = (load_4(a + 28) >> 7);
+- int64_t b0 = 2097151 & load_3(b);
+- int64_t b1 = 2097151 & (load_4(b + 2) >> 5);
+- int64_t b2 = 2097151 & (load_3(b + 5) >> 2);
+- int64_t b3 = 2097151 & (load_4(b + 7) >> 7);
+- int64_t b4 = 2097151 & (load_4(b + 10) >> 4);
+- int64_t b5 = 2097151 & (load_3(b + 13) >> 1);
+- int64_t b6 = 2097151 & (load_4(b + 15) >> 6);
+- int64_t b7 = 2097151 & (load_3(b + 18) >> 3);
+- int64_t b8 = 2097151 & load_3(b + 21);
+- int64_t b9 = 2097151 & (load_4(b + 23) >> 5);
+- int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
+- int64_t b11 = (load_4(b + 28) >> 7);
+- int64_t c0 = 2097151 & load_3(c);
+- int64_t c1 = 2097151 & (load_4(c + 2) >> 5);
+- int64_t c2 = 2097151 & (load_3(c + 5) >> 2);
+- int64_t c3 = 2097151 & (load_4(c + 7) >> 7);
+- int64_t c4 = 2097151 & (load_4(c + 10) >> 4);
+- int64_t c5 = 2097151 & (load_3(c + 13) >> 1);
+- int64_t c6 = 2097151 & (load_4(c + 15) >> 6);
+- int64_t c7 = 2097151 & (load_3(c + 18) >> 3);
+- int64_t c8 = 2097151 & load_3(c + 21);
+- int64_t c9 = 2097151 & (load_4(c + 23) >> 5);
+- int64_t c10 = 2097151 & (load_3(c + 26) >> 2);
+- int64_t c11 = (load_4(c + 28) >> 7);
++ int64_t a0 = 2097151 & sc_load_3(a);
++ int64_t a1 = 2097151 & (sc_load_4(a + 2) >> 5);
++ int64_t a2 = 2097151 & (sc_load_3(a + 5) >> 2);
++ int64_t a3 = 2097151 & (sc_load_4(a + 7) >> 7);
++ int64_t a4 = 2097151 & (sc_load_4(a + 10) >> 4);
++ int64_t a5 = 2097151 & (sc_load_3(a + 13) >> 1);
++ int64_t a6 = 2097151 & (sc_load_4(a + 15) >> 6);
++ int64_t a7 = 2097151 & (sc_load_3(a + 18) >> 3);
++ int64_t a8 = 2097151 & sc_load_3(a + 21);
++ int64_t a9 = 2097151 & (sc_load_4(a + 23) >> 5);
++ int64_t a10 = 2097151 & (sc_load_3(a + 26) >> 2);
++ int64_t a11 = (sc_load_4(a + 28) >> 7);
++ int64_t b0 = 2097151 & sc_load_3(b);
++ int64_t b1 = 2097151 & (sc_load_4(b + 2) >> 5);
++ int64_t b2 = 2097151 & (sc_load_3(b + 5) >> 2);
++ int64_t b3 = 2097151 & (sc_load_4(b + 7) >> 7);
++ int64_t b4 = 2097151 & (sc_load_4(b + 10) >> 4);
++ int64_t b5 = 2097151 & (sc_load_3(b + 13) >> 1);
++ int64_t b6 = 2097151 & (sc_load_4(b + 15) >> 6);
++ int64_t b7 = 2097151 & (sc_load_3(b + 18) >> 3);
++ int64_t b8 = 2097151 & sc_load_3(b + 21);
++ int64_t b9 = 2097151 & (sc_load_4(b + 23) >> 5);
++ int64_t b10 = 2097151 & (sc_load_3(b + 26) >> 2);
++ int64_t b11 = (sc_load_4(b + 28) >> 7);
++ int64_t c0 = 2097151 & sc_load_3(c);
++ int64_t c1 = 2097151 & (sc_load_4(c + 2) >> 5);
++ int64_t c2 = 2097151 & (sc_load_3(c + 5) >> 2);
++ int64_t c3 = 2097151 & (sc_load_4(c + 7) >> 7);
++ int64_t c4 = 2097151 & (sc_load_4(c + 10) >> 4);
++ int64_t c5 = 2097151 & (sc_load_3(c + 13) >> 1);
++ int64_t c6 = 2097151 & (sc_load_4(c + 15) >> 6);
++ int64_t c7 = 2097151 & (sc_load_3(c + 18) >> 3);
++ int64_t c8 = 2097151 & sc_load_3(c + 21);
++ int64_t c9 = 2097151 & (sc_load_4(c + 23) >> 5);
++ int64_t c10 = 2097151 & (sc_load_3(c + 26) >> 2);
++ int64_t c11 = (sc_load_4(c + 28) >> 7);
+ int64_t s0;
+ int64_t s1;
+ int64_t s2;
diff --git a/stable.cnf b/stable.cnf
@@ -4,4 +4,5 @@ cofyc/argparse=https://raw.githubusercontent.com/finwo/dep-repository/main/cofyc
finwo/assert=https://github.com/finwo/c-assert/archive/refs/tags/stable.tar.gz
finwo/http-parser=https://github.com/finwo/http-parser/archive/refs/tags/stable.tar.gz
finwo/matter=https://github.com/finwo/matter/archive/refs/tags/stable.tar.gz
+orlp/ed25519=https://raw.githubusercontent.com/finwo/dep-repository/main/orlp/ed25519/package.ini
rxi/dyad=https://raw.githubusercontent.com/finwo/dep-repository/main/rxi/dyad/package.ini