From: Amul Shah <Amul.Shah@fisglobal.com>
Description: Backport upstream changes to the source CMakeLists.txt file
  The CMakeLists.txt in the V6.1-000 source release did not build the
  encryption plugins. The upstream CMakeLists.txt includes these changes
  and set the default encryption engine and algorithm
Applied-Upstream: V6.2-000

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,8 +57,8 @@
 set(gt_src_list)
 set(sources_used "")
 set(extralibs "")
-# Disable encryption for the time being. Need to change this to invoke the gtmcrypt Makefile AS 2013.12.18
-set(is_encryption_supported 0)
+set(GTMCRYPTLIB "GCRYPT")
+set(GTMCRYPTALGO "AES256CFB")
 set(libmumpsrestoreregex "")
 message("--> OS = ${CMAKE_SYSTEM_NAME} / ARCH = ${CMAKE_SYSTEM_PROCESSOR}")
 # Establish platform
@@ -74,6 +74,7 @@
 else()
   message(FATAL_ERROR "--> OS = ${CMAKE_SYSTEM_NAME} / ARCH = ${CMAKE_SYSTEM_PROCESSOR}")
 endif()
+message("--> Encryption Library = ${GTMCRYPTLIB} / Algorithm = ${GTMCRYPTALGO}")
 
 # Choose where to get bootstrap sources.
 set(GTM_DIST "" CACHE PATH "Existing GT.M Distribution")
@@ -221,9 +222,8 @@
 set_source_list(gtcm_shmclean    gtcm_shmclean)
 set_source_list(gtmsecshr        gtmsecshr_wrapper)
 set_source_list(gtmsecshr_real   gtmsecshr)
-set_source_list(libgtmcrypt      gtmcrypt_ref gtmcrypt_pk_ref gtmcrypt_dbk_ref gtmcrypt_sym_ref)
-set_source_list(libgtmtls        gtm_tls_impl)
-set_source_list(libgtmcryptutil  gtmcrypt_util)
+set_source_list(libgtmcrypt      gtmcrypt_ref gtmcrypt_pk_ref gtmcrypt_dbk_ref gtmcrypt_sym_ref gtmcrypt_util)
+set_source_list(libgtmtls        gtm_tls_impl gtmcrypt_util)
 set_source_list(libgtmshr        gtm_main)
 set_source_list(lke              lke lke_cmd)
 set_source_list(maskpass         maskpass gtmcrypt_util)
@@ -386,7 +386,7 @@
 endforeach()
 
 # TODO: find_package or find_library for system libs?
-include_directories ("/usr/local/include")
+include_directories (/usr/local/include)
 target_link_libraries(libmumps		${libmumpslibs})
 
 add_executable(mumps			${mumps_SOURCES})
@@ -466,57 +466,47 @@
 add_dependencies(libgtmshr gen_export)
 add_dependencies(mumps libgtmshr)
 
-if(is_encryption_supported)
-  # Iterate over the list of GPG related libraries
-  foreach(gpglib gpg-error gpgme gcrypt)
-    # For each library, we need a new CMake variable, hence GPGLIB_${gpglib}
-    find_library(GPGLIB_${gpglib} NAME ${gpglib} PATHS ${CMAKE_LIBRARY_PATH})
-    # Append the found library to the list
-    set(GPG_LIBRARIES ${GPG_LIBRARIES} ${GPGLIB_${gpglib}})
-  endforeach()
-
-  # Iterate over the list of SSL related libraries
-  foreach(ssl)
-    # For each library, we need a new CMake variable, hence TLSLIB_${tlslib}
-    find_library(TLSLIB_${tlslib} NAME ${tlslib} PATHS ${CMAKE_LIBRARY_PATH})
-    # Append the found library to the list
-    set(TLS_LIBRARIES ${TLS_LIBRARIES} ${TLSLIB_${tlslib}})
-  endforeach()
+# Iterate over the list of GPG related libraries
+foreach(gpglib gpg-error gpgme gcrypt config)
+  # For each library, we need a new CMake variable, hence GPGLIB_${gpglib}
+  find_library(GPGLIB_${gpglib} NAME ${gpglib} PATHS ${CMAKE_LIBRARY_PATH})
+  # Append the found library to the list
+  set(GPG_LIBRARIES ${GPG_LIBRARIES} ${GPGLIB_${gpglib}})
+endforeach()
 
