summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-02 15:35:53 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-02 15:35:53 +0100
commit1850e3c12522298ddb3e66ccf30c6b1207182d5f (patch)
treeec14b9f4d9444bc0d187c7e98c6a7cec640c6c19
parentbff3ee89298b12f5e3dcb16f13a3e30e542ce87d (diff)
Minor trimming of false positives from valgrind.
-rwxr-xr-xasdcplib/src/KM_prng.cpp9
-rw-r--r--wscript4
2 files changed, 12 insertions, 1 deletions
diff --git a/asdcplib/src/KM_prng.cpp b/asdcplib/src/KM_prng.cpp
index 463ae157..7a0100c1 100755
--- a/asdcplib/src/KM_prng.cpp
+++ b/asdcplib/src/KM_prng.cpp
@@ -39,7 +39,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <openssl/aes.h>
#include <openssl/sha.h>
#include <openssl/bn.h>
-
+#ifdef LIBDCP_VALGRIND
+#include <valgrind/memcheck.h>
+#endif
+
using namespace Kumu;
@@ -118,6 +121,10 @@ public:
SHA1_Update(&SHA, key_fodder, RNG_KEY_SIZE);
SHA1_Final(sha_buf, &SHA);
+#ifdef LIBDCP_VALGRIND
+ VALGRIND_MAKE_MEM_DEFINED (sha_buf, 20);
+#endif
+
AutoMutex Lock(m_Lock);
AES_set_encrypt_key(sha_buf, RNG_KEY_SIZE_BITS, &m_Context);
*(ui32_t*)(m_ctr_buf + 12) = 1;
diff --git a/wscript b/wscript
index c66d3fbd..5a228368 100644
--- a/wscript
+++ b/wscript
@@ -10,6 +10,7 @@ def options(opt):
opt.add_option('--osx', action='store_true', default=False, help='set up to build on OS X')
opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
opt.add_option('--static', action='store_true', default=False, help='build libdcp and in-tree dependencies statically, and link statically to openjpeg and cxml')
+ opt.add_option('--valgrind', action='store_true', default=False, help='build with instructions to Valgrind to reduce false positives')
def configure(conf):
conf.load('compiler_cxx')
@@ -26,6 +27,9 @@ def configure(conf):
else:
conf.env.append_value('CXXFLAGS', '-DLIBDCP_POSIX')
+ if conf.options.valgrind:
+ conf.env.append_value('CXXFLAGS', '-DLIBDCP_VALGRIND')
+
if not conf.options.osx:
conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter'])