threading.h
mbedtls/private_access.h
mbedtls/build_info.h
stdlib.h
pthread.h
ctr_drbg.h
entropy.h
hmac_drbg.h
rsa.h
ssl_cache.h
ssl_cookie.h
ssl_ticket.h
mbedtls/build_info.h
mbedtls/check_config.h
mbedtls/config_adjust_legacy_crypto.h
mbedtls/config_adjust_psa_from_legacy.h
mbedtls/config_adjust_psa_superset_legacy.h
mbedtls/config_adjust_ssl.h
mbedtls/config_adjust_x509.h
mbedtls/config_psa.h
mbedtls/mbedtls_config.h
mbedtls/private_access.h
threading.h
psa/crypto_adjust_auto_enabled.h
psa/crypto_adjust_config_dependencies.h
psa/crypto_adjust_config_key_pair_types.h
psa/crypto_adjust_config_synonyms.h
psa/crypto_legacy.h
limits.h
pthread.h
stdint.h
stdlib.h
ctr_drbg.h
debug.h
entropy.h
hmac_drbg.h
net_sockets.h
oid.h
pk.h
pkcs7.h
rsa.h
ssl.h
ssl_cache.h
ssl_ciphersuites.h
ssl_cookie.h
ssl_ticket.h
threading.h
x509.h
x509_crl.h
x509_crt.h
x509_csr.h
mbedtls_threading_mutex_t
MBEDTLS_ERR_THREADING_BAD_INPUT_DATA
-0x001C

Bad input parameters to function.

MBEDTLS_ERR_THREADING_MUTEX_ERROR
-0x001E

Locking / unlocking / free failed with error code.

struct mbedtls_threading_mutex_t typedef struct mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_mutex_t
void(* void(* mbedtls_mutex_init) (mbedtls_threading_mutex_t *mutex) )(mbedtls_threading_mutex_t *mutex) mbedtls_mutex_init
void(* void(* mbedtls_mutex_free) (mbedtls_threading_mutex_t *mutex) )(mbedtls_threading_mutex_t *mutex) mbedtls_mutex_free
int(* int(* mbedtls_mutex_lock) (mbedtls_threading_mutex_t *mutex) )(mbedtls_threading_mutex_t *mutex) mbedtls_mutex_lock
int(* int(* mbedtls_mutex_unlock) (mbedtls_threading_mutex_t *mutex) )(mbedtls_threading_mutex_t *mutex) mbedtls_mutex_unlock
mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex mbedtls_threading_readdir_mutex
mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex mbedtls_threading_gmtime_mutex
mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_key_slot_mutex mbedtls_threading_key_slot_mutex
mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_psa_globaldata_mutex mbedtls_threading_psa_globaldata_mutex
mbedtls_threading_mutex_t mbedtls_threading_mutex_t mbedtls_threading_psa_rngdata_mutex mbedtls_threading_psa_rngdata_mutex

