From 4edcf48e05fe7e9c1927507f7e0198f8bda3218f Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 17 Aug 2021 14:49:19 -0700 Subject: [PATCH] sockets: tls: Enable access to mbedtls private fields Several fields of structures in mbedTLS 3.0 are now private. To access them directly is necessary to define MBEDTLS_ALLOW_PRIVATE_ACCESS. That is a temporary fix, the proper solution is not access directly but using proper API. Signed-off-by: Flavio Ceolin --- subsys/net/lib/sockets/sockets_tls.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/subsys/net/lib/sockets/sockets_tls.c b/subsys/net/lib/sockets/sockets_tls.c index 65e95cc24ca..4564e603d0d 100644 --- a/subsys/net/lib/sockets/sockets_tls.c +++ b/subsys/net/lib/sockets/sockets_tls.c @@ -18,6 +18,20 @@ LOG_MODULE_REGISTER(net_sock_tls, CONFIG_NET_SOCKETS_LOG_LEVEL); #include #include +/* TODO: Remove all direct access to private fields. + * According with Mbed TLS migration guide: + * + * Direct access to fields of structures + * (`struct` types) declared in public headers is no longer + * supported. In Mbed TLS 3, the layout of structures is not + * considered part of the stable API, and minor versions (3.1, 3.2, + * etc.) may add, remove, rename, reorder or change the type of + * structure fields. + */ +#if !defined(MBEDTLS_ALLOW_PRIVATE_ACCESS) +#define MBEDTLS_ALLOW_PRIVATE_ACCESS +#endif + #if defined(CONFIG_MBEDTLS) #if !defined(CONFIG_MBEDTLS_CFG_FILE) #include "mbedtls/config.h"