From 80d13dddbff98d0277c980799e273610874b41d3 Mon Sep 17 00:00:00 2001 From: Stuart D. Gathman Date: Sep 29 2020 19:51:08 +0000 Subject: Merge branch 'master' into f31 --- diff --git a/.gitignore b/.gitignore index 71dd0db..94860c6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ /cjdns-v20.5.tar.gz /cjdns-v20.6.tar.gz /cjdns-v20.7.tar.gz +/cjdns-v21.tar.gz diff --git a/cjdns.32bit.patch b/cjdns.32bit.patch new file mode 100644 index 0000000..6696c84 --- /dev/null +++ b/cjdns.32bit.patch @@ -0,0 +1,14 @@ +diff -up ./memory/Allocator.c.32bit ./memory/Allocator.c +--- ./memory/Allocator.c.32bit 2020-09-29 14:10:32.115169486 -0400 ++++ ./memory/Allocator.c 2020-09-29 14:16:54.682448839 -0400 +@@ -59,8 +59,8 @@ static void unroll(struct Allocator_pvt* + writeUnroller(&childUnroller); + fprintf(stderr, "%s:%ld [%lu] bytes at [0x%lx]\n", + allocation->fileName, +- allocation->lineNum, +- allocation->pub.size, ++ (long)allocation->lineNum, ++ (unsigned long)allocation->pub.size, + (long)(uintptr_t)allocation); + allocation = allocation->next; + } diff --git a/cjdns.sign.patch b/cjdns.sign.patch index c4d8f8b..c86619d 100644 --- a/cjdns.sign.patch +++ b/cjdns.sign.patch @@ -1,24 +1,51 @@ -diff -up ./crypto/Sign.c.sign ./crypto/Sign.c ---- ./crypto/Sign.c.sign 2016-10-11 17:39:44.000000000 -0400 -+++ ./crypto/Sign.c 2016-10-14 20:59:49.143754098 -0400 -@@ -13,6 +13,7 @@ - * along with this program. If not, see . - */ +diff -up ./crypto/CryptoAuth.c.sign ./crypto/CryptoAuth.c +--- ./crypto/CryptoAuth.c.sign 2020-09-18 14:24:44.000000000 -0400 ++++ ./crypto/CryptoAuth.c 2020-09-29 10:32:39.040375439 -0400 +@@ -85,8 +85,10 @@ static inline void getSharedSecret(uint8 + uint8_t passwordHash[32], + struct Log* logger) + { ++ int keygenfailed; + if (passwordHash == NULL) { +- crypto_box_curve25519xsalsa20poly1305_beforenm(outputSecret, herPublicKey, myPrivateKey); ++ keygenfailed = crypto_box_curve25519xsalsa20poly1305_beforenm( ++ outputSecret, herPublicKey, myPrivateKey); + } else { + union { + struct { +@@ -96,7 +98,8 @@ static inline void getSharedSecret(uint8 + uint8_t bytes[64]; + } buff; -+#ifdef SUBNODE - #include "crypto/Sign.h" +- crypto_scalarmult_curve25519(buff.components.key, myPrivateKey, herPublicKey); ++ keygenfailed = crypto_scalarmult_curve25519( ++ buff.components.key, myPrivateKey, herPublicKey); + Bits_memcpy(buff.components.passwd, passwordHash, 32); + crypto_hash_sha256(outputSecret, buff.bytes, 64); + } +@@ -114,8 +117,9 @@ static inline void getSharedSecret(uint8 + " myPublicKey=%s\n" + " herPublicKey=%s\n" + " passwordHash=%s\n" +- " outputSecret=%s\n", +- myPublicKeyHex, herPublicKeyHex, passwordHashHex, outputSecretHex); ++ " outputSecret=%s\n" ++ " keygenfailed=%d\n", ++ myPublicKeyHex, herPublicKeyHex, passwordHashHex, outputSecretHex,keygenfailed); + } + } - #include "node_build/dependencies/cnacl/crypto_sign/ed25519/ref10/ge.h" -@@ -110,3 +111,6 @@ int Sign_publicSigningKeyToCurve25519(ui +diff -up ./crypto/Sign.c.sign ./crypto/Sign.c +--- ./crypto/Sign.c.sign 2020-09-18 14:24:44.000000000 -0400 ++++ ./crypto/Sign.c 2020-09-29 10:25:02.503986487 -0400 +@@ -210,3 +210,4 @@ int Sign_publicSigningKeyToCurve25519(ui return 0; } -+#else +#pragma GCC diagnostic ignored "-Wpedantic" -+#endif // SUBNODE diff -up ./crypto/test/Sign_test.c.sign ./crypto/test/Sign_test.c ---- ./crypto/test/Sign_test.c.sign 2016-10-11 17:39:44.000000000 -0400 -+++ ./crypto/test/Sign_test.c 2016-10-14 20:57:28.737064976 -0400 +--- ./crypto/test/Sign_test.c.sign 2020-09-18 14:24:44.000000000 -0400 ++++ ./crypto/test/Sign_test.c 2020-09-29 10:25:02.503986487 -0400 @@ -23,6 +23,7 @@ int main() @@ -27,10 +54,10 @@ diff -up ./crypto/test/Sign_test.c.sign ./crypto/test/Sign_test.c struct Allocator* alloc = MallocAllocator_new(1048576); struct Log* logger = FileWriterLog_new(stdout, alloc); struct Random* rand = Random_new(alloc, logger, NULL); -@@ -42,5 +43,6 @@ int main() - Assert_true(!Sign_verifyMsg(&signingKeyPair[32], msg)); - Assert_true(!Sign_publicSigningKeyToCurve25519(curve25519publicB, &signingKeyPair[32])); +@@ -44,5 +45,6 @@ int main() Assert_true(!Bits_memcmp(curve25519publicB, curve25519public, 32)); + + Allocator_free(alloc); +#endif // SUBNODE return 0; } diff --git a/cjdns.sodium.patch b/cjdns.sodium.patch index c2e3393..89f60b9 100644 --- a/cjdns.sodium.patch +++ b/cjdns.sodium.patch @@ -1,15 +1,15 @@ diff -up ./client/cjdroute2.c.sodium ./client/cjdroute2.c ---- ./client/cjdroute2.c.sodium 2017-05-24 16:30:27.567751409 -0400 -+++ ./client/cjdroute2.c 2017-05-24 16:56:13.496738433 -0400 -@@ -57,6 +57,7 @@ - #include - #include - #include +--- ./client/cjdroute2.c.sodium 2020-09-28 22:33:15.839316844 -0400 ++++ ./client/cjdroute2.c 2020-09-28 22:34:40.219680315 -0400 +@@ -64,6 +64,7 @@ + #include + #include + #include +#include #define DEFAULT_TUN_DEV "tun0" -@@ -523,6 +524,9 @@ static void onCoreExit(int64_t exit_stat +@@ -598,6 +599,9 @@ static String* getPipePath(Dict* config, int main(int argc, char** argv) { @@ -20,9 +20,9 @@ diff -up ./client/cjdroute2.c.sodium ./client/cjdroute2.c fprintf(stderr, "Log_LEVEL = KEYS, EXPECT TO SEE PRIVATE KEYS IN YOUR LOGS!\n"); #endif diff -up ./contrib/c/makekeys.c.sodium ./contrib/c/makekeys.c ---- ./contrib/c/makekeys.c.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./contrib/c/makekeys.c 2017-05-24 16:52:43.541154825 -0400 -@@ -23,9 +23,13 @@ +--- ./contrib/c/makekeys.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./contrib/c/makekeys.c 2020-09-28 22:33:15.853317070 -0400 +@@ -22,9 +22,13 @@ #include #include @@ -37,8 +37,8 @@ diff -up ./contrib/c/makekeys.c.sodium ./contrib/c/makekeys.c struct Random* rand = Random_new(alloc, NULL, NULL); diff -up ./contrib/c/mkpasswd.c.sodium ./contrib/c/mkpasswd.c ---- ./contrib/c/mkpasswd.c.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./contrib/c/mkpasswd.c 2017-05-24 16:53:15.323545923 -0400 +--- ./contrib/c/mkpasswd.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./contrib/c/mkpasswd.c 2020-09-28 22:33:15.853317070 -0400 @@ -18,9 +18,13 @@ #include @@ -54,8 +54,8 @@ diff -up ./contrib/c/mkpasswd.c.sodium ./contrib/c/mkpasswd.c struct Random* rand = Random_new(alloc, NULL, NULL); diff -up ./contrib/c/privatetopublic.c.sodium ./contrib/c/privatetopublic.c ---- ./contrib/c/privatetopublic.c.sodium 2017-05-24 16:43:13.814155821 -0400 -+++ ./contrib/c/privatetopublic.c 2017-05-24 16:53:27.460695277 -0400 +--- ./contrib/c/privatetopublic.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./contrib/c/privatetopublic.c 2020-09-28 22:33:15.853317070 -0400 @@ -23,6 +23,7 @@ #include #include @@ -75,8 +75,8 @@ diff -up ./contrib/c/privatetopublic.c.sodium ./contrib/c/privatetopublic.c Hex_decode(privateKey, 32, privateKeyHexIn, 64); crypto_scalarmult_curve25519_base(address.key, privateKey); diff -up ./contrib/c/publictoip6.c.sodium ./contrib/c/publictoip6.c ---- ./contrib/c/publictoip6.c.sodium 2017-05-24 16:42:11.085386456 -0400 -+++ ./contrib/c/publictoip6.c 2017-05-24 16:53:33.295767080 -0400 +--- ./contrib/c/publictoip6.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./contrib/c/publictoip6.c 2020-09-28 22:33:15.853317070 -0400 @@ -16,6 +16,7 @@ #include "util/AddrTools.h" #include "util/CString.h" @@ -96,8 +96,8 @@ diff -up ./contrib/c/publictoip6.c.sodium ./contrib/c/publictoip6.c int ret = Key_parse(&key, keyBytes, ip6Bytes); switch (ret) { diff -up ./contrib/c/sybilsim.c.sodium ./contrib/c/sybilsim.c ---- ./contrib/c/sybilsim.c.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./contrib/c/sybilsim.c 2017-05-24 16:53:39.030837653 -0400 +--- ./contrib/c/sybilsim.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./contrib/c/sybilsim.c 2020-09-28 22:33:15.853317070 -0400 @@ -42,6 +42,7 @@ #include "crypto_scalarmult_curve25519.h" @@ -117,8 +117,8 @@ diff -up ./contrib/c/sybilsim.c.sodium ./contrib/c/sybilsim.c struct Allocator* alloc = MallocAllocator_new(1LL<<31); diff -up ./crypto/random/randombytes.c.sodium ./crypto/random/randombytes.c ---- ./crypto/random/randombytes.c.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./crypto/random/randombytes.c 2017-05-24 16:54:01.745117164 -0400 +--- ./crypto/random/randombytes.c.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./crypto/random/randombytes.c 2020-09-28 22:33:15.853317070 -0400 @@ -17,6 +17,7 @@ #include "memory/MallocAllocator.h" @@ -138,9 +138,9 @@ diff -up ./crypto/random/randombytes.c.sodium ./crypto/random/randombytes.c Random_bytes(rand, str.buff, 4096); out = write(STDOUT_FILENO, str.buff, 4096); diff -up ./node_build/make.js.sodium ./node_build/make.js ---- ./node_build/make.js.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./node_build/make.js 2017-05-24 16:39:15.557233617 -0400 -@@ -244,48 +244,8 @@ Builder.configure({ +--- ./node_build/make.js.sodium 2020-09-18 14:24:44.000000000 -0400 ++++ ./node_build/make.js 2020-09-28 22:33:15.853317070 -0400 +@@ -264,48 +264,8 @@ Builder.configure({ }).nThen(function (waitFor) { @@ -191,33 +191,33 @@ diff -up ./node_build/make.js.sodium ./node_build/make.js }).nThen(function (waitFor) { -@@ -422,7 +386,7 @@ Builder.configure({ +@@ -452,7 +412,7 @@ Builder.configure({ builder.buildExecutable('crypto/random/randombytes.c'); builder.lintFiles(function (fileName, file, callback) { -- if (/dependencies/.test(fileName)) { -+ if (/(dependencies|\/usr\/include)/.test(fileName)) { +- if (/dependencies/.test(fileName) || /crypto\/sign/.test(fileName)) { ++ if (/(dependencies|\/usr\/include)/.test(fileName) || /crypto\/sign/.test(fileName)) { callback('', false); return; } diff -up ./test/testcjdroute.c.sodium ./test/testcjdroute.c ---- ./test/testcjdroute.c.sodium 2017-02-21 17:56:22.000000000 -0500 -+++ ./test/testcjdroute.c 2017-05-24 16:57:05.397377097 -0400 -@@ -19,6 +19,7 @@ - #include "memory/MallocAllocator.h" - +--- ./test/testcjdroute.c.sodium 2020-09-28 22:33:15.854317087 -0400 ++++ ./test/testcjdroute.c 2020-09-28 22:36:34.386525092 -0400 +@@ -26,6 +26,7 @@ #include + #include + #include +#include #ifdef SUBNODE #define testcjdroute_SUBNODE 1 -@@ -72,6 +73,9 @@ static void usage(char* appName) +@@ -272,6 +273,9 @@ static int main2(int argc, char** argv, int main(int argc, char** argv) { + if (sodium_init() == -1) { + return 1; + } - struct Allocator* alloc = MallocAllocator_new(4096); - struct EventBase* base = EventBase_new(alloc); - uint64_t now = Time_hrtime(); + struct Allocator* alloc = MallocAllocator_new(1<<24); + struct RandomSeed* rs = DeterminentRandomSeed_new(alloc, RANDOM_SEED); + struct Random* detRand = Random_newWithSeed(alloc, NULL, rs, NULL); diff --git a/cjdns.spec b/cjdns.spec index e735584..63ea086 100644 --- a/cjdns.spec +++ b/cjdns.spec @@ -6,12 +6,12 @@ %bcond_with subnode # Option to use the optimized libnacl embedded with cjdns # Required since v20 due to use of private cnacl APIs -%bcond_without embedded +%bcond_with embedded # Option to enable CPU specific optimization # Default to generic for distro builds %bcond_without generic -# Option to use libsodium instead of nacl (broken since v20) -%bcond_with libsodium +# Option to use libsodium instead of nacl (broken since v20, fixed v21) +%bcond_without libsodium # Option to disable SECCOMP: confusing backward logic # Needed to run on openvz and other container systems %ifarch armv7hl @@ -84,8 +84,8 @@ Name: cjdns # major version is cjdns protocol version: -Version: 20.7 -Release: 1%{?dist} +Version: 21 +Release: 2%{?dist} Summary: The privacy-friendly network without borders # cjdns is all GPLv3 except libuv which is MIT and BSD and ISC # cnacl is unused except when use_embedded is true @@ -124,8 +124,6 @@ Patch5: cjdns.sbin.patch Patch6: cjdns.dyn.patch # Patch to use _LINUX_CAPABILITY_3 (cjdns < 18) #Patch7: cjdns.cap3.patch -# Patch some source files to ignore selected warnings that break gcc6 builds -#Patch8: cjdns.warnings.patch # Man pages Patch9: cjdns.man.patch # Patch some bugs in nodejs tools @@ -154,6 +152,8 @@ Patch18: cjdns.libuv.patch Patch20: cjdns.sysctl.patch # gcc-10 no longer allows duplicate globals Patch22: cjdns.gcc10.patch +# Patches for 32-bit builds +Patch23: cjdns.32bit.patch %if %{use_marked} BuildRequires: nodejs, nodejs-marked, python3 @@ -312,10 +312,9 @@ elif test -d %{_includedir}/nacl && test -r %{_libdir}/libnacl.a; then cd - fi %patch12 -b .sign -%endif - -%if !0%{?rhel} || 0%{?rhel} > 6 -#patch8 -b .warnings +cd crypto/sign +sed -i -e'/^#include / s,[<>],",g' crypto*int*.h +cd - %endif %patch9 -b .man @@ -338,6 +337,7 @@ sed -i -e '/optimizeLevel:/ s/-O0/-O3/' node_build/make.js #patch19 -p1 -b .fuzz #patch20 -p1 -b .sysctl #patch22 -b .gcc10 +%patch23 -b .32bit cp %{SOURCE1} README_Fedora.md @@ -385,7 +385,7 @@ sed -i -e 's/-march=native/-mtune=native/' node_build/make.js %else sed -i -e 's/-march=native/-mtune=generic/' node_build/make.js %endif -rm node_build/dependencies/cnacl/node_build/plans/*_AVX_plan.json +#rm node_build/dependencies/cnacl/node_build/plans/*_AVX_plan.json # Leaving SSE2 code in since x86 is secondary arch and pretty much everyone # is going to have SSE2, except things like XO-1 which needs custom build. #rm node_build/dependencies/cnacl/node_build/plans/x86_SSE2_plan.json @@ -745,6 +745,15 @@ fi %{_bindir}/graphStats %changelog +* Mon Sep 28 2020 Stuart Gathman - 21-2 +- Enable libsodium + +* Sat Sep 26 2020 Stuart Gathman - 21-1 +- New upstream release + +* Mon Jul 27 2020 Fedora Release Engineering - 20.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Wed Jul 1 2020 Stuart Gathman - 20.7-1 - New upstream release - Use pandoc for manpages diff --git a/sources b/sources index 4773c62..7f9f7e1 100644 --- a/sources +++ b/sources @@ -3,3 +3,4 @@ SHA512 (python-cjdns-0.1.tar.gz) = f3b7c9afe6bc2f8b0b872cc7fbe9e997657ecf1cbb1f7 SHA512 (cjdns-v20.5.tar.gz) = 36ae20182b9e9601ae64630cb0fa96caccbe5279be48520ea8b457a15437da5c9b48a5ae5588bd76ef819efe696b5a582a906a50e4dbe7760bb96fa7d1d63ea3 SHA512 (cjdns-v20.6.tar.gz) = 34057583f2215899b96f95cc60ba0532aff12834ad2c4b432a6752c811f60ed3d6d33ec82e039b159f090558020faf69c71b373ac33ca9e41b186be0b87c3332 SHA512 (cjdns-v20.7.tar.gz) = db103e70e3d9f5e4958dcbeed51df358450f9489b6573f9b9eddc1839ee2051fe5180eede894b465e92915fabcb4cb64ce08a41c06450f14de75943879633f25 +SHA512 (cjdns-v21.tar.gz) = 2c0b80c715c8895b573c09787df8be9fcc721d0903c90a32649e22f72e2d7b0b13d4254f31936c61f47cdd1fee8e3cf4a28f827571f94972557258e4a42f9eb2