otp_ssl.c

Include dependency graph for otp_ssl.c:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "13" [label="stdbool.h" tooltip="stdbool.h"]
    "14" [label="stdatomic.h" tooltip="stdatomic.h"]
    "5" [label="atom.h" tooltip="atom.h"]
    "39" [label="trace.h" tooltip="trace.h"]
    "15" [label="synclist.h" tooltip="synclist.h"]
    "26" [label="defaultatoms.h" tooltip="defaultatoms.h"]
    "4" [label="stdint.h" tooltip="stdint.h"]
    "6" [label="stdlib.h" tooltip="stdlib.h"]
    "28" [label="inet.h" tooltip="inet.h"]
    "31" [label="exportedfunction.h" tooltip="exportedfunction.h"]
    "36" [label="mbedtls/ctr_drbg.h" tooltip="mbedtls/ctr_drbg.h"]
    "2" [label="context.h" tooltip="context.h"]
    "35" [label="port.h" tooltip="port.h"]
    "20" [label="utils.h" tooltip="utils.h"]
    "8" [label="term_typedef.h" tooltip="term_typedef.h"]
    "21" [label="stddef.h" tooltip="stddef.h"]
    "37" [label="mbedtls/entropy.h" tooltip="mbedtls/entropy.h"]
    "9" [label="limits.h" tooltip="limits.h"]
    "33" [label="otp_socket_platform.h" tooltip="otp_socket_platform.h"]
    "22" [label="refc_binary.h" tooltip="refc_binary.h"]
    "18" [label="string.h" tooltip="string.h"]
    "25" [label="mailbox.h" tooltip="mailbox.h"]
    "17" [label="term.h" tooltip="term.h"]
    "7" [label="erl_nif.h" tooltip="erl_nif.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" fillcolor="#BFBFBF"]
    "29" [label="interop.h" tooltip="interop.h"]
    "34" [label="otp_ssl.h" tooltip="otp_ssl.h"]
    "38" [label="mbedtls/ssl.h" tooltip="mbedtls/ssl.h"]
    "23" [label="resources.h" tooltip="resources.h"]
    "12" [label="smp.h" tooltip="smp.h"]
    "27" [label="erl_nif_priv.h" tooltip="erl_nif_priv.h"]
    "30" [label="nifs.h" tooltip="nifs.h"]
    "3" [label="globalcontext.h" tooltip="globalcontext.h"]
    "19" [label="memory.h" tooltip="memory.h"]
    "32" [label="otp_socket.h" tooltip="otp_socket.h"]
    "16" [label="stdio.h" tooltip="stdio.h"]
    "24" [label="timer_list.h" tooltip="timer_list.h"]
    "11" [label="list.h" tooltip="list.h"]
    "10" [label="inttypes.h" tooltip="inttypes.h"]
    "5" -> "4" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "15" -> "11" [dir=forward tooltip="include"]
    "15" -> "16" [dir=forward tooltip="include"]
    "15" -> "12" [dir=forward tooltip="include"]
    "26" -> "3" [dir=forward tooltip="include"]
    "28" -> "29" [dir=forward tooltip="include"]
    "28" -> "19" [dir=forward tooltip="include"]
    "31" -> "17" [dir=forward tooltip="include"]
    "2" -> "3" [dir=forward tooltip="include"]
    "2" -> "11" [dir=forward tooltip="include"]
    "2" -> "25" [dir=forward tooltip="include"]
    "2" -> "12" [dir=forward tooltip="include"]
    "2" -> "17" [dir=forward tooltip="include"]
    "2" -> "24" [dir=forward tooltip="include"]
    "35" -> "2" [dir=forward tooltip="include"]
    "35" -> "26" [dir=forward tooltip="include"]
    "35" -> "3" [dir=forward tooltip="include"]
    "35" -> "19" [dir=forward tooltip="include"]
    "35" -> "17" [dir=forward tooltip="include"]
    "20" -> "21" [dir=forward tooltip="include"]
    "8" -> "9" [dir=forward tooltip="include"]
    "8" -> "10" [dir=forward tooltip="include"]
    "8" -> "4" [dir=forward tooltip="include"]
    "22" -> "13" [dir=forward tooltip="include"]
    "22" -> "6" [dir=forward tooltip="include"]
    "22" -> "11" [dir=forward tooltip="include"]
    "22" -> "23" [dir=forward tooltip="include"]
    "22" -> "12" [dir=forward tooltip="include"]
    "25" -> "13" [dir=forward tooltip="include"]
    "25" -> "11" [dir=forward tooltip="include"]
    "25" -> "12" [dir=forward tooltip="include"]
    "25" -> "8" [dir=forward tooltip="include"]
    "25" -> "20" [dir=forward tooltip="include"]
    "17" -> "13" [dir=forward tooltip="include"]
    "17" -> "4" [dir=forward tooltip="include"]
    "17" -> "16" [dir=forward tooltip="include"]
    "17" -> "6" [dir=forward tooltip="include"]
    "17" -> "18" [dir=forward tooltip="include"]
    "17" -> "19" [dir=forward tooltip="include"]
    "17" -> "22" [dir=forward tooltip="include"]
    "17" -> "20" [dir=forward tooltip="include"]
    "17" -> "8" [dir=forward tooltip="include"]
    "7" -> "8" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "26" [dir=forward tooltip="include"]
    "1" -> "7" [dir=forward tooltip="include"]
    "1" -> "27" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "28" [dir=forward tooltip="include"]
    "1" -> "29" [dir=forward tooltip="include"]
    "1" -> "30" [dir=forward tooltip="include"]
    "1" -> "32" [dir=forward tooltip="include"]
    "1" -> "34" [dir=forward tooltip="include"]
    "1" -> "35" [dir=forward tooltip="include"]
    "1" -> "22" [dir=forward tooltip="include"]
    "1" -> "17" [dir=forward tooltip="include"]
    "1" -> "8" [dir=forward tooltip="include"]
    "1" -> "18" [dir=forward tooltip="include"]
    "1" -> "36" [dir=forward tooltip="include"]
    "1" -> "37" [dir=forward tooltip="include"]
    "1" -> "38" [dir=forward tooltip="include"]
    "1" -> "39" [dir=forward tooltip="include"]
    "29" -> "2" [dir=forward tooltip="include"]
    "29" -> "17" [dir=forward tooltip="include"]
    "34" -> "3" [dir=forward tooltip="include"]
    "34" -> "30" [dir=forward tooltip="include"]
    "23" -> "6" [dir=forward tooltip="include"]
    "23" -> "7" [dir=forward tooltip="include"]
    "23" -> "11" [dir=forward tooltip="include"]
    "23" -> "19" [dir=forward tooltip="include"]
    "12" -> "13" [dir=forward tooltip="include"]
    "12" -> "14" [dir=forward tooltip="include"]
    "27" -> "2" [dir=forward tooltip="include"]
    "27" -> "19" [dir=forward tooltip="include"]
    "30" -> "5" [dir=forward tooltip="include"]
    "30" -> "2" [dir=forward tooltip="include"]
    "30" -> "31" [dir=forward tooltip="include"]
    "3" -> "4" [dir=forward tooltip="include"]
    "3" -> "5" [dir=forward tooltip="include"]
    "3" -> "7" [dir=forward tooltip="include"]
    "3" -> "11" [dir=forward tooltip="include"]
    "3" -> "12" [dir=forward tooltip="include"]
    "3" -> "15" [dir=forward tooltip="include"]
    "3" -> "17" [dir=forward tooltip="include"]
    "3" -> "24" [dir=forward tooltip="include"]
    "19" -> "7" [dir=forward tooltip="include"]
    "19" -> "8" [dir=forward tooltip="include"]
    "19" -> "20" [dir=forward tooltip="include"]
    "19" -> "4" [dir=forward tooltip="include"]
    "19" -> "6" [dir=forward tooltip="include"]
    "32" -> "3" [dir=forward tooltip="include"]
    "32" -> "30" [dir=forward tooltip="include"]
    "32" -> "33" [dir=forward tooltip="include"]
    "24" -> "13" [dir=forward tooltip="include"]
    "24" -> "4" [dir=forward tooltip="include"]
    "24" -> "11" [dir=forward tooltip="include"]
}

