stdlib: add missing features to build PolarSSL

This patch adds the missing features to the C library included
in the Trusted Firmware to build PolarSSL:

  - strcasecmp() function
  - exit() function
  - sscanf()* function
  - time.h header file (and its dependencies)

* NOTE: the sscanf() function is not a real implementation. It just
returns the number of expected arguments by counting the number of
'%' characters present in the formar string. This return value is
good enough for PolarSSL because during the certificate parsing
only the return value is checked. The certificate validity period
is ignored.

Change-Id: I43bb3742f26f0bd458272fccc3d72a7f2176ab3d
diff --git a/lib/stdlib/strcmp.c b/lib/stdlib/strcmp.c
index 1d26f2b..bb86e0f 100644
--- a/lib/stdlib/strcmp.c
+++ b/lib/stdlib/strcmp.c
@@ -36,6 +36,7 @@
  */
 
 #include <sys/cdefs.h>
+#include <sys/ctype.h>
 #include <string.h>
 
 /*
@@ -49,3 +50,17 @@
 			return 0;
 	return *(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1);
 }
+
+int
+strcasecmp(const char *s1, const char *s2)
+{
+	const unsigned char *us1 = (const unsigned char *)s1;
+	const unsigned char *us2 = (const unsigned char *)s2;
+
+	while (tolower(*us1) == tolower(*us2)) {
+		if (*us1++ == '\0')
+			return 0;
+		us2++;
+	}
+	return tolower(*us1) - tolower(*us2);
+}