sys_mbedtls.h

Include dependency graph for sys_mbedtls.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="mbedtls/ctr_drbg.h" tooltip="mbedtls/ctr_drbg.h"]
    "3" [label="mbedtls/entropy.h" tooltip="mbedtls/entropy.h"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys_mbedtls.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys_mbedtls.h" fillcolor="#BFBFBF"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include sys_mbedtls.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys_mbedtls.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys_mbedtls.h" fillcolor="#BFBFBF"]
    "1" -> "2" [dir=back tooltip="include"]
}

Functions

mbedtls_entropy_context *sys_mbedtls_get_entropy_context_lock(GlobalContext *global)

get and acquire lock on mbedtls_entropy_context.

this function must be called from a scheduler thread (nif, native handler, listener) to access the entropy context and should be balanced by sys_mbedtls_entropy_context_unlock. On non-SMP builds, there is no lock as there is only one scheduler.

Parameters:
  • global – the global context

void sys_mbedtls_entropy_context_unlock(GlobalContext *global)

release lock on mbedtls_entropy_context.

Parameters:
  • global – the global context

int sys_mbedtls_entropy_func(void *entropy, unsigned char *buf, size_t size)

invoke mbedtls_entropy_func

unless MBEDTLS_THREADING_C is defined, this function must acquire the entropy mutex to call mbedtls_entropy_func.

mbedtls_ctr_drbg_context *sys_mbedtls_get_ctr_drbg_context_lock(GlobalContext *global)

get and acquire lock on mbedtls_ctr_drbg_context.

this function must be called from a scheduler thread (nif, native handler, listener) to access the random context and should be balanced by sys_mbedtls_ctr_drbg_context_unlock. On non-SMP builds, there is no lock as there is only one scheduler.

Warning

do not call this function when already owning the entropy context

void sys_mbedtls_ctr_drbg_context_unlock(GlobalContext *global)

release lock on mbedtls_ctr_drbg_context.

Parameters:
  • global – the global context