Defines

MBEDTLS_PRIVATE(member)
DEFAULT_READ_BUFFER_FALLBACK
UNKNOWN_TABLE_VALUE

Functions

static void entropycontext_dtor(ErlNifEnv *caller_env, void *obj)
static void ctrdrbg_dtor(ErlNifEnv *caller_env, void *obj)
static void sslcontext_dtor(ErlNifEnv *caller_env, void *obj)
static void sslconfig_dtor(ErlNifEnv *caller_env, void *obj)
int mbedtls_ssl_send_cb(void *ctx, const unsigned char *buf, size_t len)
int mbedtls_ssl_recv_cb(void *ctx, unsigned char *buf, size_t len)
static term nif_ssl_entropy_init(Context *ctx, int argc, term argv[])
static term nif_ssl_ctr_drbg_init(Context *ctx, int argc, term argv[])
static term nif_ssl_ctr_drbg_seed(Context *ctx, int argc, term argv[])
static term nif_ssl_init(Context *ctx, int argc, term argv[])
static term nif_ssl_set_bio(Context *ctx, int argc, term argv[])
static term nif_ssl_config_init(Context *ctx, int argc, term argv[])
static term nif_ssl_config_defaults(Context *ctx, int argc, term argv[])
static term nif_ssl_set_hostname(Context *ctx, int argc, term argv[])
static term nif_ssl_conf_authmode(Context *ctx, int argc, term argv[])
static term nif_ssl_conf_rng(Context *ctx, int argc, term argv[])
static term nif_ssl_setup(Context *ctx, int argc, term argv[])
static term make_err_result(int err, Context *ctx)
static term nif_ssl_handshake_step(Context *ctx, int argc, term argv[])
static term nif_ssl_close_notify(Context *ctx, int argc, term argv[])
static term nif_ssl_write(Context *ctx, int argc, term argv[])
static term nif_ssl_read(Context *ctx, int argc, term argv[])
const struct Nif *otp_ssl_nif_get_nif(const char *nifname)
void otp_ssl_init(GlobalContext *global)

