2022-10-30 15:09:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-10-17 02:12:59 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, openssl
|
2022-10-30 15:09:59 +00:00
|
|
|
, nix
|
2021-10-17 02:12:59 +00:00
|
|
|
}:
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-03-09 03:18:52 +00:00
|
|
|
pname = "s2n-tls";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.5.1";
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-03-09 03:18:52 +00:00
|
|
|
owner = "aws";
|
2024-07-31 10:19:44 +00:00
|
|
|
repo = "s2n-tls";
|
2021-01-09 10:05:03 +00:00
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-BHDMYOHidwF6ssqSnpokXc/OwGrQNoUVb0/ubwhyiDM=";
|
2021-01-09 10:05:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2021-06-04 09:07:49 +00:00
|
|
|
|
|
|
|
buildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2021-08-22 07:53:02 +00:00
|
|
|
"-DUNSAFE_TREAT_WARNINGS_AS_ERRORS=OFF" # disable -Werror
|
2022-04-15 01:41:22 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isMips64 [
|
|
|
|
# See https://github.com/aws/s2n-tls/issues/1592 and https://github.com/aws/s2n-tls/pull/1609
|
|
|
|
"-DS2N_NO_PQ=ON"
|
2021-01-09 10:05:03 +00:00
|
|
|
];
|
|
|
|
|
2021-06-04 09:07:49 +00:00
|
|
|
propagatedBuildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
|
|
|
|
|
|
|
|
postInstall = ''
|
2021-10-17 02:12:59 +00:00
|
|
|
# Glob for 'shared' or 'static' subdir
|
|
|
|
for f in $out/lib/s2n/cmake/*/s2n-targets.cmake; do
|
|
|
|
substituteInPlace "$f" \
|
|
|
|
--replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES ""'
|
|
|
|
done
|
2021-06-04 09:07:49 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit nix;
|
|
|
|
};
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "C99 implementation of the TLS/SSL protocols";
|
2021-03-09 03:18:52 +00:00
|
|
|
homepage = "https://github.com/aws/s2n-tls";
|
2021-01-09 10:05:03 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ orivej ];
|
|
|
|
};
|
|
|
|
}
|