Name |
Last commit
|
Last update |
---|---|---|
.. | ||
mbedtls.c | ||
mbedtls.h | ||
openssl.c | ||
openssl.h | ||
registry.c | ||
registry.h | ||
socket.c | ||
socket.h | ||
stransport.c | ||
stransport.h | ||
tls.c | ||
tls.h |
As OpenSSL loves using uninitialized bytes as another source of entropy, we need to mark them as defined so that Valgrind won't complain about use of these bytes. Traditionally, we've been using the macro `VALGRIND_MAKE_MEM_DEFINED` provided by Valgrind, but starting with OpenSSL 1.1 the code doesn't compile anymore due to `struct SSL` having become opaque. As such, we also can't set it as defined anymore, as we have no way of knowing its size. Let's change gears instead by just swapping out the allocator functions of OpenSSL with our own ones. The twist is that instead of calling `malloc`, we just call `calloc` to have the bytes initialized automatically. Next to soothing Valgrind, this approach has the benefit of being completely agnostic of the memory sanitizer and is neatly contained at a single place. Note that we shouldn't do this for non-Valgrind builds. As we cannot set up memory functions for a given SSL context, only, we need to swap them at a global context. Furthermore, as it's possible to call `OPENSSL_set_mem_functions` once only, we'd prevent users of libgit2 to set up their own allocators.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
mbedtls.c | Loading commit data... | |
mbedtls.h | Loading commit data... | |
openssl.c | Loading commit data... | |
openssl.h | Loading commit data... | |
registry.c | Loading commit data... | |
registry.h | Loading commit data... | |
socket.c | Loading commit data... | |
socket.h | Loading commit data... | |
stransport.c | Loading commit data... | |
stransport.h | Loading commit data... | |
tls.c | Loading commit data... | |
tls.h | Loading commit data... |