1{
2 lib,
3 buildPythonPackage,
4 callPackage,
5 fetchFromGitHub,
6 gmp,
7}:
8
9let
10 test-vectors = callPackage ./vectors.nix { };
11in
12buildPythonPackage rec {
13 pname = "pycryptodome";
14 version = "3.20.0";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "Legrandin";
19 repo = "pycryptodome";
20 rev = "refs/tags/v${version}";
21 hash = "sha256-RPaBUj/BJCO+10maGDmugeEXxaIrlk2UHIvkbrQVM8c=";
22 };
23
24 postPatch = ''
25 substituteInPlace lib/Crypto/Math/_IntegerGMP.py \
26 --replace 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"'
27 '';
28
29 nativeCheckInputs = [ test-vectors ];
30
31 pythonImportsCheck = [ "Crypto" ];
32
33 meta = with lib; {
34 description = "Self-contained cryptographic library";
35 homepage = "https://github.com/Legrandin/pycryptodome";
36 changelog = "https://github.com/Legrandin/pycryptodome/blob/v${version}/Changelog.rst";
37 license = with licenses; [
38 bsd2 # and
39 asl20
40 ];
41 maintainers = with maintainers; [ fab ];
42 };
43}