1{ lib
2, absl-py
3, buildPythonPackage
4, cryptography
5, fetchFromGitHub
6, fpylll
7, gmpy
8, protobuf
9, pybind11
10, pytestCheckHook
11, pythonOlder
12, scipy
13, sympy
14}:
15
16buildPythonPackage rec {
17 pname = "paranoid-crypto";
18 version = "unstable-20220819";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.9";
22
23 src = fetchFromGitHub {
24 owner = "google";
25 repo = "paranoid_crypto";
26 # https://github.com/google/paranoid_crypto/issues/11
27 rev = "8abccc1619748b93979d1c26234b90d26e88a12e";
28 hash = "sha256-4yF7WAFAGGhvWTV/y5dGVA/+9r1dqrXU/0/6Edgw3ow=";
29 };
30
31 nativeBuildInputs = [
32 protobuf
33 pybind11
34 ];
35
36 propagatedBuildInputs = [
37 absl-py
38 cryptography
39 gmpy
40 scipy
41 sympy
42 protobuf
43 ];
44
45 checkInputs = [
46 fpylll
47 pytestCheckHook
48 ];
49
50 postPatch = ''
51 substituteInPlace requirements.txt \
52 --replace "protobuf==3.20.*" "protobuf"
53 '';
54
55 disabledTestPaths = [
56 # Import issue
57 "paranoid_crypto/lib/randomness_tests/"
58 ];
59
60 pythonImportsCheck = [
61 "paranoid_crypto"
62 ];
63
64 meta = with lib; {
65 description = "Library contains checks for well known weaknesses on cryptographic artifacts";
66 homepage = "https://github.com/google/paranoid_crypto";
67 license = with licenses; [ asl20 ];
68 maintainers = with maintainers; [ fab ];
69 };
70}