about summary refs log tree commit diff
path: root/pkgs/development/python-modules/paranoid-crypto/default.nix
blob: f4ee6d2fe0b76c13bb12212893e1ec3f5037aeb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ lib
, absl-py
, buildPythonPackage
, cryptography
, fetchFromGitHub
, fpylll
, gmpy
, protobuf
, pybind11
, pytestCheckHook
, pythonOlder
, scipy
, sympy
}:

buildPythonPackage rec {
  pname = "paranoid-crypto";
  version = "unstable-20220819";
  format = "setuptools";

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "google";
    repo = "paranoid_crypto";
    # https://github.com/google/paranoid_crypto/issues/11
    rev = "8abccc1619748b93979d1c26234b90d26e88a12e";
    hash = "sha256-4yF7WAFAGGhvWTV/y5dGVA/+9r1dqrXU/0/6Edgw3ow=";
  };

  nativeBuildInputs = [
    protobuf
    pybind11
  ];

  propagatedBuildInputs = [
    absl-py
    cryptography
    gmpy
    scipy
    sympy
    protobuf
  ];

  nativeCheckInputs = [
    fpylll
    pytestCheckHook
  ];

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace "protobuf==3.20.*" "protobuf"
  '';

  disabledTestPaths = [
    # Import issue
    "paranoid_crypto/lib/randomness_tests/"
  ];

  pythonImportsCheck = [
    "paranoid_crypto"
  ];

  meta = with lib; {
    description = "Library contains checks for well known weaknesses on cryptographic artifacts";
    homepage = "https://github.com/google/paranoid_crypto";
    license = with licenses; [ asl20 ];
    maintainers = with maintainers; [ fab ];
  };
}