Add visibility rules.

This change marks public symbols as dynamically exported. This means
that it becomes viable to build a shared library of libcrypto and libssl
with -fvisibility=hidden.

On Windows, one not only needs to mark functions for export in a
component, but also for import when using them from a different
component. Because of this we have to build with
|BORINGSSL_IMPLEMENTATION| defined when building the code. Other
components, when including our headers, won't have that defined and then
the |OPENSSL_EXPORT| tag becomes an import tag instead. See the #defines
in base.h

In the asm code, symbols are now hidden by default and those that need
to be exported are wrapped by a C function.

In order to support Chromium, a couple of libssl functions were moved to
ssl.h from ssl_locl.h: ssl_get_new_session and ssl_update_cache.

Change-Id: Ib4b76e2f1983ee066e7806c24721e8626d08a261
Reviewed-on: https://boringssl-review.googlesource.com/1350
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/md5.h b/include/openssl/md5.h
index 7a1a00f..dc800c0 100644
--- a/include/openssl/md5.h
+++ b/include/openssl/md5.h
@@ -73,23 +73,23 @@
 #define MD5_DIGEST_LENGTH 16
 
 /* MD51_Init initialises |md5| and returns 1. */
-int MD5_Init(MD5_CTX *md5);
+OPENSSL_EXPORT int MD5_Init(MD5_CTX *md5);
 
 /* MD5_Update adds |len| bytes from |data| to |md5| and returns one. */
-int MD5_Update(MD5_CTX *md5, const void *data, size_t len);
+OPENSSL_EXPORT int MD5_Update(MD5_CTX *md5, const void *data, size_t len);
 
 /* MD5_Final adds the final padding to |md5| and writes the resulting digest to
  * |md|, which must have at least |MD5_DIGEST_LENGTH| bytes of space. It
  * returns one. */
-int MD5_Final(uint8_t *md, MD5_CTX *md5);
+OPENSSL_EXPORT int MD5_Final(uint8_t *md, MD5_CTX *md5);
 
 /* MD5 writes the digest of |len| bytes from |data| to |out| and returns |out|.
  * There must be at least |MD5_DIGEST_LENGTH| bytes of space in |out|. */
-uint8_t *MD5(const uint8_t *data, size_t len, uint8_t *out);
+OPENSSL_EXPORT uint8_t *MD5(const uint8_t *data, size_t len, uint8_t *out);
 
 /* MD5_Transform is a low-level function that performs a single, MD5 block
  * transformation using the state from |md5| and 64 bytes from |block|. */
-void MD5_Transform(MD5_CTX *md5, const uint8_t *block);
+OPENSSL_EXPORT void MD5_Transform(MD5_CTX *md5, const uint8_t *block);
 
 struct md5_state_st {
   uint32_t A, B, C, D;