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