summaryrefslogtreecommitdiff
path: root/src/OpenSSL/_util.py
diff options
context:
space:
mode:
authorCory Benfield <lukasaoz@gmail.com>2016-11-28 12:17:08 +0000
committerHynek Schlawack <hs@ox.cx>2016-11-28 13:17:08 +0100
commite62840e19c5f1640afff1ff4d84df05cda652085 (patch)
treea5e903d910e8412c1571b17766cc96a0152217ae /src/OpenSSL/_util.py
parentf189de9becf14840712b01877ebb1f08c26f894c (diff)
downloadpyopenssl-e62840e19c5f1640afff1ff4d84df05cda652085.tar.gz
Don't zero memory when we don't have to. (#578)
Diffstat (limited to 'src/OpenSSL/_util.py')
-rw-r--r--src/OpenSSL/_util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py
index 48bcbf5..cf8b888 100644
--- a/src/OpenSSL/_util.py
+++ b/src/OpenSSL/_util.py
@@ -12,6 +12,12 @@ ffi = binding.ffi
lib = binding.lib
+# 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.
+no_zero_allocator = ffi.new_allocator(should_clear_after_alloc=False)
+
+
def text(charp):
"""
Get a native string type representing of the given CFFI ``char*`` object.