2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2018-06-28 20:25:19 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, perl # Project uses Perl for scripting and testing
|
2021-03-26 09:51:06 +00:00
|
|
|
, python3
|
2018-06-28 20:25:19 +00:00
|
|
|
|
|
|
|
, enableThreading ? true # Threading can be disabled to increase security https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
|
|
|
|
}:
|
2015-04-06 21:41:54 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mbedtls";
|
2021-04-19 01:02:35 +00:00
|
|
|
# Auto updates are disabled due to repology listing dev releases as release
|
|
|
|
# versions. See
|
|
|
|
# * https://github.com/NixOS/nixpkgs/pull/119838#issuecomment-822100428
|
|
|
|
# * https://github.com/NixOS/nixpkgs/commit/0ee02a9d42b5fe1825b0f7cee7a9986bb4ba975d
|
2021-04-18 23:52:18 +00:00
|
|
|
version = "2.26.0"; # nixpkgs-update: no auto update
|
2015-04-06 21:41:54 +00:00
|
|
|
|
2018-01-28 01:10:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ARMmbed";
|
|
|
|
repo = "mbedtls";
|
2019-08-15 12:41:18 +00:00
|
|
|
rev = "${pname}-${version}";
|
2021-04-18 23:52:18 +00:00
|
|
|
sha256 = "0scwpmrgvg6q7rvqkc352d2fqlsx0aylcbyibcp1f1rsn8iiif2m";
|
2015-04-06 21:41:54 +00:00
|
|
|
};
|
|
|
|
|
2021-03-26 09:51:06 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja perl python3 ];
|
|
|
|
|
|
|
|
strictDeps = true;
|
2016-12-10 16:29:50 +00:00
|
|
|
|
2021-08-18 00:14:20 +00:00
|
|
|
postConfigure = lib.optionalString enableThreading ''
|
2018-06-28 20:25:19 +00:00
|
|
|
perl scripts/config.pl set MBEDTLS_THREADING_C # Threading abstraction layer
|
|
|
|
perl scripts/config.pl set MBEDTLS_THREADING_PTHREAD # POSIX thread wrapper layer for the threading layer.
|
2016-12-10 16:29:50 +00:00
|
|
|
'';
|
|
|
|
|
2018-06-28 20:25:19 +00:00
|
|
|
cmakeFlags = [ "-DUSE_SHARED_MBEDTLS_LIBRARY=on" ];
|
2021-04-20 05:59:50 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
|
2021-04-18 23:52:18 +00:00
|
|
|
"-Wno-error=format"
|
|
|
|
"-Wno-error=format-truncation"
|
|
|
|
];
|
2015-04-06 21:41:54 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://tls.mbed.org/";
|
2018-06-28 20:25:19 +00:00
|
|
|
description = "Portable cryptographic and TLS library, formerly known as PolarSSL";
|
|
|
|
license = licenses.asl20;
|
2015-04-06 21:41:54 +00:00
|
|
|
platforms = platforms.all;
|
2019-01-26 10:01:09 +00:00
|
|
|
maintainers = with maintainers; [ fpletz ];
|
2015-04-06 21:41:54 +00:00
|
|
|
};
|
|
|
|
}
|