make crypto code compile with openssl 1.1.x
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 27 Nov 2018 15:14:20 +0000 (16:14 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 18 Dec 2018 11:57:28 +0000 (12:57 +0100)
From EVP_DigestInit(3):

       EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed
       to EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.

src/crypto.cpp

index c7ad98b..d08f5d6 100644 (file)
@@ -91,7 +91,11 @@ string I2n::hash_data_raw(string data, algorithm algo)
 
     const EVP_MD *md;
 
+#   if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     EVP_MD_CTX_Ptr ctx(EVP_MD_CTX_create(), EVP_MD_CTX_destroy);
+#   else
+    EVP_MD_CTX_Ptr ctx(EVP_MD_CTX_new(), EVP_MD_CTX_free);
+#   endif
 
     uchar_arr ret(new unsigned char[EVP_MAX_MD_SIZE]);
 
@@ -113,7 +117,11 @@ string I2n::hash_file(string filename, algorithm algo)
 {
     const EVP_MD *md;
 
+#   if (OPENSSL_VERSION_NUMBER < 0x10100000L)
     EVP_MD_CTX_Ptr ctx(EVP_MD_CTX_create(), EVP_MD_CTX_destroy);
+#   else
+    EVP_MD_CTX_Ptr ctx(EVP_MD_CTX_new(), EVP_MD_CTX_free);
+#   endif
 
     uchar_arr ret(new unsigned char[EVP_MAX_MD_SIZE]);