2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
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";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "3.20.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}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-RPaBUj/BJCO+10maGDmugeEXxaIrlk2UHIvkbrQVM8c=";
|
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"'
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ test-vectors ];
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "Crypto" ];
|
2022-01-26 04:04:25 +00:00
|
|
|
|
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";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = with licenses; [
|
|
|
|
bsd2 # and
|
|
|
|
asl20
|
|
|
|
];
|
2022-01-26 04:04:25 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|