How mbed-tls/mbedtls works
Mbed TLS is a C library for X.509 certificate processing and TLS/DTLS secure channels, backed by PSA cryptography. The principal workflow is an application configuring a client or server, opening transport, performing a TLS/DTLS handshake, validating certificates and deriving keys, then exchanging protected records. X.509 utilities provide a separate certificate/CSR/CRL workflow. The graph reflects sampled client, TLS 1.2/1.3, DTLS, socket, certificate, cache and ticket code; unsampled server details are represented only where the tree supports them.
Main entry points: ssl_tls.c TLS Orchestrator · ssl_client2.c TLS Applications · ssl_tls12_client.c TLS 1.2 Protocol · ssl_tls13_client.c TLS 1.3 Protocol
Components 20
Applications
- TLS Applications
programs/ssl/ssl_client2.c - TLS Server Apps
programs/ssl/ssl_server.c - X.509 Utilities
programs/x509/cert_app.c
TLS Protocol
- TLS Orchestrator
library/ssl_tls.c - Client Handshake
library/ssl_client.c - TLS 1.2 Protocol
library/ssl_tls12_client.c - TLS 1.3 Protocol
library/ssl_tls13_client.c - TLS 1.2 Server
library/ssl_tls12_server.c - Record Layer
library/ssl_msg.c
Trust Crypto
- X.509 Engine
library/x509.c - Certificate Parser
library/x509_crt.c - Certificate Writers
library/x509write.c - PSA Crypto
- TLS Key Schedule
library/ssl_tls13_keys.c
Transport State
- Socket Transport
library/net_sockets.c - DTLS Timing
library/timing.c - Session Cache
library/ssl_cache.c - Session Tickets
library/ssl_ticket.c
Other components
- Application User
- TLS Peer
Connections 28
- Application User → TLS Applications: configures
- Application User → TLS Server Apps: configures
- Application User → X.509 Utilities: requests
- TLS Applications → Socket Transport: opens socket
- TLS Applications → TLS Orchestrator: calls TLS API
- TLS Server Apps → Socket Transport: opens socket
- TLS Server Apps → TLS Orchestrator: calls TLS API
- TLS Orchestrator → Client Handshake: builds hello
- TLS Orchestrator → TLS 1.2 Protocol: dispatches TLS 1.2
- TLS Orchestrator → TLS 1.3 Protocol: dispatches TLS 1.3
- TLS Orchestrator → TLS 1.2 Server: dispatches server
- TLS Orchestrator → Record Layer: processes records
- Client Handshake → TLS 1.2 Protocol: offers extensions
- Client Handshake → TLS 1.3 Protocol: offers TLS 1.3
- TLS 1.2 Protocol → Certificate Parser: validates certificates
- TLS 1.3 Protocol → TLS Key Schedule: derives keys
- TLS 1.2 Protocol → Session Tickets: handles tickets
- TLS 1.3 Protocol → Session Tickets: handles tickets
- TLS Orchestrator → Session Cache: uses cache
- TLS Key Schedule → PSA Crypto: uses cryptography
- Certificate Parser → X.509 Engine: parses certificates
- X.509 Engine → PSA Crypto: verifies signatures
- X.509 Utilities → Certificate Parser: reads certificates
- X.509 Utilities → Certificate Writers: writes artifacts
- Record Layer → Socket Transport: sends records
- TLS Applications → DTLS Timing: configures DTLS
- TLS Orchestrator → DTLS Timing: drives timers
- Socket Transport → TLS Peer: carries traffic