summary refs log tree commit diff
path: root/gnu/packages/patches/python-acme-dont-use-openssl-rand.patch
blob: 78920629c0ce24f970616f9127ba94ef9e91c086 (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
Fix build with PyOpenSSL > 17.2.0.

See <https://github.com/certbot/certbot/issues/5111>.

Patch copied from upstream source repository:
https://github.com/certbot/certbot/commit/f6be07da74c664b57ac8c053585f919c79f9af44

diff --git a/acme/crypto_util.py b/acme/crypto_util.py
index de15284c03..b8fba03488 100644
--- a/acme/crypto_util.py
+++ b/acme/crypto_util.py
@@ -2,6 +2,7 @@
 import binascii
 import contextlib
 import logging
+import os
 import re
 import socket
 import sys
@@ -243,7 +244,7 @@ def gen_ss_cert(key, domains, not_before=None,
     """
     assert domains, "Must provide one or more hostnames for the cert."
     cert = OpenSSL.crypto.X509()
-    cert.set_serial_number(int(binascii.hexlify(OpenSSL.rand.bytes(16)), 16))
+    cert.set_serial_number(int(binascii.hexlify(os.urandom(16)), 16))
     cert.set_version(2)
 
     extensions = [