extmod/modtls_mbedtls: Add a thread-global ptr for current SSL context.

This is necessary for mbedTLS callbacks that do not carry any user state,
so those callbacks can be customised per SSL context.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader
2024-10-16 14:08:43 +02:00
committed by Damien George
parent 09ea901317
commit 2644f577f1
3 changed files with 28 additions and 0 deletions

View File

@@ -1814,6 +1814,11 @@ typedef double mp_float_t;
#define MICROPY_PY_SSL_FINALISER (MICROPY_ENABLE_FINALISER)
#endif
// Whether to add a root pointer for the current ssl object
#ifndef MICROPY_PY_SSL_MBEDTLS_NEED_ACTIVE_CONTEXT
#define MICROPY_PY_SSL_MBEDTLS_NEED_ACTIVE_CONTEXT (MICROPY_PY_SSL_ECDSA_SIGN_ALT)
#endif
// Whether to provide the "vfs" module
#ifndef MICROPY_PY_VFS
#define MICROPY_PY_VFS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES && MICROPY_VFS)

View File

@@ -293,6 +293,10 @@ typedef struct _mp_state_thread_t {
bool prof_callback_is_executing;
struct _mp_code_state_t *current_code_state;
#endif
#if MICROPY_PY_SSL_MBEDTLS_NEED_ACTIVE_CONTEXT
struct _mp_obj_ssl_context_t *tls_ssl_context;
#endif
} mp_state_thread_t;
// This structure combines the above 3 structures.