summaryrefslogtreecommitdiff
path: root/src/cryptography/hazmat
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2023-04-11 00:41:16 -0400
committerGitHub <noreply@github.com>2023-04-11 12:41:16 +0800
commitedf5bd5184cdb7c0df0eac5180bfa0818f62f517 (patch)
treeaceac5bb63622ac8783374d9846bed0c06805619 /src/cryptography/hazmat
parentec7dbc4ee7e8c3ed9da71783b1f90d3904ec97d7 (diff)
downloadcryptography-edf5bd5184cdb7c0df0eac5180bfa0818f62f517.tar.gz
Remove unused parameter (#8707)
Diffstat (limited to 'src/cryptography/hazmat')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 256f3a1c1..71215e6b4 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -422,20 +422,15 @@ class Backend:
val = int.from_bytes(self._ffi.buffer(bin_ptr)[:bin_len], "big")
return val
- def _int_to_bn(self, num: int, bn=None):
+ def _int_to_bn(self, num: int):
"""
Converts a python integer to a BIGNUM. The returned BIGNUM will not
be garbage collected (to support adding them to structs that take
ownership of the object). Be sure to register it for GC if it will
be discarded after use.
"""
- assert bn is None or bn != self._ffi.NULL
-
- if bn is None:
- bn = self._ffi.NULL
-
binary = num.to_bytes(int(num.bit_length() / 8.0 + 1), "big")
- bn_ptr = self._lib.BN_bin2bn(binary, len(binary), bn)
+ bn_ptr = self._lib.BN_bin2bn(binary, len(binary), self._ffi.NULL)
self.openssl_assert(bn_ptr != self._ffi.NULL)
return bn_ptr