2018-06-28 23:25:19 +03:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, perl # Project uses Perl for scripting and testing
|
|
|
|
|
|
|
|
, enableThreading ? true # Threading can be disabled to increase security https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
|
|
|
|
}:
|
2015-04-07 00:41:54 +03:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-06-28 23:25:19 +03:00
|
|
|
name = "mbedtls-${version}";
|
2018-08-09 09:41:54 +03:00
|
|
|
version = "2.12.0";
|
2015-04-07 00:41:54 +03:00
|
|
|
|
2018-01-28 04:10:04 +03:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ARMmbed";
|
|
|
|
repo = "mbedtls";
|
|
|
|
rev = name;
|
2018-08-09 09:41:54 +03:00
|
|
|
sha256 = "09snlzlbn8yq95dnfbj2g5bh6y4q82xkaph7qp9ddnlqiaqcji2h";
|
2015-04-07 00:41:54 +03:00
|
|
|
};
|
|
|
|
|
2018-06-28 23:25:19 +03:00
|
|
|
nativeBuildInputs = [ cmake ninja perl ];
|
2016-12-10 19:29:50 +03:00
|
|
|
|
2018-06-28 23:25:19 +03:00
|
|
|
postConfigure = stdenv.lib.optionals enableThreading ''
|
|
|
|
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 19:29:50 +03:00
|
|
|
'';
|
|
|
|
|
2018-06-28 23:25:19 +03:00
|
|
|
cmakeFlags = [ "-DUSE_SHARED_MBEDTLS_LIBRARY=on" ];
|
2015-04-07 00:41:54 +03:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2016-07-10 02:06:24 +03:00
|
|
|
homepage = https://tls.mbed.org/;
|
2018-06-28 23:25:19 +03:00
|
|
|
description = "Portable cryptographic and TLS library, formerly known as PolarSSL";
|
|
|
|
license = licenses.asl20;
|
2015-04-07 00:41:54 +03:00
|
|
|
platforms = platforms.all;
|
2016-07-10 02:06:24 +03:00
|
|
|
maintainers = with maintainers; [ wkennington fpletz ];
|
2015-04-07 00:41:54 +03:00
|
|
|
};
|
|
|
|
}
|