-  add_library(libgtmcrypt MODULE ${libgtmcrypt_SOURCES})
-  set_target_properties(libgtmcrypt PROPERTIES
-    OUTPUT_NAME gtmcrypt
-    COMPILE_DEFINITIONS "USE_GCRYPT -DUSE_AES256CFB"
-    LIBRARY_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin
-    )
-  target_link_libraries(libgtmcrypt ${GPG_LIBRARIES})
-  install(TARGETS libgtmcrypt DESTINATION ${GTM_INSTALL_DIR}/plugin)
+# Iterate over the list of GPG related libraries
+foreach(lib ssl crypto config)
+  # For each library, we need a new CMake variable, hence SSLLIB_${lib}
+  find_library(SSLLIB_${lib} NAME ${lib} PATHS ${CMAKE_LIBRARY_PATH})
+  # Append the found library to the list
+  set(SSL_LIBRARIES ${SSL_LIBRARIES} ${SSLLIB_${lib}})
+endforeach()
 
-  add_library(libgtmtls MODULE ${libgtmtls_SOURCES})
-  set_target_properties(libgtmtls PROPERTIES
-    OUTPUT_NAME gtmtls
-    LIBRARY_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin
-    )
-  target_link_libraries(libgtmtls ${TLS_LIBRARIES})
-  install(TARGETS libgtmtls DESTINATION ${GTM_INSTALL_DIR}/plugin)
+add_library(libgtmcrypt MODULE ${libgtmcrypt_SOURCES})
+set_target_properties(libgtmcrypt PROPERTIES
+  OUTPUT_NAME gtmcrypt
+  COMPILE_DEFINITIONS "USE_${GTMCRYPTLIB} -DUSE_${GTMCRYPTALGO}"
+  LIBRARY_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin
+  )
+target_link_libraries(libgtmcrypt ${GPG_LIBRARIES})
+install(TARGETS libgtmcrypt DESTINATION ${GTM_INSTALL_DIR}/plugin)
 
-  add_library(libgtmcryptutil MODULE ${libgtmcryptutil_SOURCES})
-  set_target_properties(libgtmcryptutil PROPERTIES
-    OUTPUT_NAME gtmcryptutil
-    COMPILE_DEFINITIONS "USE_GCRYPT -DUSE_AES256CFB"
-    LIBRARY_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin
-    )
-  target_link_libraries(libgtmcryptutil ${GPG_LIBRARIES})
-  install(TARGETS libgtmcryptutil DESTINATION ${GTM_INSTALL_DIR}/plugin)
+add_library(libgtmtls MODULE ${libgtmtls_SOURCES})
+set_target_properties(libgtmtls PROPERTIES
+  OUTPUT_NAME gtmtls
+  COMPILE_DEFINITIONS "USE_OPENSSL"
+  LIBRARY_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin
+  )
+target_link_libraries(libgtmtls ${SSL_LIBRARIES})
+install(TARGETS libgtmtls DESTINATION ${GTM_INSTALL_DIR}/plugin)
 
-  add_executable(maskpass ${maskpass_SOURCES})
-  target_link_libraries(maskpass ${GPG_LIBRARIES})
-  set_target_properties(maskpass PROPERTIES
-    COMPILE_DEFINITIONS "USE_GCRYPT -DUSE_SYSLIB_FUNCS"
-    RUNTIME_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin/gtmcrypt
-    )
-  install(TARGETS maskpass DESTINATION ${GTM_INSTALL_DIR}/plugin/gtmcrypt)
-endif()
+add_executable(maskpass ${maskpass_SOURCES})
+target_link_libraries(maskpass ${GPG_LIBRARIES} ${SSL_LIBRARIES})
+set_target_properties(maskpass PROPERTIES
+  COMPILE_DEFINITIONS "USE_${GTMCRYPTLIB} -DUSE_SYSLIB_FUNCS"
+  RUNTIME_OUTPUT_DIRECTORY ${GTM_BINARY_DIR}/plugin/gtmcrypt
+  )
+install(TARGETS maskpass DESTINATION ${GTM_INSTALL_DIR}/plugin/gtmcrypt)
 
 # Always copy files into the plugin directory
 foreach(f
