platform: msm_shared: Change crypto init & clean up calls.

The API which performs hash calculation also does crypto_init
and cleanup, ideally crypto init & cleanup should be done during
target init & before jumping to hlos respectively.

Change-Id: I5f1b26f176950aac19ae4975f46470ee6153c815
CRs-Fixed: 584423
diff --git a/platform/msm_shared/crypto_hash.c b/platform/msm_shared/crypto_hash.c
index 1568243..d4d5972 100644
--- a/platform/msm_shared/crypto_hash.c
+++ b/platform/msm_shared/crypto_hash.c
@@ -33,7 +33,7 @@
 
 static crypto_SHA256_ctx g_sha256_ctx;
 static crypto_SHA1_ctx g_sha1_ctx;
-static unsigned char crypto_init_done = FALSE;
+static bool crypto_init_done = FALSE;
 
 extern void ce_clock_init(void);
 
@@ -96,6 +96,15 @@
 }
 
 /*
+ * Function to return if crypto is initialized
+ */
+
+bool crypto_initialized()
+{
+	return crypto_init_done;
+}
+
+/*
  * Function to initialize SHA256 context
  */
 
diff --git a/platform/msm_shared/include/crypto_hash.h b/platform/msm_shared/include/crypto_hash.h
index 03dccbc..800ebaf 100644
--- a/platform/msm_shared/include/crypto_hash.h
+++ b/platform/msm_shared/include/crypto_hash.h
@@ -129,4 +129,6 @@
 static crypto_result_type crypto_sha1(unsigned char *buff_ptr,
 				      unsigned int buff_size,
 				      unsigned char *digest_ptr);
+
+bool crypto_initialized(void);
 #endif