mid-autoconfiscation of urcrypt

This commit is contained in:
Paul Driver 2020-10-03 15:15:14 -07:00
parent e9f32e749a
commit 5fbd0b2a90
12 changed files with 113 additions and 4 deletions

View File

@ -4,6 +4,7 @@ rec {
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
libaes_siv = import ./libaes_siv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };

View File

@ -0,0 +1,10 @@
source $stdenv/setup
cp -r $src ./src
chmod -R u+w ./src
cd ./src
cmake -DCMAKE_INSTALL_PREFIX=$out . && \
make && \
make test && \
make install

View File

@ -0,0 +1,13 @@
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
name = "libaes_siv-50955";
buildInputs = [ pkgs.cmake pkgs.openssl ];
builder = ./builder.sh;
src = pkgs.fetchFromGitHub {
owner = "frodwith";
repo = "libaes_siv";
rev = "509550e92a416172b9b8255e275f3a04d5fd4545";
sha256 = "11clbvasyyc7ml2x9g5z3il6hs9gzsa10fcnj4grmijzm7gkb3qq";
};
}

View File

@ -1,4 +1,4 @@
{ stdenv, openssl, gmp, ed25519, secp256k1, argon2, libaes_siv }:
{ stdenv, 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 ed25519 secp256k1 argon2 libaes_siv
openssl gmp secp256k1 argon2 scrypt libaes_siv
];
}

View File

@ -0,0 +1,11 @@
let
pkgs = import ../../nixpkgs.nix;
deps = import ../../deps { inherit pkgs; };
in
import ./default.nix {
inherit (pkgs)
stdenv openssl gmp;
inherit (deps)
libaes_siv argon2 scrypt secp256k1;
}

6
pkg/urcrypt/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build-aux
Makefile.in
aclocal.m4
config.h.*
configure
.deps

22
pkg/urcrypt/Makefile.am Normal file
View File

@ -0,0 +1,22 @@
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
### ed25519
ed25519_sources = ed25519/src/add_scalar.c ed25519/src/keypair.c \
ed25519/src/sc.c ed25519/src/seed.c \
ed25519/src/verify.c ed25519/src/ge.c \
ed25519/src/key_exchange.c ed25519/src/sha512.c \
ed25519/src/sign.c
ed25519_includes = ed25519/src/fixedint.h ed25519/src/ge.h \
ed25519/src/sha512.h ed25519/src/ed25519.h \
ed25519/src/fe.h ed25519/src/precomp_data.h \
ed25519/src/sc.h
### ge-additions
ge_additions_sources = ge-additions/ge-additions.c
ge_additions_includes = ge-additions/ge-additions.h

View File

45
pkg/urcrypt/configure.ac Normal file
View File

@ -0,0 +1,45 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([urcrypt], [1.0])
AC_CONFIG_SRCDIR([urcrypt.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
AM_PROG_AR
LT_INIT
AC_PROG_CC
AC_CHECK_LIB([aes_siv], [AES_SIV_CTX_new])
## 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':
#AC_CHECK_LIB([ssl], [main])
# Checks for header files.
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_CHECK_FUNCS([memset])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

1
pkg/urcrypt/shell.nix Normal file
View File

@ -0,0 +1 @@
import ../../nix/pkgs/urcrypt/shell.nix

View File

@ -1,8 +1,8 @@
#include "urcrypt.h"
#include "ge-additions/ge-additions.h"
#include <string.h>
#include <ed25519.h>
#include <ge-additions.h>
#include <openssl/crypto.h>
#include <openssl/ripemd.h>