Avoid bitfields
Bitfields in context structures do not have sufficient (if any) RAM
payoff for the ROM complexity to manipulate them. Replace with
plain uint8_t.
On the smallest targets, the configuration options mean that there
are 4 or fewer members anyway, so a bitfield saves no RAM compared
to uint8_t.
ROM saving will be further increased if the uint8_t members are at the
start of the structure (when compiling for Thumb).
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h
index ea60ef3..2da4f65 100644
--- a/include/mbedtls/ssl_internal.h
+++ b/include/mbedtls/ssl_internal.h
@@ -518,9 +518,9 @@
struct mbedtls_ssl_hs_buffer
{
- unsigned is_valid : 1;
- unsigned is_fragmented : 1;
- unsigned is_complete : 1;
+ uint8_t is_valid;
+ uint8_t is_fragmented;
+ uint8_t is_complete;
unsigned char *data;
size_t data_len;
} hs[MBEDTLS_SSL_MAX_BUFFERED_HS];
@@ -559,7 +559,7 @@
#endif
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
- unsigned int async_in_progress : 1; /*!< an asynchronous operation is in progress */
+ uint8_t async_in_progress; /*!< an asynchronous operation is in progress */
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)