Rename to mbed TLS in the documentation/comments
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 0ecf363..4a5ce22 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -119,7 +119,7 @@
  *
  * Enable the memory allocation layer.
  *
- * By default PolarSSL uses the system-provided malloc() and free().
+ * By default mbed TLS uses the system-provided malloc() and free().
  * This allows different allocators (self-implemented or provided) to be
  * provided to the platform abstraction layer.
  *
@@ -153,10 +153,10 @@
 /**
  * \def POLARSSL_PLATFORM_XXX_ALT
  *
- * Uncomment a macro to let PolarSSL support the function in the platform
+ * Uncomment a macro to let mbed TLS support the function in the platform
  * abstraction layer.
  *
- * Example: In case you uncomment POLARSSL_PLATFORM_PRINTF_ALT, PolarSSL will
+ * Example: In case you uncomment POLARSSL_PLATFORM_PRINTF_ALT, mbed TLS will
  * provide a function "platform_set_printf()" that allows you to set an
  * alternative printf function pointer.
  *
@@ -170,7 +170,7 @@
 /* \} name SECTION: System support */
 
 /**
- * \name SECTION: PolarSSL feature support
+ * \name SECTION: mbed TLS feature support
  *
  * This section sets support for features that are or are not needed
  * within the modules that are enabled.
@@ -193,12 +193,12 @@
 /**
  * \def POLARSSL_XXX_ALT
  *
- * Uncomment a macro to let PolarSSL use your alternate core implementation of
+ * Uncomment a macro to let mbed TLS use your alternate core implementation of
  * a symmetric or hash algorithm (e.g. platform specific assembly optimized
  * implementations). Keep in mind that the function prototypes should remain
  * the same.
  *
- * Example: In case you uncomment POLARSSL_AES_ALT, PolarSSL will no longer
+ * Example: In case you uncomment POLARSSL_AES_ALT, mbed TLS will no longer
  * provide the "struct aes_context" definition and omit the base function
  * declarations and implementations. "aes_alt.h" will be included from
  * "aes.h" to include the new function definitions.
@@ -797,7 +797,7 @@
  * \def POLARSSL_SSL_ALL_ALERT_MESSAGES
  *
  * Enable sending of alert messages in case of encountered errors as per RFC.
- * If you choose not to send the alert messages, PolarSSL can still communicate
+ * If you choose not to send the alert messages, mbed TLS can still communicate
  * with other servers, only debugging of failures is harder.
  *
  * The advantage of not sending alert messages, is that no information is given
@@ -1158,12 +1158,12 @@
  * Uncomment to enable use of ZLIB
  */
 //#define POLARSSL_ZLIB_SUPPORT
-/* \} name SECTION: PolarSSL feature support */
+/* \} name SECTION: mbed TLS feature support */
 
 /**
- * \name SECTION: PolarSSL modules
+ * \name SECTION: mbed TLS modules
  *
- * This section enables or disables entire modules in PolarSSL
+ * This section enables or disables entire modules in mbed TLS
  * \{
  */
 
@@ -1695,7 +1695,7 @@
  * Module:  library/memory_buffer_alloc.c
  *
  * Requires: POLARSSL_PLATFORM_C
- *           POLARSSL_PLATFORM_MEMORY (to use it within PolarSSL)
+ *           POLARSSL_PLATFORM_MEMORY (to use it within mbed TLS)
  *
  * Enable this module to enable the buffer memory allocator.
  */
@@ -2038,7 +2038,7 @@
  * \def POLARSSL_THREADING_C
  *
  * Enable the threading abstraction layer.
- * By default PolarSSL assumes it is used in a non-threaded environment or that
+ * By default mbed TLS assumes it is used in a non-threaded environment or that
  * contexts are not shared between threads. If you do intend to use contexts
  * between threads, you will need to enable this layer to prevent race
  * conditions.
@@ -2051,7 +2051,7 @@
  * You will have to enable either POLARSSL_THREADING_ALT or
  * POLARSSL_THREADING_PTHREAD.
  *
- * Enable this layer to allow use of mutexes within PolarSSL
+ * Enable this layer to allow use of mutexes within mbed TLS
  */
 //#define POLARSSL_THREADING_C
 
@@ -2188,7 +2188,7 @@
  */
 #define POLARSSL_XTEA_C
 
