From fc6ccd1080918a433d03f9e0762296b0e486aef8 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sun, 31 Aug 2014 15:44:42 -0400 Subject: [PATCH] cjdns: package update from 20140303 to 20140829 --- pkgs/tools/networking/cjdns/default.nix | 16 ++++-- pkgs/tools/networking/cjdns/makekey.patch | 64 +++++++++++++++++++++++ 2 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 pkgs/tools/networking/cjdns/makekey.patch diff --git a/pkgs/tools/networking/cjdns/default.nix b/pkgs/tools/networking/cjdns/default.nix index 48e21f4507e5..be107dfa81e7 100644 --- a/pkgs/tools/networking/cjdns/default.nix +++ b/pkgs/tools/networking/cjdns/default.nix @@ -1,21 +1,27 @@ { stdenv, fetchgit, nodejs, which, python27 }: let - date = "20140303"; - rev = "f11ce1fd4795b0173ac0ef18c8a6f752aa824adb"; + date = "20140829"; + rev = "9595d67f9edd759054c5bd3aaee0968ff55e361a"; in stdenv.mkDerivation { name = "cjdns-${date}-${stdenv.lib.strings.substring 0 7 rev}"; src = fetchgit { - url = "git://github.com/cjdelisle/cjdns.git"; + url = "https://github.com/cjdelisle/cjdns.git"; inherit rev; - sha256 = "1bxhf9f1v0slf9mz3ll6jf45mkwvwxlf3yqxx9k23kjyr1nsc8s8"; + sha256 = "519c549c42ae26c5359ae13a4548c44b51e36db403964b4d9f78c19b749dfb83"; }; buildInputs = [ which python27 nodejs]; - builder = ./builder.sh; + patches = [ ./makekey.patch ]; + + buildPhase = "bash do"; + installPhase = '' + mkdir -p $out/sbin + cp cjdroute makekey $out/sbin + ''; meta = { homepage = https://github.com/cjdelisle/cjdns; diff --git a/pkgs/tools/networking/cjdns/makekey.patch b/pkgs/tools/networking/cjdns/makekey.patch new file mode 100644 index 000000000000..fcce5e3e728e --- /dev/null +++ b/pkgs/tools/networking/cjdns/makekey.patch @@ -0,0 +1,64 @@ +diff --git a/contrib/c/makekey.c b/contrib/c/makekey.c +new file mode 100644 +index 0000000..c7184e5 +--- /dev/null ++++ b/contrib/c/makekey.c +@@ -0,0 +1,46 @@ ++/* vim: set expandtab ts=4 sw=4: */ ++/* ++ * You may redistribute this program and/or modify it under the terms of ++ * the GNU General Public License as published by the Free Software Foundation, ++ * either version 3 of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++#include "crypto/random/Random.h" ++#include "memory/MallocAllocator.h" ++#include "crypto/AddressCalc.h" ++#include "util/AddrTools.h" ++#include "util/Hex.h" ++ ++#include "crypto_scalarmult_curve25519.h" ++ ++#include ++ ++int main(int argc, char** argv) ++{ ++ struct Allocator* alloc = MallocAllocator_new(1<<22); ++ struct Random* rand = Random_new(alloc, NULL, NULL); ++ ++ uint8_t privateKey[32]; ++ uint8_t publicKey[32]; ++ uint8_t ip[16]; ++ uint8_t hexPrivateKey[65]; ++ ++ for (;;) { ++ Random_bytes(rand, privateKey, 32); ++ crypto_scalarmult_curve25519_base(publicKey, privateKey); ++ if (AddressCalc_addressForPublicKey(ip, publicKey)) { ++ Hex_encode(hexPrivateKey, 65, privateKey, 32); ++ printf(hexPrivateKey); ++ return 0; ++ } ++ } ++ return 0; ++} ++ +diff --git a/node_build/make.js b/node_build/make.js +index 5e51645..11465e3 100644 +--- a/node_build/make.js ++++ b/node_build/make.js +@@ -339,6 +339,7 @@ Builder.configure({ + builder.buildExecutable('contrib/c/privatetopublic.c'); + builder.buildExecutable('contrib/c/sybilsim.c'); + builder.buildExecutable('contrib/c/makekeys.c'); ++ builder.buildExecutable('contrib/c/makekey.c'); + + builder.buildExecutable('crypto/random/randombytes.c'); +