1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, swig2
6, openssl
7, typing
8, parameterized
9}:
10
11
12buildPythonPackage rec {
13 version = "0.38.0";
14 pname = "M2Crypto";
15
16 src = fetchPypi {
17 inherit pname version;
18 hash = "sha256-mfImCjCQHJSajcbV+CzVMS/7iryS52YzuvIxu7yy3ss=";
19 };
20
21 patches = [
22 # Use OpenSSL_version_num() instead of unrealiable parsing of .h file.
23 (fetchpatch {
24 url = "https://src.fedoraproject.org/rpms/m2crypto/raw/42951285c800f72e0f0511cec39a7f49e970a05c/f/m2crypto-MR271-opensslversion.patch";
25 hash = "sha256-e1/NHgWza+kum76MUFSofq9Ko3pML67PUfqWjcwIl+A=";
26 })
27 # Changed required to pass tests on OpenSSL 3.0
28 (fetchpatch {
29 url = "https://src.fedoraproject.org/rpms/m2crypto/raw/42951285c800f72e0f0511cec39a7f49e970a05c/f/m2crypto-0.38-ossl3-tests.patch";
30 hash = "sha256-B6JKoPh76+CIna6zmrvFj50DIp3pzg8aKyzz+Q5hqQ0=";
31 })
32 # Allow EVP tests fail on non-FIPS algorithms
33 (fetchpatch {
34 url = "https://src.fedoraproject.org/rpms/m2crypto/raw/42951285c800f72e0f0511cec39a7f49e970a05c/f/m2crypto-0.38-ossl3-tests-evp.patch";
35 hash = "sha256-jMUAphVBQMFaOJSeYUCQMV3WSe9VDQqG6GY5fDQXZnA=";
36 })
37 # Fix the readline test https://gitlab.com/m2crypto/m2crypto/-/issues/286
38 (fetchpatch {
39 url = "https://gitlab.com/m2crypto/m2crypto/-/commit/b8addc7ad9990d1ba3786830ebd74aa8c939849d.patch";
40 hash = "sha256-M5mrmJVCT0fASvERLKa/MR+EY2hzRGIkyUfguVBPKNk=";
41 })
42 ];
43
44 nativeBuildInputs = [ swig2 openssl ];
45 buildInputs = [ openssl parameterized ];
46
47 meta = with lib; {
48 description = "A Python crypto and SSL toolkit";
49 homepage = "https://gitlab.com/m2crypto/m2crypto";
50 license = licenses.mit;
51 maintainers = with maintainers; [ andrew-d ];
52 };
53}