2021-05-20 23:08:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, libtool, libtommath }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libtomcrypt";
|
|
|
|
version = "1.18.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/libtom/libtomcrypt/releases/download/v${version}/crypt-${version}.tar.xz";
|
|
|
|
sha256 = "113vfrgapyv72lalhd3nkw7jnks8az0gcb5wqn9hj19nhcxlrbcn";
|
|
|
|
};
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
# Fixes a build failure on aarch64-darwin. Define for all Darwin targets for when x86_64-darwin
|
|
|
|
# upgrades to a newer SDK.
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optional stdenv.isDarwin "-DTARGET_OS_IPHONE=0";
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "CVE-2019-17362.patch";
|
|
|
|
url = "https://github.com/libtom/libtomcrypt/pull/508/commits/25c26a3b7a9ad8192ccc923e15cf62bf0108ef94.patch";
|
|
|
|
sha256 = "1bwsj0pwffxw648wd713z3xcyrbxc2z646psrzp38ys564fjh5zf";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [ libtool libtommath ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2022-12-17 10:02:37 +00:00
|
|
|
substituteInPlace makefile.shared --replace "LIBTOOL:=glibtool" "LIBTOOL:=libtool"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
makeFlagsArray+=(PREFIX=$out \
|
|
|
|
CFLAGS="-DUSE_LTM -DLTM_DESC -DLTC_PTHREAD" \
|
|
|
|
EXTRALIBS=\"-ltommath\" \
|
2020-04-24 23:36:52 +00:00
|
|
|
INSTALL_GROUP=$(id -g) \
|
|
|
|
INSTALL_USER=$(id -u))
|
|
|
|
'';
|
|
|
|
|
|
|
|
makefile = "makefile.shared";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A fairly comprehensive, modular and portable cryptographic toolkit";
|
2022-12-17 10:02:37 +00:00
|
|
|
homepage = "https://www.libtom.net/LibTomCrypt/";
|
|
|
|
changelog = "https://github.com/libtom/libtomcrypt/raw/v${version}/changes";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = with licenses; [ publicDomain wtfpl ];
|
2022-12-17 10:02:37 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|