diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 35b8053d8..a379d6b21 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -15,7 +15,7 @@ let urcrypt = import ./urcrypt { inherit libaes_siv; - inherit (pkgs) stdenv openssl gmp; + inherit (pkgs) stdenv pkgconfig openssl gmp; inherit (deps) ed25519 argon2 secp256k1; }; diff --git a/nix/pkgs/urcrypt/default.nix b/nix/pkgs/urcrypt/default.nix index 73aac0e56..5cfd9e45d 100644 --- a/nix/pkgs/urcrypt/default.nix +++ b/nix/pkgs/urcrypt/default.nix @@ -1,4 +1,4 @@ -{ stdenv, openssl, gmp, secp256k1, argon2, scrypt, libaes_siv }: +{ stdenv, pkgconfig, openssl, gmp, secp256k1, argon2, scrypt, libaes_siv }: stdenv.mkDerivation rec { name = "urcrypt"; @@ -6,6 +6,6 @@ stdenv.mkDerivation rec { src = ../../../pkg/urcrypt; buildInputs = [ - openssl gmp secp256k1 argon2 scrypt libaes_siv + pkgconfig openssl gmp secp256k1 argon2 scrypt libaes_siv ]; } diff --git a/nix/pkgs/urcrypt/shell.nix b/nix/pkgs/urcrypt/shell.nix index 00a40f405..dabdaf71c 100644 --- a/nix/pkgs/urcrypt/shell.nix +++ b/nix/pkgs/urcrypt/shell.nix @@ -5,7 +5,7 @@ in import ./default.nix { inherit (pkgs) - stdenv openssl gmp; + stdenv openssl gmp pkgconfig; inherit (deps) libaes_siv argon2 scrypt secp256k1; } diff --git a/pkg/urcrypt/.gitignore b/pkg/urcrypt/.gitignore index 509a0c428..65805b3e6 100644 --- a/pkg/urcrypt/.gitignore +++ b/pkg/urcrypt/.gitignore @@ -1,6 +1,11 @@ build-aux +Makefile Makefile.in aclocal.m4 -config.h.* +autom4te.cache +config.h* +config.status +config.log configure .deps +.dirstamp diff --git a/pkg/urcrypt/Makefile.am b/pkg/urcrypt/Makefile.am index a401e816f..07d819782 100644 --- a/pkg/urcrypt/Makefile.am +++ b/pkg/urcrypt/Makefile.am @@ -2,9 +2,16 @@ ACLOCAL_AMFLAGS = -I build-aux/m4 lib_LTLIBRARIES = liburcrypt.la include_HEADERS = urcrypt.h -noinst_HEADERS = $(ed25519_includes) $(ge_additions_includes) -liburcrypt_la_SOURCES = urcrypt.c $(ed25519_sources) $(ge_additions_sources) -liburcrypt_la_CPPFLAGS = -Ied25519/src -Ige-additions +noinst_HEADERS = $(ed25519_includes) \ + $(ge_additions_includes) \ + $(argon2_includes) +liburcrypt_la_SOURCES = urcrypt.c \ + $(ed25519_sources) \ + $(ge_additions_sources) \ + $(argon2_sources) +liburcrypt_la_CFLAGS = $(SECP256K1_CFLAGS) +liburcrypt_la_CPPFLAGS = -Ied25519/src -Ige-additions -Iargon2/include +liburcrypt_la_LIBADD = -lgmp -laes_siv $(SECP256K1_LIBS) ### ed25519 ed25519_sources = ed25519/src/add_scalar.c ed25519/src/keypair.c \ @@ -20,3 +27,15 @@ ed25519_includes = ed25519/src/fixedint.h ed25519/src/ge.h \ ### ge-additions ge_additions_sources = ge-additions/ge-additions.c ge_additions_includes = ge-additions/ge-additions.h + +### argon2 +argon2_sources = argon2/src/argon2.c argon2/src/core.c \ + argon2/src/blake2/blake2b.c argon2/src/thread.c \ + argon2/src/encoding.c +argon2_includes = argon2/include/argon2.h argon2/src/core.h \ + argon2/src/blake2/blake2.h argon2/src/thread.h \ + argon2/src/encoding.h \ + argon2/src/blake2/blake2-impl.h \ + argon2/src/blake2/blamka-round-opt.h \ + argon2/src/blake2/blamka-round-ref.h + diff --git a/pkg/urcrypt/argon2/meson.build b/pkg/urcrypt/argon2/meson.build deleted file mode 100644 index 22c7ed657..000000000 --- a/pkg/urcrypt/argon2/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('argon2', 'c', version : '1') - -legacy_meson = false - -detect_meson_version = run_command('meson', '--version') -meson_ver = detect_meson_version.stdout() - -if(meson_ver == '0.29.0\n') - legacy_meson = true -elif(not meson.version().version_compare('>=0.40.0')) - error('Meson 0.29.0 is last legacy version supported. Otherwise please upgrade to 0.40.0 or higher.') -endif - -lib_src = ['src/argon2.c', -'src/bench.c', -'src/blake2/blake2b.c', -'src/core.c', -'src/encoding.c', -'src/genkat.c', -'src/opt.c', -'src/ref.c', -'src/run.c', -'src/test.c', -'src/thread.c'] - -inc = include_directories(['./include']) - -lib = static_library('argon2', sources: lib_src, -include_directories: inc, -c_args: ['-Wall', '-Wno-unused-value', '-Wno-unused-function', '-DARGON2_NO_THREADS'], -install: false) - -argon2_dep = declare_dependency(include_directories : inc, link_with : lib) diff --git a/pkg/urcrypt/configure.ac b/pkg/urcrypt/configure.ac index 20b2c09ae..7ce06e022 100644 --- a/pkg/urcrypt/configure.ac +++ b/pkg/urcrypt/configure.ac @@ -11,16 +11,14 @@ AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror]) AM_PROG_AR LT_INIT AC_PROG_CC +AC_CHECK_LIB([gmp], [mpz_init]) AC_CHECK_LIB([aes_siv], [AES_SIV_CTX_new]) +PKG_CHECK_MODULES([SECP256K1], [libsecp256k1]) + ## Checks for libraries. -## FIXME: Replace `main' with a function in `-laes_siv': -## FIXME: Replace `main' with a function in `-largon2': -#AC_CHECK_LIB([argon2], [main]) -## FIXME: Replace `main' with a function in `-led25519': #AC_CHECK_LIB([ed25519], [main]) ## FIXME: Replace `main' with a function in `-lgmp': -#AC_CHECK_LIB([gmp], [main]) ## FIXME: Replace `main' with a function in `-lsecp256k1': #AC_CHECK_LIB([secp256k1], [main]) ## FIXME: Replace `main' with a function in `-lssl':