lk/openssl: Adding openssl to compile in lk build

This is used for verifying signed kernel.
Openssl library will be used for certificate parsing
and rsa decryption.

Change-Id: Icf0024afd8f4d8690d077b47f4b9e83cad1e4813
diff --git a/lib/openssl/crypto/cryptlib.c b/lib/openssl/crypto/cryptlib.c
index b4449b8..5848446 100644
--- a/lib/openssl/crypto/cryptlib.c
+++ b/lib/openssl/crypto/cryptlib.c
@@ -478,6 +478,7 @@
 
 void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
 	{
+	  unsigned char errno;
 	if (threadid_callback)
 		{
 		threadid_callback(id);
@@ -874,7 +875,9 @@
 { va_list ap;
 
     va_start (ap,fmta);
+#ifndef LK_NO_STDERR
     vfprintf (stderr,fmta,ap);
+#endif
     va_end (ap);
 }
 int OPENSSL_isservice (void) { return 0; }
@@ -886,7 +889,9 @@
 		"%s(%d): OpenSSL internal error, assertion failed: %s\n",
 		file,line,assertion);
 #if !defined(_WIN32) || defined(__CYGWIN__)
+#ifndef LK_NO_ABORT
 	abort();
+#endif
 #else
 	/* Win32 abort() customarily shows a dialog, but we just did that... */
 	raise(SIGABRT);
@@ -894,4 +899,11 @@
 #endif
 	}
 
-void *OPENSSL_stderr(void)	{ return stderr; }
+/* No stderr in LK */
+void *OPENSSL_stderr(void)	{
+#ifndef LK_NO_STDERR
+  return stderr;
+#else
+  return NULL;
+#endif
+}