Move internal mbedtls_x509_crt_cache to x509_internal.h

We cannot move it to x509_crt.c because there are some static inline
function definitions in x509_crt.h which access members of
mbedtls_x509_crt_cache.
diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h
index b3570be..26f3a62 100644
--- a/include/mbedtls/x509_crt.h
+++ b/include/mbedtls/x509_crt.h
@@ -32,7 +32,7 @@
 
 #include "x509.h"
 #include "x509_crl.h"
-#include "threading.h"
+#include "x509_internal.h"
 
 /**
  * \addtogroup x509_module
@@ -97,22 +97,6 @@
 
 } mbedtls_x509_crt_frame;
 
-/* This is an internal structure used for caching parsed data from an X.509 CRT.
- *
- * This structure may change at any time, and it is discouraged
- * to access it directly.
- */
-typedef struct mbedtls_x509_crt_cache
-{
-#if defined(MBEDTLS_THREADING_C)
-    mbedtls_threading_mutex_t frame_mutex;
-    mbedtls_threading_mutex_t pk_mutex;
-#endif
-    mbedtls_x509_buf_raw pk_raw;
-    mbedtls_x509_crt_frame *frame;
-    mbedtls_pk_context *pk;
-} mbedtls_x509_crt_cache;
-
 /**
  * Container for an X.509 certificate. The certificate may be chained.
  */
@@ -121,7 +105,7 @@
     int own_buffer;                     /**< Indicates if \c raw is owned
                                          *   by the structure or not.         */
     mbedtls_x509_buf raw;               /**< The raw certificate data (DER).  */
-    mbedtls_x509_crt_cache *cache;      /**< Internal parsing cache.          */
+    mbedtls_x509_crt_cache *cache;      /**< Internal parsing cache.      */
 
     struct mbedtls_x509_crt *next;     /**< Next certificate in the CA-chain. */
 
diff --git a/include/mbedtls/x509_internal.h b/include/mbedtls/x509_internal.h
index 6fc6fe6..30f4288 100644
--- a/include/mbedtls/x509_internal.h
+++ b/include/mbedtls/x509_internal.h
@@ -26,6 +26,23 @@
 #define MBEDTLS_X509_INTERNAL_H
 
 #include "x509.h"
+#include "threading.h"
+
+/* Internal structure used for caching parsed data from an X.509 CRT. */
+
+struct mbedtls_x509_crt;
+struct mbedtls_pk_context;
+struct mbedtls_x509_crt_frame;
+typedef struct mbedtls_x509_crt_cache
+{
+#if defined(MBEDTLS_THREADING_C)
+    mbedtls_threading_mutex_t frame_mutex;
+    mbedtls_threading_mutex_t pk_mutex;
+#endif
+    mbedtls_x509_buf_raw pk_raw;
+    struct mbedtls_x509_crt_frame *frame;
+    struct mbedtls_pk_context *pk;
+} mbedtls_x509_crt_cache;
 
 int mbedtls_x509_get_name( unsigned char *p, size_t len,
                            mbedtls_x509_name *cur );