Threading abstraction layer.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_THREADING_H
    #defineMBEDTLS_THREADING_H
    #include"mbedtls/private_access.h"

    #include"mbedtls/build_info.h"

    #include<stdlib.h>

    #ifdef__cplusplus
    extern"C"{
    #endif

    #defineMBEDTLS_ERR_THREADING_BAD_INPUT_DATA-0x001C
    #defineMBEDTLS_ERR_THREADING_MUTEX_ERROR-0x001E

    #ifdefined(MBEDTLS_THREADING_PTHREAD)
    #include<pthread.h>
    typedefstructmbedtls_threading_mutex_t{
    pthread_mutex_tMBEDTLS_PRIVATE(mutex);

    /*WARNING-stateshouldonlybeaccessedwhenholdingthemutexlockin
    *tests/src/threading_helpers.c,otherwisecorruptioncanoccur.
    *statewillbe0afterafailedinitorafree,andnonzeroaftera
    *successfulinit.Thisfieldisfortestingonlyandthusnotconsidered
    *partofthepublicAPIofMbedTLSandmaychangewithoutnotice.*/
    charMBEDTLS_PRIVATE(state);

    }mbedtls_threading_mutex_t;
    #endif

    #ifdefined(MBEDTLS_THREADING_ALT)
    /*Youshoulddefinethembedtls_threading_mutex_ttypeinyourheader*/
    #include"threading_alt.h"

    voidmbedtls_threading_set_alt(void(*mutex_init)(mbedtls_threading_mutex_t*),
    void(*mutex_free)(mbedtls_threading_mutex_t*),
    int(*mutex_lock)(mbedtls_threading_mutex_t*),
    int(*mutex_unlock)(mbedtls_threading_mutex_t*));

    voidmbedtls_threading_free_alt(void);
    #endif/*MBEDTLS_THREADING_ALT*/

    #ifdefined(MBEDTLS_THREADING_C)
    /*
    *Thefunctionpointersformutex_init,mutex_free,mutex_andmutex_unlock
    *
    *Allthesefunctionsareexpectedtoworkortheresultwillbeundefined.
    */
    externvoid(*mbedtls_mutex_init)(mbedtls_threading_mutex_t*mutex);
    externvoid(*mbedtls_mutex_free)(mbedtls_threading_mutex_t*mutex);
    externint(*mbedtls_mutex_lock)(mbedtls_threading_mutex_t*mutex);
    externint(*mbedtls_mutex_unlock)(mbedtls_threading_mutex_t*mutex);

    /*
    *Globalmutexes
    */
    #ifdefined(MBEDTLS_FS_IO)
    externmbedtls_threading_mutex_tmbedtls_threading_readdir_mutex;
    #endif

    #ifdefined(MBEDTLS_HAVE_TIME_DATE)&&!defined(MBEDTLS_PLATFORM_GMTIME_R_ALT)
    /*Thismutexmayormaynotbeusedinthedefaultdefinitionof
    *mbedtls_platform_gmtime_r(),butinordertodeterminethat,
    *weneedtocheckPOSIXfeatures,hencemodify_POSIX_C_SOURCE.
    *Withthecurrentapproach,thisdeclarationisorphaned,lacking
    *anaccompanyingdefinition,incasembedtls_platform_gmtime_r()
    *doesn'tneedit,butthat'snotaproblem.*/
    externmbedtls_threading_mutex_tmbedtls_threading_gmtime_mutex;
    #endif/*MBEDTLS_HAVE_TIME_DATE&&!MBEDTLS_PLATFORM_GMTIME_R_ALT*/

    #ifdefined(MBEDTLS_PSA_CRYPTO_C)
    /*
    *AmutexusedtomakethePSAsubsystemthreadsafe.
    *
    *key_slot_mutexprotectstheregistered_readersand
    *statevariableforallkeyslotsin&global_data.key_slots.
    *
    *Thismutexmustbeheldwhenanyreadfromorwritetoastateor
    *registered_readersfieldisperformed,i.e.whencallingfunctions:
    *psa_key_slot_state_transition(),psa_register_read(),psa_unregister_read(),
    *psa_key_slot_has_readers()andpsa_wipe_key_slot().*/
    externmbedtls_threading_mutex_tmbedtls_threading_key_slot_mutex;

    /*
    *Amutexusedtomakethenon-rngPSAglobal_datastructmembersthreadsafe.
    *
    *ThismutexmustbeheldwhenreadingorwritingtoanyofthePSAglobal_data
    *structuremembers,otherthantherng_stateorrngstruct.*/
    externmbedtls_threading_mutex_tmbedtls_threading_psa_globaldata_mutex;

    /*
    *AmutexusedtomakethePSAglobal_datarngdatathreadsafe.
    *
    *ThismutexmustbeheldwhenreadingorwritingtothePSA
    *global_datarng_stateorrngstructmembers.*/
    externmbedtls_threading_mutex_tmbedtls_threading_psa_rngdata_mutex;
    #endif

    #endif/*MBEDTLS_THREADING_C*/

    #ifdef__cplusplus
    }
    #endif

    #endif/*threading.h*/