Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for old libressl #11274

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/cryptography/hazmat/backends/openssl/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,6 @@ def _bytes_to_bio(self, data: bytes) -> _MemoryBIO:

return _MemoryBIO(self._ffi.gc(bio, self._lib.BIO_free), data_ptr)

def _create_mem_bio_gc(self):
"""
Creates an empty memory BIO.
"""
bio_method = self._lib.BIO_s_mem()
self.openssl_assert(bio_method != self._ffi.NULL)
bio = self._lib.BIO_new(bio_method)
self.openssl_assert(bio != self._ffi.NULL)
bio = self._ffi.gc(bio, self._lib.BIO_free)
return bio

def _oaep_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
return False
Expand Down
5 changes: 1 addition & 4 deletions tests/hazmat/primitives/test_pkcs7.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,8 @@ def _pkcs7_verify(encoding, sig, msg, certs, options, backend):
)
else:
msg_bio = backend._bytes_to_bio(msg)
# libressl 3.7.0 has a bug when NULL is passed as an `out_bio`. Work
# around it for now.
out_bio = backend._create_mem_bio_gc()
res = backend._lib.PKCS7_verify(
p7, backend._ffi.NULL, store, msg_bio.bio, out_bio, flags
p7, backend._ffi.NULL, store, msg_bio.bio, backend._ffi.NULL, flags
)
backend.openssl_assert(res == 1)
# OpenSSL 3.0 leaves a random bio error on the stack:
Expand Down