2022-01-26 04:04:25 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2022-06-26 10:26:21 +00:00
|
|
|
, callPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gmp
|
2022-01-26 04:04:25 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
let
|
|
|
|
test-vectors = callPackage ./vectors.nix { };
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pycryptodome";
|
2023-08-10 07:59:29 +00:00
|
|
|
version = "3.18.0";
|
2022-01-26 04:04:25 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Legrandin";
|
|
|
|
repo = "pycryptodome";
|
2023-08-10 07:59:29 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-6oXXy18KlSjfyZhfMnIgnu34u/9sG0TPYvPJ8ovTqMA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace lib/Crypto/Math/_IntegerGMP.py \
|
|
|
|
--replace 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"'
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-06-26 10:26:21 +00:00
|
|
|
test-vectors
|
|
|
|
];
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"Crypto"
|
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2022-06-26 10:26:21 +00:00
|
|
|
description = "Self-contained cryptographic library";
|
|
|
|
homepage = "https://github.com/Legrandin/pycryptodome";
|
2023-08-10 07:59:29 +00:00
|
|
|
changelog = "https://github.com/Legrandin/pycryptodome/blob/v${version}/Changelog.rst";
|
2022-01-26 04:04:25 +00:00
|
|
|
license = with licenses; [ bsd2 /* and */ asl20 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|