Remove string.h from base.h.

Including string.h in base.h causes any file that includes a BoringSSL
header to include string.h. Generally this wouldn't be a problem,
although string.h might slow down the compile if it wasn't otherwise
needed. However, it also causes problems for ipsec-tools in Android
because OpenSSL didn't have this behaviour.

This change removes string.h from base.h and, instead, adds it to each
.c file that requires it.

Change-Id: I5968e50b0e230fd3adf9b72dd2836e6f52d6fb37
Reviewed-on: https://boringssl-review.googlesource.com/3200
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c
index 5038455..8055f0c 100644
--- a/crypto/asn1/a_bitstr.c
+++ b/crypto/asn1/a_bitstr.c
@@ -56,9 +56,12 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 
+
 int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
 { return M_ASN1_BIT_STRING_set(x, d, len); }
 
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index b9dd816..8874f48 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/buf.h>
 #include <openssl/err.h>
 #include <openssl/mem.h>
diff --git a/crypto/asn1/a_enum.c b/crypto/asn1/a_enum.c
index d6d237a..a581a34 100644
--- a/crypto/asn1/a_enum.c
+++ b/crypto/asn1/a_enum.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c
index b5bddb8..355feff 100644
--- a/crypto/asn1/a_gentm.c
+++ b/crypto/asn1/a_gentm.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 #include <openssl/time_support.h>
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index 6d7e225..eb0887a 100644
--- a/crypto/asn1/a_int.c
+++ b/crypto/asn1/a_int.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c
index 007f0e1..9abe659 100644
--- a/crypto/asn1/a_mbstr.c
+++ b/crypto/asn1/a_mbstr.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 16d5e79..189886c 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -57,6 +57,7 @@
 #include <openssl/asn1.h>
 
 #include <limits.h>
+#include <string.h>
 
 #include <openssl/err.h>
 #include <openssl/mem.h>
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c
index e61de70..df849e1 100644
--- a/crypto/asn1/a_strnid.c
+++ b/crypto/asn1/a_strnid.c
@@ -57,6 +57,7 @@
 #include <openssl/asn1.h>
 
 #include <stdlib.h>  /* For bsearch */
+#include <string.h>
 
 #include <openssl/err.h>
 #include <openssl/mem.h>
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c
index 4786024..f0badcc 100644
--- a/crypto/asn1/a_time.c
+++ b/crypto/asn1/a_time.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/buf.h>
 #include <openssl/err.h>
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index cb29d4c..7a3f5f6 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/err.h>
 #include <openssl/mem.h>
 #include <openssl/time_support.h>
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index 83816c9..1fc2c06 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -57,6 +57,7 @@
 #include <openssl/asn1.h>
 
 #include <limits.h>
+#include <string.h>
 
 #include <openssl/asn1_mac.h>
 #include <openssl/err.h>
diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c
index faea304..15f233b 100644
--- a/crypto/asn1/bio_asn1.c
+++ b/crypto/asn1/bio_asn1.c
@@ -57,6 +57,7 @@
 #include <openssl/asn1.h>
 
 #include <assert.h>
+#include <string.h>
 
 #include <openssl/bio.h>
 #include <openssl/mem.h>
diff --git a/crypto/asn1/t_bitst.c b/crypto/asn1/t_bitst.c
index cc2c50b..1ca6e08 100644
--- a/crypto/asn1/t_bitst.c
+++ b/crypto/asn1/t_bitst.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/mem.h>
 
 
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index e8c5cd8..4cece89 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/buf.h>
 #include <openssl/err.h>
diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c
index 54f784a..38e14d2 100644
--- a/crypto/asn1/tasn_enc.c
+++ b/crypto/asn1/tasn_enc.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/mem.h>
 
diff --git a/crypto/asn1/tasn_new.c b/crypto/asn1/tasn_new.c
index 8a2b27d..b68eed7 100644
--- a/crypto/asn1/tasn_new.c
+++ b/crypto/asn1/tasn_new.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/err.h>
 #include <openssl/mem.h>
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c
index 250975a..f6045e4 100644
--- a/crypto/asn1/tasn_utl.c
+++ b/crypto/asn1/tasn_utl.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/mem.h>
 #include <openssl/obj.h>
diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c
index a3f80ab..5c2f96e 100644
--- a/crypto/asn1/x_long.c
+++ b/crypto/asn1/x_long.c
@@ -56,6 +56,8 @@
 
 #include <openssl/asn1.h>
 
+#include <string.h>
+
 #include <openssl/asn1t.h>
 #include <openssl/bn.h>
 #include <openssl/err.h>