-/* \} name SECTION: PolarSSL modules */
+/* \} name SECTION: mbed TLS modules */
 
 /**
  * \name SECTION: Module configuration options
diff --git a/include/polarssl/error.h b/include/polarssl/error.h
index e032cda..f9f41f1 100644
--- a/include/polarssl/error.h
+++ b/include/polarssl/error.h
@@ -102,7 +102,7 @@
 #endif
 
 /**
- * \brief Translate a PolarSSL error code into a string representation,
+ * \brief Translate a mbed TLS error code into a string representation,
  *        Result is truncated if necessary and always includes a terminating
  *        null byte.
  *
diff --git a/include/polarssl/pbkdf2.h b/include/polarssl/pbkdf2.h
index 417f988..ecc6433 100644
--- a/include/polarssl/pbkdf2.h
+++ b/include/polarssl/pbkdf2.h
@@ -60,7 +60,7 @@
  * \param key_length            Length of generated key
  * \param output   Generated key. Must be at least as big as key_length
  *
- * \returns        0 on success, or a PolarSSL error code if verification fails.
+ * \returns        0 on success, or a POLARSSL_ERR_xxx code if verification fails.
  */
 int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
                  size_t plen, const unsigned char *salt, size_t slen,
diff --git a/include/polarssl/pkcs11.h b/include/polarssl/pkcs11.h
index 7e70c7d..e84550f 100644
--- a/include/polarssl/pkcs11.h
+++ b/include/polarssl/pkcs11.h
@@ -62,7 +62,7 @@
 } pkcs11_context;
 
 /**
- * Fill in a PolarSSL certificate, based on the given PKCS11 helper certificate.
+ * Fill in a mbed TLS certificate, based on the given PKCS11 helper certificate.
  *
  * \param cert          X.509 certificate to fill
  * \param pkcs11h_cert  PKCS #11 helper certificate
diff --git a/include/polarssl/pkcs12.h b/include/polarssl/pkcs12.h
index afb5975..ba5089e 100644
--- a/include/polarssl/pkcs12.h
+++ b/include/polarssl/pkcs12.h
@@ -61,7 +61,7 @@
  * \param len        data length
  * \param output     the output buffer
  *
- * \return           0 if successful, or a PolarSSL error code
+ * \return           0 if successful, or a POLARSSL_ERR_xxx code
  */
 int pkcs12_pbe_sha1_rc4_128( asn1_buf *pbe_params, int mode,
                              const unsigned char *pwd,  size_t pwdlen,
@@ -82,7 +82,7 @@
  * \param len        data length
  * \param output     the output buffer
  *
- * \return           0 if successful, or a PolarSSL error code
+ * \return           0 if successful, or a POLARSSL_ERR_xxx code
  */
 int pkcs12_pbe( asn1_buf *pbe_params, int mode,
                 cipher_type_t cipher_type, md_type_t md_type,
diff --git a/include/polarssl/pkcs5.h b/include/polarssl/pkcs5.h
index e85452f..1475907 100644
--- a/include/polarssl/pkcs5.h
+++ b/include/polarssl/pkcs5.h
@@ -64,7 +64,7 @@
  * \param datalen    length of data
  * \param output     output buffer
  *
- * \returns        0 on success, or a PolarSSL error code if verification fails.
+ * \returns        0 on success, or a POLARSSL_ERR_xxx code if verification fails.
  */
 int pkcs5_pbes2( asn1_buf *pbe_params, int mode,
                  const unsigned char *pwd,  size_t pwdlen,
@@ -83,7 +83,7 @@
  * \param key_length            Length of generated key
  * \param output   Generated key. Must be at least as big as key_length
  *
- * \returns        0 on success, or a PolarSSL error code if verification fails.
+ * \returns        0 on success, or a POLARSSL_ERR_xxx code if verification fails.
  */
 int pkcs5_pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
                        size_t plen, const unsigned char *salt, size_t slen,
diff --git a/include/polarssl/platform.h b/include/polarssl/platform.h
index b381e1b..c272da1 100644
--- a/include/polarssl/platform.h
+++ b/include/polarssl/platform.h
@@ -1,7 +1,7 @@
 /**
  * \file platform.h
  *
- * \brief PolarSSL Platform abstraction layer
+ * \brief mbed TLS Platform abstraction layer
  *
  *  Copyright (C) 2006-2014, Brainspark B.V.
  *
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index 1ea84ed..1d98f4e 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -1157,8 +1157,8 @@
  *                      order. First in the list has the highest preference.
  *                      (Overrides all version specific lists)
  *
- *                      Note: The PolarSSL SSL server uses its own preferences
- *                      over the preference of the connection SSL client unless
+ *                      Note: The server uses its own preferences
+ *                      over the preference of the client unless
  *                      POLARSSL_SSL_SRV_RESPECT_CLIENT_PREFERENCE is defined!
  *
  * \param ssl           SSL context
@@ -1238,7 +1238,7 @@
 #endif /* POLARSSL_RSA_C */
 
 /**
- * \brief          Set own certificate and alternate non-PolarSSL RSA private
+ * \brief          Set own certificate and external RSA private
  *                 key and handling callbacks, such as the PKCS#11 wrappers
  *                 or any other external private key handler.
  *                 (see the respective RSA functions in rsa.h for documentation
diff --git a/include/polarssl/ssl_ciphersuites.h b/include/polarssl/ssl_ciphersuites.h
index c991e8b..256403b 100644
--- a/include/polarssl/ssl_ciphersuites.h
+++ b/include/polarssl/ssl_ciphersuites.h
@@ -1,7 +1,7 @@
 /**
  * \file ssl_ciphersuites.h
  *
- * \brief SSL Ciphersuites for PolarSSL
+ * \brief SSL Ciphersuites for mbed TLS
  *
  *  Copyright (C) 2006-2013, Brainspark B.V.
  *
diff --git a/include/polarssl/version.h b/include/polarssl/version.h
index 7b78ae4..d40063a 100644
--- a/include/polarssl/version.h
+++ b/include/polarssl/version.h
@@ -26,7 +26,7 @@
  */
 /*
  * This set of compile-time defines and run-time variables can be used to
- * determine the version number of the PolarSSL library used.
+ * determine the version number of the mbed TLS library used.
  */
 #ifndef POLARSSL_VERSION_H
 #define POLARSSL_VERSION_H
@@ -52,7 +52,7 @@
  */
 #define POLARSSL_VERSION_NUMBER         0x01030900
 #define POLARSSL_VERSION_STRING         "1.3.9"
-#define POLARSSL_VERSION_STRING_FULL    "PolarSSL 1.3.9"
+#define POLARSSL_VERSION_STRING_FULL    "mbed TLS 1.3.9"
 
 #if defined(POLARSSL_VERSION_C)
 
@@ -77,9 +77,9 @@
 void version_get_string( char *string );
 
 /**
- * Get the full version string ("PolarSSL x.y.z").
+ * Get the full version string ("mbed TLS x.y.z").
  *
- * \param string    The string that will receive the value. The PolarSSL version
+ * \param string    The string that will receive the value. The mbed TLS version
  *                  string will use 18 bytes AT MOST including a terminating
  *                  null byte.
  *                  (So the buffer should be at least 18 bytes to receive this
@@ -89,12 +89,12 @@
 
 /**
  * \brief           Check if support for a feature was compiled into this
- *                  PolarSSL binary. This allows you to see at runtime if the
+ *                  mbed TLS binary. This allows you to see at runtime if the
  *                  library was for instance compiled with or without
  *                  Multi-threading support.
  *
  *                  Note: only checks against defines in the sections "System
- *                        support", "PolarSSL modules" and "PolarSSL feature
+ *                        support", "mbed TLS modules" and "mbed TLS feature
  *                        support" in config.h
  *
  * \param feature   The string for the define to check (e.g. "POLARSSL_AES_C")
diff --git a/include/polarssl/x509_crt.h b/include/polarssl/x509_crt.h
index 456f069..9b027d7 100644
--- a/include/polarssl/x509_crt.h
+++ b/include/polarssl/x509_crt.h
@@ -367,7 +367,7 @@
  * \brief           Set the issuer name for a Certificate
  *                  Issuer names should contain a comma-separated list
  *                  of OID types and values:
- *                  e.g. "C=NL,O=Offspark,CN=PolarSSL CA"
+ *                  e.g. "C=UK,O=ARM,CN=mbed TLS CA"
  *
  * \param ctx           CRT context to use
  * \param issuer_name   issuer name to set
@@ -382,7 +382,7 @@
  * \brief           Set the subject name for a Certificate
  *                  Subject names should contain a comma-separated list
  *                  of OID types and values:
- *                  e.g. "C=NL,O=Offspark,CN=PolarSSL Server 1"
+ *                  e.g. "C=UK,O=ARM,CN=mbed TLS Server 1"
  *
  * \param ctx           CRT context to use
  * \param subject_name  subject name to set
diff --git a/include/polarssl/x509_csr.h b/include/polarssl/x509_csr.h
index b0d4f1e..f6fae55 100644
--- a/include/polarssl/x509_csr.h
+++ b/include/polarssl/x509_csr.h
@@ -164,7 +164,7 @@
  * \brief           Set the subject name for a CSR
  *                  Subject names should contain a comma-separated list
  *                  of OID types and values:
- *                  e.g. "C=NL,O=Offspark,CN=PolarSSL Server 1"
+ *                  e.g. "C=UK,O=ARM,CN=mbed TLS Server 1"
  *
  * \param ctx           CSR context to use
  * \param subject_name  subject name to set