Variables

static const ErlNifResourceTypeInit EntropyContextResourceTypeInit  = {.members = 1,.dtor = entropycontext_dtor,}
static const ErlNifResourceTypeInit CtrDrbgResourceTypeInit  = {.members = 1,.dtor = ctrdrbg_dtor,}
static const ErlNifResourceTypeInit SSLContextResourceTypeInit  = {.members = 1,.dtor = sslcontext_dtor,}
static const ErlNifResourceTypeInit SSLConfigResourceTypeInit  = {.members = 1,.dtor = sslconfig_dtor,}
static ErlNifResourceType *entropycontext_resource_type
static ErlNifResourceType *ctrdrbg_resource_type
static ErlNifResourceType *sslcontext_resource_type
static ErlNifResourceType *sslconfig_resource_type
static const AtomStringIntPair endpoint_table[] = {{ATOM_STR("\x6", "client"), MBEDTLS_SSL_IS_CLIENT}, {ATOM_STR("\x6", "server"), MBEDTLS_SSL_IS_SERVER},}
static const AtomStringIntPair authmode_table[] = {{ATOM_STR("\x4", "none"), MBEDTLS_SSL_VERIFY_NONE}, {ATOM_STR("\x8", "optional"), MBEDTLS_SSL_VERIFY_OPTIONAL}, {ATOM_STR("\x8", "required"), MBEDTLS_SSL_VERIFY_REQUIRED},}
static const struct Nif ssl_entropy_init_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_entropy_init}
static const struct Nif ssl_ctr_drbg_init_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_ctr_drbg_init}
static const struct Nif ssl_ctr_drbg_seed_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_ctr_drbg_seed}
static const struct Nif ssl_init_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_init}
static const struct Nif ssl_set_bio_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_set_bio}
static const struct Nif ssl_config_init_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_config_init}
static const struct Nif ssl_config_defaults_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_config_defaults}
static const struct Nif ssl_conf_authmode_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_conf_authmode}
static const struct Nif ssl_conf_rng_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_conf_rng}
static const struct Nif ssl_set_hostname_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_set_hostname}
static const struct Nif ssl_setup_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_setup}
static const struct Nif ssl_handshake_step_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_handshake_step}
static const struct Nif ssl_close_notify_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_close_notify}
static const struct Nif ssl_write_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_write}
static const struct Nif ssl_read_nif  = {.base.type =NIFFunctionType,.nif_ptr = nif_ssl_read}
struct EntropyContextResource

Public Members

mbedtls_entropy_context context
struct CtrDrbgResource

Public Members

mbedtls_ctr_drbg_context context
struct SSLContextResource

Public Members

mbedtls_ssl_context context
struct SSLConfigResource

Public Members

mbedtls_ssl_config config