summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index 77493ffa..61b9ba66 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -54,7 +54,9 @@
#include <asdcp/AS_DCP.h>
#include <xmlsec/xmldsig.h>
#include <xmlsec/dl.h>
+#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
#include <xmlsec/app.h>
+#endif
#include <xmlsec/crypto.h>
#include <libxml++/nodes/element.h>
#include <libxml++/document.h>
@@ -182,6 +184,12 @@ dcp::init (optional<boost::filesystem::path> given_resources_directory)
OpenSSL_add_all_algorithms();
+#ifdef LIBDCP_WINDOWS
+ putenv("OPENSSL_ENABLE_SHA1_SIGNATURES=1");
+#else
+ setenv("OPENSSL_ENABLE_SHA1_SIGNATURES", "1", 1);
+#endif
+
asdcp_smpte_dict = &ASDCP::DefaultSMPTEDict();
auto res = given_resources_directory.get_value_or(resources_directory());
@@ -463,3 +471,24 @@ dcp::maybe_throw_from_asdcplib(Kumu::Result_t result, boost::filesystem::path pa
}
}
+
+size_t
+dcp::utf8_strlen(string s)
+{
+ size_t const len = s.length();
+ int N = 0;
+ for (size_t i = 0; i < len; ++i) {
+ unsigned char c = s[i];
+ if ((c & 0xe0) == 0xc0) {
+ ++i;
+ } else if ((c & 0xf0) == 0xe0) {
+ i += 2;
+ } else if ((c & 0xf8) == 0xf0) {
+ i += 3;
+ }
+ ++N;
+ }
+ return N;
+}
+
+