Add support for OpenSSL 1.1.0

With OpenSSL 1.1.0, some of the functions were deprecated, such
as EVP_CIPHER_CTX_cleanup.
Replace EVP_CIPHER_CTX_cleanup with EVP_CIPHER_CTX_free and
replace EVP_CIPHER_CTX_init with EVP_CIPHER_CTX_new as these
are the new recommended interfaces.

These exist in OpenSSL 1.0.2 already so this change is
backward compatible.

Resolves openbmc/openbmc#3135

Change-Id: I937d19708b10c33d9544f27af47963634c2bd36b
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/crypt_algo.cpp b/crypt_algo.cpp
index 21a2ff6..90ba26a 100644
--- a/crypt_algo.cpp
+++ b/crypt_algo.cpp
@@ -90,18 +90,16 @@
                                const uint8_t* input,
                                const int inputLen) const
 {
-    EVP_CIPHER_CTX ctx;
-
     // Initializes Cipher context
-    EVP_CIPHER_CTX_init(&ctx);
+    EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
 
     auto cleanupFunc = [](EVP_CIPHER_CTX* ctx)
     {
-        EVP_CIPHER_CTX_cleanup(ctx);
+        EVP_CIPHER_CTX_free(ctx);
     };
 
     std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)>
-            ctxPtr(&ctx, cleanupFunc);
+            ctxPtr(ctx, cleanupFunc);
 
     /*
      * EVP_DecryptInit_ex sets up cipher context ctx for encryption with type
@@ -156,18 +154,16 @@
         throw std::runtime_error("RAND_bytes failed");
     }
 
-    EVP_CIPHER_CTX ctx;
-
     // Initializes Cipher context
-    EVP_CIPHER_CTX_init(&ctx);
+    EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
 
     auto cleanupFunc = [](EVP_CIPHER_CTX* ctx)
     {
-        EVP_CIPHER_CTX_cleanup(ctx);
+        EVP_CIPHER_CTX_free(ctx);
     };
 
     std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)>
-            ctxPtr(&ctx, cleanupFunc);
+            ctxPtr(ctx, cleanupFunc);
 
     /*
      * EVP_EncryptInit_ex sets up cipher context ctx for encryption with type