Move up to mbed TLS 2.x

The mbed TLS library has introduced some changes in the API from
the 1.3.x to the 2.x releases. Using the 2.x releases requires
some changes to the crypto and transport modules.

This patch updates both modules to the mbed TLS 2.x API.

All references to the mbed TLS library in the code or documentation
have been updated to 'mbed TLS'. Old references to PolarSSL have
been updated to 'mbed TLS'.

User guide updated to use mbed TLS 2.2.0.

NOTE: moving up to mbed TLS 2.x from 1.3.x is not backward compatible.
Applying this patch will require an mbed TLS 2.x release to be used.
Also note that the mbed TLS license changed to Apache version 2.0.

Change-Id: Iba4584408653cf153091f2ca2ee23bc9add7fda4
diff --git a/include/drivers/auth/mbedtls/mbedtls_config.h b/include/drivers/auth/mbedtls/mbedtls_config.h
index 8a000f0..a8d7241 100644
--- a/include/drivers/auth/mbedtls/mbedtls_config.h
+++ b/include/drivers/auth/mbedtls/mbedtls_config.h
@@ -31,69 +31,69 @@
 #define __MBEDTLS_CONFIG_H__
 
 /*
- * Key algorithms currently supported on mbedTLS libraries
+ * Key algorithms currently supported on mbed TLS libraries
  */
 #define MBEDTLS_RSA			1
 #define MBEDTLS_ECDSA			2
 
 /*
- * Configuration file to build PolarSSL with the required features for
+ * Configuration file to build mbed TLS with the required features for
  * Trusted Boot
  */
 
-#define POLARSSL_PLATFORM_MEMORY
-#define POLARSSL_PLATFORM_NO_STD_FUNCTIONS
+#define MBEDTLS_PLATFORM_MEMORY
+#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
 
-#define POLARSSL_PKCS1_V15
-#define POLARSSL_PKCS1_V21
+#define MBEDTLS_PKCS1_V15
+#define MBEDTLS_PKCS1_V21
 
-#define POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
-#define POLARSSL_X509_CHECK_KEY_USAGE
-#define POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE
+#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
+#define MBEDTLS_X509_CHECK_KEY_USAGE
+#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
 
-#define POLARSSL_ASN1_PARSE_C
-#define POLARSSL_ASN1_WRITE_C
+#define MBEDTLS_ASN1_PARSE_C
+#define MBEDTLS_ASN1_WRITE_C
 
-#define POLARSSL_BASE64_C
-#define POLARSSL_BIGNUM_C
+#define MBEDTLS_BASE64_C
+#define MBEDTLS_BIGNUM_C
 
-#define POLARSSL_ERROR_C
-#define POLARSSL_MD_C
+#define MBEDTLS_ERROR_C
+#define MBEDTLS_MD_C
 
-#define POLARSSL_MEMORY_BUFFER_ALLOC_C
-#define POLARSSL_OID_C
+#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
+#define MBEDTLS_OID_C
 
-#define POLARSSL_PK_C
-#define POLARSSL_PK_PARSE_C
-#define POLARSSL_PK_WRITE_C
+#define MBEDTLS_PK_C
+#define MBEDTLS_PK_PARSE_C
+#define MBEDTLS_PK_WRITE_C
 
-#define POLARSSL_PLATFORM_C
+#define MBEDTLS_PLATFORM_C
 
 #if (MBEDTLS_KEY_ALG_ID == MBEDTLS_ECDSA)
-#define POLARSSL_ECDSA_C
-#define POLARSSL_ECP_C
-#define POLARSSL_ECP_DP_SECP256R1_ENABLED
+#define MBEDTLS_ECDSA_C
+#define MBEDTLS_ECP_C
+#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
 #elif (MBEDTLS_KEY_ALG_ID == MBEDTLS_RSA)
-#define POLARSSL_RSA_C
+#define MBEDTLS_RSA_C
 #endif
 
-#define POLARSSL_SHA256_C
+#define MBEDTLS_SHA256_C
 
-#define POLARSSL_VERSION_C
+#define MBEDTLS_VERSION_C
 
-#define POLARSSL_X509_USE_C
-#define POLARSSL_X509_CRT_PARSE_C
+#define MBEDTLS_X509_USE_C
+#define MBEDTLS_X509_CRT_PARSE_C
 
 /* MPI / BIGNUM options */
-#define POLARSSL_MPI_WINDOW_SIZE              2
-#define POLARSSL_MPI_MAX_SIZE               256
+#define MBEDTLS_MPI_WINDOW_SIZE              2
+#define MBEDTLS_MPI_MAX_SIZE               256
 
 /* Memory buffer allocator options */
-#define POLARSSL_MEMORY_ALIGN_MULTIPLE        8
+#define MBEDTLS_MEMORY_ALIGN_MULTIPLE        8
 
-#include "polarssl/check_config.h"
+#include "mbedtls/check_config.h"
 
-/* System headers required to build mbedTLS with the current configuration */
+/* System headers required to build mbed TLS with the current configuration */
 #include <stdlib.h>
 
 #endif /* __MBEDTLS_CONFIG_H__ */