mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
commit
d112a13a86
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -132,7 +132,7 @@ jobs:
|
||||
# echo suppresses pacman prompt
|
||||
- run: echo|./configure
|
||||
env:
|
||||
CACHIX_CACHE: locpyl-tidnyd-test1
|
||||
CACHIX_CACHE: ares
|
||||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- run: make build/urbit build/urbit-worker
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -56,6 +56,9 @@ out/
|
||||
work/
|
||||
pkg/*/*.a
|
||||
*.o
|
||||
*.so
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Landscape Dev
|
||||
urbitrc
|
||||
|
10
default.nix
10
default.nix
@ -85,20 +85,12 @@ let
|
||||
# Local vendored packages defined in ./pkg.
|
||||
# For non-vendored nixpkgs specific package overrides, see ./nix/overlays.
|
||||
pkgsLocal = {
|
||||
argon2u = callPackage ./nix/pkgs/argon2u { };
|
||||
|
||||
ca-bundle = callPackage ./nix/pkgs/ca-bundle { };
|
||||
|
||||
ed25519 = callPackage ./nix/pkgs/ed25519 { };
|
||||
|
||||
ent = callPackage ./nix/pkgs/ent { };
|
||||
|
||||
ge-additions = callPackage ./nix/pkgs/ge-additions { };
|
||||
|
||||
libaes_siv = callPackage ./nix/pkgs/libaes_siv { inherit (pkgsNative) cmake; };
|
||||
|
||||
libscrypt = callPackage ./nix/pkgs/libscrypt { };
|
||||
|
||||
murmur3 = callPackage ./nix/pkgs/murmur3 { };
|
||||
|
||||
softfloat3 = callPackage ./nix/pkgs/softfloat3 { };
|
||||
@ -115,7 +107,7 @@ let
|
||||
|
||||
urbit = callPackage ./nix/pkgs/urbit { inherit enableStatic; };
|
||||
|
||||
urcrypt = callPackage ./nix/pkgs/urcrypt { };
|
||||
urcrypt = callPackage ./nix/pkgs/urcrypt { inherit enableStatic; };
|
||||
|
||||
docker-image = callPackage ./nix/pkgs/docker-image { };
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
{ stdenv, sources, enableParallelBuilding ? true }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "argon2u";
|
||||
version = sources.argon2u.rev;
|
||||
src = sources.argon2u;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile --replace 'ar rcs' '$(AR) rcs'
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
make libargon2.a
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{lib,include}
|
||||
cp libargon2.a $out/lib/
|
||||
cp include/argon2.h $out/include/
|
||||
cp ./src/blake2/*.h $out/include/
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"AR=${stdenv.cc.targetPrefix}ar" # Fix cross-compilation
|
||||
];
|
||||
|
||||
NO_THREADS = true;
|
||||
|
||||
inherit enableParallelBuilding;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{ stdenv, sources }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "ed25519";
|
||||
version = sources.ed25519.rev;
|
||||
src = sources.ed25519;
|
||||
|
||||
buildPhase = ''
|
||||
CFLAGS="-O3 -Wall -I$src/src"
|
||||
|
||||
for f in $(find src -type f -name '*.c'); do
|
||||
$CC $CFLAGS -c $f -o "''${f//\//_}.o"
|
||||
done
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{lib,include}
|
||||
$AR rcs $out/lib/libed25519.a *.o
|
||||
cp $src/src/*.h $out/include/
|
||||
'';
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
{ stdenv, sources }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libscrypt";
|
||||
version = sources.libscrypt.rev;
|
||||
src = sources.libscrypt;
|
||||
|
||||
buildPhase = ''
|
||||
sources=" \
|
||||
crypto_scrypt-check \
|
||||
crypto_scrypt-hash \
|
||||
crypto_scrypt-hexconvert \
|
||||
crypto_scrypt-nosse \
|
||||
crypto-mcf \
|
||||
crypto-scrypt-saltgen \
|
||||
slowequals \
|
||||
sha256 \
|
||||
b64 \
|
||||
"
|
||||
|
||||
CFLAGS="-I$src -Wall -ffast-math -O3 -D_FORTIFY_SOURCE=2 -fstack-protector"
|
||||
|
||||
for s in $sources; do
|
||||
$CC $CFLAGS -c $src/$s.c -o $s.o
|
||||
done
|
||||
|
||||
$AR rcs libscrypt.a *.o
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{lib,include}
|
||||
cp libscrypt.a $out/lib
|
||||
cp $src/*.h $out/include/
|
||||
'';
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
{ lib, stdenv, coreutils, pkgconfig, argon2u, cacert, ca-bundle, curlMinimal
|
||||
, ed25519, ent, urcrypt, gmp, h2o, herb, ivory, libaes_siv, libscrypt
|
||||
, libsigsegv, libuv, lmdb, murmur3, openssl, secp256k1, softfloat3, zlib
|
||||
, enableStatic ? stdenv.hostPlatform.isStatic, enableDebug ? false
|
||||
, doCheck ? true, enableParallelBuilding ? true, dontStrip ? true }:
|
||||
{ lib, stdenv, coreutils, pkgconfig # build/env
|
||||
, cacert, ca-bundle, ivory # codegen
|
||||
, curlMinimal, ent, gmp, h2o, libsigsegv, libuv, lmdb # libs
|
||||
, murmur3, openssl, softfloat3, urcrypt, zlib #
|
||||
, enableStatic ? stdenv.hostPlatform.isStatic # opts
|
||||
, enableDebug ? false
|
||||
, doCheck ? true
|
||||
, enableParallelBuilding ? true
|
||||
, dontStrip ? true }:
|
||||
|
||||
let
|
||||
|
||||
@ -19,30 +23,23 @@ in stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = [
|
||||
argon2u
|
||||
cacert
|
||||
ca-bundle
|
||||
curlMinimal
|
||||
ed25519
|
||||
ent
|
||||
urcrypt
|
||||
gmp
|
||||
h2o
|
||||
ivory.header
|
||||
libaes_siv
|
||||
libscrypt
|
||||
libsigsegv
|
||||
libuv
|
||||
lmdb
|
||||
murmur3
|
||||
openssl
|
||||
secp256k1
|
||||
softfloat3
|
||||
urcrypt
|
||||
zlib
|
||||
];
|
||||
|
||||
checkInputs = [ herb ];
|
||||
|
||||
# Ensure any `/usr/bin/env bash` shebang is patched.
|
||||
postPatch = ''
|
||||
patchShebangs ./configure
|
||||
@ -56,9 +53,14 @@ in stdenv.mkDerivation {
|
||||
cp ./build/urbit-worker $out/bin/urbit-worker
|
||||
'';
|
||||
|
||||
dontDisableStatic = enableStatic;
|
||||
|
||||
configureFlags = if enableStatic
|
||||
then [ "--disable-shared" "--enable-static" ]
|
||||
else [];
|
||||
|
||||
CFLAGS = [ (if enableDebug then "-O0" else "-O3") "-g" ]
|
||||
++ lib.optionals (!enableDebug) [ "-Werror" ]
|
||||
++ lib.optionals enableStatic [ "-static" ];
|
||||
++ lib.optionals (!enableDebug) [ "-Werror" ];
|
||||
|
||||
MEMORY_DEBUG = enableDebug;
|
||||
CPU_DEBUG = enableDebug;
|
||||
|
@ -1,12 +1,21 @@
|
||||
{ stdenv, autoreconfHook, pkgconfig, openssl, gmp, secp256k1, scrypt, libaes_siv }:
|
||||
{ stdenv, autoreconfHook, pkgconfig
|
||||
, libaes_siv, openssl, secp256k1
|
||||
, enableStatic ? stdenv.hostPlatform.isStatic }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "urcrypt";
|
||||
src = ../../../pkg/urcrypt;
|
||||
|
||||
# XX why are these required for darwin?
|
||||
dontDisableStatic = enableStatic;
|
||||
|
||||
configureFlags = if enableStatic
|
||||
then [ "--disable-shared" "--enable-static" ]
|
||||
else [];
|
||||
|
||||
nativeBuildInputs =
|
||||
[ autoreconfHook pkgconfig ];
|
||||
|
||||
buildInputs =
|
||||
[ openssl gmp secp256k1 scrypt libaes_siv ];
|
||||
propagatedBuildInputs =
|
||||
[ openssl secp256k1 libaes_siv ];
|
||||
}
|
||||
|
@ -56,9 +56,10 @@
|
||||
"prepare": "./configure"
|
||||
}
|
||||
},
|
||||
"ge-additions": {
|
||||
"urcrypt": {
|
||||
"pmnsh": {
|
||||
"make": "CFLAGS=-I../ed25519"
|
||||
"prepare": "./autogen.sh && ./configure --disable-shared PKG_CONFIG_PATH=../secp256k1 CFLAGS=\"-I../secp256k1/include -I../libaes_siv\" LDFLAGS=-L../libaes_siv",
|
||||
"make": "install"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,4 @@
|
||||
{
|
||||
"argon2u": {
|
||||
"branch": "master",
|
||||
"description": "With argon2u. Based off https://github.com/P-H-C/phc-winner-argon2",
|
||||
"homepage": "",
|
||||
"pmnsh": {
|
||||
"include": ["include", "src/blake2"],
|
||||
"make": "libargon2.a"
|
||||
},
|
||||
"owner": "urbit",
|
||||
"repo": "argon2",
|
||||
"rev": "a4c1e3f7138c2e577376beb99f964cf71e1c8b1b",
|
||||
"sha256": "1j8a15fx2kn5aa3scmb5qnsfk627kfvsq5ppz9j0pv2d1xck527x",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/urbit/argon2/archive/a4c1e3f7138c2e577376beb99f964cf71e1c8b1b.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"ed25519": {
|
||||
"branch": "master",
|
||||
"description": "Submodule included by Urbit",
|
||||
"homepage": null,
|
||||
"pmnsh": {
|
||||
"strip": 1,
|
||||
"make": "all"
|
||||
},
|
||||
"owner": "urbit",
|
||||
"repo": "ed25519",
|
||||
"rev": "76385f2ebbbc9580a9c236952d68d11d73a6135c",
|
||||
"sha256": "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/urbit/ed25519/archive/76385f2ebbbc9580a9c236952d68d11d73a6135c.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"h2o": {
|
||||
"branch": "master",
|
||||
"description": "H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server",
|
||||
@ -41,7 +9,7 @@
|
||||
"make": "libh2o",
|
||||
"compat": {
|
||||
"mingw": {
|
||||
"prepare": "cmake -G\"MSYS Makefiles\" ."
|
||||
"prepare": "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=. ."
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -89,7 +57,7 @@
|
||||
},
|
||||
"mingw": {
|
||||
"prepare": "cmake -G\"MSYS Makefiles\" -DDISABLE_DOCS:BOOL=ON .",
|
||||
"make": "install"
|
||||
"make": "aes_siv_static"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -101,21 +69,6 @@
|
||||
"url": "https://github.com/dfoxfranke/libaes_siv/archive/9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"libscrypt": {
|
||||
"branch": "master",
|
||||
"description": null,
|
||||
"homepage": null,
|
||||
"pmnsh": {
|
||||
"make": "libscrypt.a CFLAGS_EXTRA=-ffast-math"
|
||||
},
|
||||
"owner": "urbit",
|
||||
"repo": "libscrypt",
|
||||
"rev": "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2",
|
||||
"sha256": "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/urbit/libscrypt/archive/029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"murmur3": {
|
||||
"branch": "master",
|
||||
"description": null,
|
||||
|
@ -21,9 +21,7 @@
|
||||
!> `@ux`(hsh pw salt n r p 64)
|
||||
::
|
||||
++ vectors
|
||||
:: TODO: until scrypt has been jetted, we can only test the
|
||||
:: first vector; the others do not finish in a reasonable
|
||||
:: amount of time.
|
||||
^- (list vector)
|
||||
:~
|
||||
:*
|
||||
0x0
|
||||
|
@ -1,8 +0,0 @@
|
||||
let
|
||||
|
||||
pkgs = import ../../default.nix { };
|
||||
|
||||
in pkgs.shellFor {
|
||||
name = "ge-additions";
|
||||
packages = ps: [ ps.ge-additions ];
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/Makefile
|
||||
@@ -0,0 +1,8 @@
|
||||
+.PHONY: all clean
|
||||
+
|
||||
+all: *.c *.h
|
||||
+ $(CC) -c -O3 -Wall -Werror *.c
|
||||
+ $(AR) rcs libed25519.a *.o
|
||||
+
|
||||
+clean:
|
||||
+ rm -f *.o *.a
|
@ -1,17 +0,0 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 783c537..3156ee2 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -12,10 +12,9 @@ LDFLAGS_EXTRA?=-Wl,-z,relro
|
||||
|
||||
all: reference
|
||||
|
||||
-OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o slowequals.o
|
||||
+OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o slowequals.o
|
||||
|
||||
-libscrypt.so.0: $(OBJS)
|
||||
- $(CC) $(LDFLAGS) -shared -o libscrypt.so.0 $(OBJS) -lm -lc
|
||||
+libscrypt.a: $(OBJS)
|
||||
ar rcs libscrypt.a $(OBJS)
|
||||
|
||||
reference: libscrypt.so.0 main.o crypto_scrypt-hexconvert.o
|
@ -7,6 +7,8 @@ LDFLAGS := $(LDFLAGS) -lzstd -lcrypt32
|
||||
CFLAGS := $(CFLAGS) -DH2O_NO_UNIX_SOCKETS
|
||||
# libuv
|
||||
LDFLAGS := $(LDFLAGS) -luserenv -liphlpapi -lpsapi
|
||||
# secp256k1, due to _FORTIFY_SOURCE
|
||||
LDFLAGS := $(LDFLAGS) -lssp
|
||||
|
||||
ifdef debug
|
||||
CFLAGS := $(CFLAGS) -O0 -g
|
||||
|
@ -1,13 +0,0 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/Makefile
|
||||
@@ -0,0 +1,8 @@
|
||||
+.PHONY: all clean
|
||||
+
|
||||
+all: *.c *.h
|
||||
+ $(CC) -c -O3 -Wall -Werror *.c
|
||||
+ $(AR) rcs libed25519.a *.o
|
||||
+
|
||||
+clean:
|
||||
+ rm -f *.o *.a
|
@ -1,17 +0,0 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 783c537..3156ee2 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -12,10 +12,9 @@ LDFLAGS_EXTRA?=-Wl,-z,relro
|
||||
|
||||
all: reference
|
||||
|
||||
-OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o slowequals.o
|
||||
+OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o slowequals.o
|
||||
|
||||
-libscrypt.so.0: $(OBJS)
|
||||
- $(CC) $(LDFLAGS) -shared -o libscrypt.so.0 $(OBJS) -lm -lc
|
||||
+libscrypt.a: $(OBJS)
|
||||
ar rcs libscrypt.a $(OBJS)
|
||||
|
||||
reference: libscrypt.so.0 main.o crypto_scrypt-hexconvert.o
|
@ -1,5 +1,6 @@
|
||||
declare -a cdirs
|
||||
declare -a ldirs
|
||||
declare -a pdirs
|
||||
declare -A hdeps
|
||||
sources=(../../nix/sources.json ../../nix/sources-pmnsh.json)
|
||||
patches=compat/$1
|
||||
@ -141,8 +142,11 @@ strip=\($o.strip+1) \\
|
||||
cmdprep=\($o.prepare//""'"$depdirs"'|@sh) \\
|
||||
cmdmake=\($o.make//""'"$depdirs"'|@sh) \\
|
||||
buildnixdep # sets dir
|
||||
pdirs+=($dir) # XX support json override a la cdirs/pdirs
|
||||
\($o.include//"."|if type == "array" then . else [.] end|map("cdirs+=(-I$dir/\(.))")|join("\n"))
|
||||
\($o.lib//"."|if type == "array" then . else [.] end|map("ldirs+=(-L$dir/\(.))")|join("\n"))"' ${sources[@]})
|
||||
|
||||
CFLAGS="${CFLAGS-} ${cdirs[@]}"
|
||||
LDFLAGS="${LDFLAGS-} ${ldirs[@]}"
|
||||
|
||||
PKG_CONFIG_PATH="$(IFS=:;echo "${pdirs[*]}"):${PKG_CONFIG_PATH-}"
|
||||
|
71
pkg/urbit/configure
vendored
71
pkg/urbit/configure
vendored
@ -4,13 +4,29 @@ set -euo pipefail
|
||||
|
||||
URBIT_VERSION="$(cat ./version)"
|
||||
|
||||
deps=" \
|
||||
urcrypt curl gmp sigsegv ent h2o uv murmur3 \
|
||||
softfloat3 crypto ssl z lmdb pthread \
|
||||
# we require pkg-config metadata to statically link these
|
||||
#
|
||||
pkgc_deps=" \
|
||||
libcurl \
|
||||
libh2o \
|
||||
liburcrypt-0 \
|
||||
libuv \
|
||||
openssl \
|
||||
"
|
||||
|
||||
headers=" \
|
||||
ivory.h ca-bundle.h \
|
||||
deps=" \
|
||||
ent \
|
||||
gmp \
|
||||
lmdb \
|
||||
murmur3 \
|
||||
pthread \
|
||||
sigsegv \
|
||||
softfloat3 \
|
||||
"
|
||||
|
||||
headers=" \
|
||||
ca-bundle.h \
|
||||
ivory.h \
|
||||
"
|
||||
|
||||
echo '#pragma once' >include/config.h
|
||||
@ -22,6 +38,7 @@ defmacro () {
|
||||
defmacro URBIT_VERSION "\"$URBIT_VERSION\""
|
||||
|
||||
opt_debug=
|
||||
opt_static=
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
@ -32,6 +49,18 @@ do
|
||||
--disable-debug)
|
||||
opt_debug=
|
||||
;;
|
||||
--enable-static)
|
||||
opt_static=1
|
||||
;;
|
||||
--enable-shared)
|
||||
opt_static=
|
||||
;;
|
||||
--disable-static)
|
||||
opt_static=
|
||||
;;
|
||||
--disable-shared)
|
||||
opt_static=1
|
||||
;;
|
||||
*)
|
||||
echo "unrecognized option: $1"
|
||||
;;
|
||||
@ -77,6 +106,10 @@ esac
|
||||
# TODO Determine if the target cpu is little or big endian.
|
||||
case $(tr A-Z a-z <<< $os) in
|
||||
*mingw*)
|
||||
# mingw builds are static-only
|
||||
#
|
||||
opt_static=1
|
||||
|
||||
# ensure required mingw packages are installed
|
||||
mpkgs=(cmake curl gcc jq make)
|
||||
pacman -S --needed autoconf automake-wrapper libtool patch ${mpkgs[@]/#/mingw-w64-x86_64-}
|
||||
@ -88,7 +121,6 @@ case $(tr A-Z a-z <<< $os) in
|
||||
|
||||
deps="${deps/sigsegv}"
|
||||
compat="${compat-} mingw"
|
||||
PKG_CONFIG=false
|
||||
;;
|
||||
m1brew)
|
||||
# ensure required packages are installed
|
||||
@ -108,8 +140,6 @@ case $(tr A-Z a-z <<< $os) in
|
||||
|
||||
defmacro U3_OS_osx 1
|
||||
|
||||
deps="${deps/ssl/openssl}"
|
||||
deps="${deps/uv/libuv}"
|
||||
compat="${compat-} posix m1brew"
|
||||
;;
|
||||
*linux*)
|
||||
@ -126,7 +156,7 @@ case $(tr A-Z a-z <<< $os) in
|
||||
;;
|
||||
*freebsd*)
|
||||
defmacro U3_OS_bsd 1
|
||||
extra_libs="${extra_libs} kvm"
|
||||
deps="$deps kvm" # XX use new compat.mk pattern
|
||||
;;
|
||||
*openbsd*)
|
||||
defmacro U3_OS_bsd 1
|
||||
@ -137,10 +167,22 @@ case $(tr A-Z a-z <<< $os) in
|
||||
;;
|
||||
esac
|
||||
|
||||
for dep in ${osdeps-} $deps
|
||||
do
|
||||
LDFLAGS="${LDFLAGS-} $(${PKG_CONFIG-pkg-config} --libs $dep 2>/dev/null || echo -l$dep)"
|
||||
CFLAGS="${CFLAGS-} $(${PKG_CONFIG-pkg-config} --cflags $dep 2>/dev/null || true)"
|
||||
PKG_CONFIG="${PKG_CONFIG-pkg-config}"
|
||||
|
||||
if [ -n "${opt_static-}" ]
|
||||
then
|
||||
CFLAGS="${CFLAGS-} -static"
|
||||
# XX can't set -static here due libuv's -ldl on MacOS
|
||||
#
|
||||
# LDFLAGS="${LDFLAGS-} -static"
|
||||
PKG_CONFIG="$PKG_CONFIG --static"
|
||||
fi
|
||||
|
||||
CFLAGS="${CFLAGS-} $($PKG_CONFIG --cflags $pkgc_deps)"
|
||||
LDFLAGS="${LDFLAGS-} $($PKG_CONFIG --libs $pkgc_deps)"
|
||||
|
||||
for dep in $deps; do
|
||||
LDFLAGS="${LDFLAGS-} -l$dep"
|
||||
done
|
||||
|
||||
for header in $headers; do
|
||||
@ -148,8 +190,7 @@ for header in $headers; do
|
||||
done
|
||||
|
||||
compat="${compat-posix}"
|
||||
for citem in $compat
|
||||
do
|
||||
for citem in $compat; do
|
||||
CFLAGS="${CFLAGS-} -Icompat/$citem"
|
||||
done
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <openssl/ssl.h>
|
||||
#include <h2o.h>
|
||||
#include <curl/curl.h>
|
||||
#include <argon2.h>
|
||||
#include <vere/db/lmdb.h>
|
||||
|
||||
#include "ca-bundle.h"
|
||||
@ -533,7 +532,6 @@ report(void)
|
||||
LIBCURL_VERSION_MAJOR,
|
||||
LIBCURL_VERSION_MINOR,
|
||||
LIBCURL_VERSION_PATCH);
|
||||
printf("argon2: 0x%x\n", ARGON2_VERSION_NUMBER);
|
||||
}
|
||||
|
||||
/* _stop_exit(): exit immediately.
|
||||
|
@ -3,40 +3,33 @@
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
u3_noun
|
||||
u3qc_bex(u3_atom a)
|
||||
{
|
||||
mpz_t a_mp;
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qc_bex(u3_atom a)
|
||||
{
|
||||
mpz_t a_mp;
|
||||
|
||||
if ( !_(u3a_is_cat(a)) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
mpz_init_set_ui(a_mp, 1);
|
||||
mpz_mul_2exp(a_mp, a_mp, a);
|
||||
|
||||
return u3i_mp(a_mp);
|
||||
}
|
||||
if ( !_(u3a_is_cat(a)) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
u3_noun
|
||||
u3kc_bex(u3_atom a)
|
||||
{
|
||||
return u3qc_bex(u3k(a));
|
||||
}
|
||||
u3_noun
|
||||
u3wc_bex(u3_noun cor)
|
||||
{
|
||||
u3_noun a;
|
||||
else {
|
||||
mpz_init_set_ui(a_mp, 1);
|
||||
mpz_mul_2exp(a_mp, a_mp, a);
|
||||
|
||||
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
|
||||
(c3n == u3ud(a)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
return u3qc_bex(a);
|
||||
}
|
||||
return u3i_mp(a_mp);
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3kc_bex(u3_atom a)
|
||||
{
|
||||
u3_noun b = u3qc_bex(a);
|
||||
u3z(a);
|
||||
return b;
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3wc_bex(u3_noun cor)
|
||||
{
|
||||
u3_noun a = u3x_at(u3x_sam, cor);
|
||||
return u3qc_bex(u3x_atom(a));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@
|
||||
u3_noun p, pl, s, sl, n, r, z, d;
|
||||
u3_noun q;
|
||||
|
||||
u3x_quil(u3r_at(u3x_sam, cor), &p, &pl, &s, &sl, &q);
|
||||
u3x_quil(u3x_at(u3x_sam, cor), &p, &pl, &s, &sl, &q);
|
||||
u3x_qual(q, &n, &r, &z, &d);
|
||||
|
||||
if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(pl)) &&
|
||||
@ -125,7 +125,7 @@
|
||||
u3_noun p, s, n, r, z, d;
|
||||
u3_noun q;
|
||||
|
||||
u3x_quil(u3r_at(u3x_sam, cor), &p, &s, &n, &r, &q);
|
||||
u3x_quil(u3x_at(u3x_sam, cor), &p, &s, &n, &r, &q);
|
||||
u3x_cell(q, &z, &d);
|
||||
|
||||
if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) &&
|
||||
@ -189,7 +189,7 @@
|
||||
u3_noun p, pl, s, sl, c, d;
|
||||
u3_noun q;
|
||||
|
||||
u3x_quil(u3r_at(u3x_sam, cor), &p, &pl, &s, &sl, &q);
|
||||
u3x_quil(u3x_at(u3x_sam, cor), &p, &pl, &s, &sl, &q);
|
||||
u3x_cell(q, &c, &d);
|
||||
|
||||
if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) &&
|
||||
@ -215,7 +215,7 @@
|
||||
{
|
||||
u3_noun p, s, c, d;
|
||||
|
||||
u3x_qual(u3r_at(u3x_sam, cor), &p, &s, &c, &d);
|
||||
u3x_qual(u3x_at(u3x_sam, cor), &p, &s, &c, &d);
|
||||
|
||||
if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) &&
|
||||
_(u3a_is_atom(c)) && _(u3a_is_atom(d))) ) {
|
||||
|
@ -8,20 +8,22 @@
|
||||
static urcrypt_secp_context* sec_u;
|
||||
|
||||
/* call at process start */
|
||||
void u3e_secp_init()
|
||||
void
|
||||
u3je_secp_init()
|
||||
{
|
||||
c3_y ent_y[32];
|
||||
ent_getentropy(ent_y, 32);
|
||||
sec_u = malloc(urcrypt_secp_prealloc_size());
|
||||
|
||||
if ( 0 != urcrypt_secp_init(sec_u, ent_y) ) {
|
||||
u3l_log("%s\r\n", "u3e_secp_init failed");
|
||||
u3l_log("u3e_secp_init failed\r\n");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/* call at process end */
|
||||
void u3e_secp_stop()
|
||||
void
|
||||
u3je_secp_stop()
|
||||
{
|
||||
urcrypt_secp_destroy(sec_u);
|
||||
free(sec_u);
|
||||
@ -58,7 +60,7 @@ _cqes_in_order(u3_atom a)
|
||||
else {
|
||||
c3_y i_y;
|
||||
c3_w *buf_w = a_u->buf_w;
|
||||
// loop from most to least significant bytes
|
||||
// loop from most to least significant words
|
||||
for ( i_y = 8; i_y > 0; ) {
|
||||
c3_w b_w = buf_w[i_y],
|
||||
o_w = now_w[--i_y];
|
||||
|
@ -1678,8 +1678,8 @@ _cm_signals(void)
|
||||
# endif
|
||||
}
|
||||
|
||||
extern void u3e_secp_init(void);
|
||||
extern void u3e_secp_stop(void);
|
||||
extern void u3je_secp_init(void);
|
||||
extern void u3je_secp_stop(void);
|
||||
|
||||
static void
|
||||
_cm_crypto()
|
||||
@ -1692,7 +1692,7 @@ _cm_crypto()
|
||||
abort();
|
||||
}
|
||||
|
||||
u3e_secp_init();
|
||||
u3je_secp_init();
|
||||
}
|
||||
|
||||
/* u3m_init(): start the environment.
|
||||
@ -1745,7 +1745,7 @@ u3m_init(void)
|
||||
void
|
||||
u3m_stop()
|
||||
{
|
||||
u3e_secp_stop();
|
||||
u3je_secp_stop();
|
||||
}
|
||||
|
||||
/* u3m_boot(): start the u3 system. return next event, starting from 1.
|
||||
|
56
pkg/urcrypt/.gitignore
vendored
Normal file
56
pkg/urcrypt/.gitignore
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
*.pc
|
||||
config.h
|
||||
config.status
|
||||
libtool
|
||||
|
||||
# the following was adapted from
|
||||
# https://github.com/github/gitignore/blob/991e760c1c6d50fdda246e0178b9c58b06770b90/Autotools.gitignore
|
||||
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
build-aux/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
.deps/
|
||||
.dirstamp
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
build-aux/compile
|
||||
/config.cache
|
||||
build-aux/config.guess
|
||||
/config.h.in
|
||||
build-aux/config.log
|
||||
build-aux/config.status
|
||||
build-aux/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
build-aux/depcomp
|
||||
build-aux/install-sh
|
||||
build-aux/missing
|
||||
/stamp-h1
|
||||
|
||||
# https://www.gnu.org/software/libtool/
|
||||
|
||||
build-aux/ltmain.sh
|
||||
|
||||
# http://www.gnu.org/software/m4/
|
||||
|
||||
build-aux/m4/libtool.m4
|
||||
build-aux/m4/ltoptions.m4
|
||||
build-aux/m4/ltsugar.m4
|
||||
build-aux/m4/ltversion.m4
|
||||
build-aux/m4/lt~obsolete.m4
|
||||
|
||||
# Generated Makefile
|
||||
# (meta build system like autotools,
|
||||
# can automatically generate from config.status script
|
||||
# (which is called by configure script))
|
||||
Makefile
|
@ -73,7 +73,7 @@ AS_IF([test "$enable_shared" == "yes"],
|
||||
AC_CHECK_TOOL([NM], [nm])
|
||||
AC_MSG_CHECKING([for shared libcrypto])
|
||||
AS_IF(
|
||||
[$NM conftest$EXEEXT | $GREP 'U SHA256' 2>&1 >/dev/null],
|
||||
[$NM conftest$EXEEXT | $GREP 'U .*SHA256' 2>&1 >/dev/null],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_ERROR([cannot find shared object for libcrypto.])])],
|
||||
[AC_MSG_ERROR([unable to link libcrypto.])])
|
||||
@ -83,7 +83,8 @@ AS_IF([test "$enable_shared" == "yes"],
|
||||
# Checks for non pkg-config libraries
|
||||
AC_CHECK_LIB([aes_siv], [AES_SIV_CTX_new],
|
||||
[AC_SUBST([LIBAES_SIV_LIBS], "-laes_siv")],
|
||||
[AC_MSG_ERROR([libaes_siv is required.])])
|
||||
[AC_MSG_ERROR([libaes_siv is required.])],
|
||||
[-lcrypto])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h])
|
||||
|
@ -23,7 +23,7 @@ let
|
||||
#
|
||||
# Typically the inputs listed here also have a shell.nix in their respective
|
||||
# source directory you can use, to avoid the Haskell/GHC dependencies.
|
||||
inputsFrom = with pkgsLocal; [ ent ge-additions herb libaes_siv urbit ];
|
||||
inputsFrom = with pkgsLocal; [ ent herb urbit urcrypt ];
|
||||
|
||||
# Collect the named attribute from all dependencies listed in inputsFrom.
|
||||
mergeFrom = name: pkgs.lib.concatLists (pkgs.lib.catAttrs name inputsFrom);
|
||||
|
Loading…
Reference in New Issue
Block a user