saltbundlepy-pyopenssl/fix-missing-ASN1_STRING_get0_data-in-old-openssl.patch

17 lines
750 B
Diff

diff -urN a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py
--- a/src/OpenSSL/_util.py 2022-09-16 14:23:19.000000000 +0200
+++ b/src/OpenSSL/_util.py 2024-05-06 15:49:54.603228963 +0200
@@ -12,6 +12,12 @@
lib = binding.lib
+if not hasattr(lib, "ASN1_STRING_get0_data") and hasattr(lib, "ASN1_STRING_data"):
+ # Define ASN1_STRING_get0_data if it's missing, but ASN1_STRING_data present.
+ # It's required for backward compatibility with older openssl versions.
+ lib.ASN1_STRING_get0_data = lib.ASN1_STRING_data
+
+
# This is a special CFFI allocator that does not bother to zero its memory
# after allocation. This has vastly better performance on large allocations and
# so should be used whenever we don't need the memory zeroed out.