From 00d390338d54cfb4509cab3c64af5d21e94a097d Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 13 May 2019 12:39:44 +0100 Subject: [PATCH] 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. --- include/mbedtls/x509_crt.h | 20 ++------------------ include/mbedtls/x509_internal.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h index b3570be58..26f3a622c 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 @@ typedef struct mbedtls_x509_crt_frame } 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 @@ typedef struct mbedtls_x509_crt 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 6fc6fe6f1..30f428854 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 );