]> granicus.if.org Git - pdns/commitdiff
Port md5.hh to OpenSSL
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Sat, 2 Jan 2016 21:25:44 +0000 (22:25 +0100)
committerChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Sat, 16 Jan 2016 20:38:57 +0000 (21:38 +0100)
pdns/md5.hh

index a193a2a3f377a78fc859f3cc0b65f534156b6507..9a9093768597e1b58f750fe69bbb18eba9919c4e 100644 (file)
@@ -5,15 +5,23 @@
 #include <stdint.h>
 #ifdef HAVE_MBEDTLS2
 #include <mbedtls/md5.h>
-#else
+#elif defined(HAVE_MBEDTLS)
 #include <polarssl/md5.h>
 #include "mbedtlscompat.hh"
+#elif HAVE_OPENSSL
+#include <openssl/md5.h>
 #endif
 
 inline std::string pdns_md5sum(const std::string& input)
 {
   unsigned char result[16] = {0};
+#ifdef HAVE_MBEDTLS
   mbedtls_md5(reinterpret_cast<const unsigned char*>(input.c_str()), input.length(), result);
+#elif defined(HAVE_OPENSSL)
+  MD5(reinterpret_cast<const unsigned char*>(input.c_str()), input.length(), result);
+#else
+#error "No md5 implementation found"
+#endif
   return std::string(result, result + sizeof result);
 }