|
cwist
Modern C web framework with libttak runtime
|
mbedTLS implementation of the CWIST TLS backend seam. More...
#include <openssl/ssl.h>#include <openssl/err.h>#include <openssl/evp.h>#include <openssl/hmac.h>#include <openssl/rand.h>#include <openssl/crypto.h>#include <cwist/core/mem/alloc.h>#include <mbedtls/ssl.h>#include <mbedtls/ssl_cache.h>#include <mbedtls/ssl_ticket.h>#include <mbedtls/net_sockets.h>#include <mbedtls/entropy.h>#include <mbedtls/ctr_drbg.h>#include <mbedtls/error.h>#include <mbedtls/md.h>#include <mbedtls/cipher.h>#include <mbedtls/x509_crt.h>#include <mbedtls/pk.h>#include <mbedtls/platform.h>#include <mbedtls/ssl_ciphersuites.h>#include <stdatomic.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <pthread.h>#include <unistd.h>
Go to the source code of this file.
Macros | |
| #define | CWIST_MTLS_EX_DATA_MAX 8 |
mbedTLS implementation of the CWIST TLS backend seam.
Implements every cwist_mtls_* function declared by the shim headers in src/security/tls/shim/openssl/ on top of mbedTLS (mbedtls_ssl_* and friends). Call sites keep their OpenSSL-shaped code; the shim macros map it here, so a CWIST_TLS=mbedtls build contains no BoringSSL objects or symbols.
Scope and honest limitations (all relative to the BoringSSL backend):
Definition in file backend_mbedtls.c.
| #define CWIST_MTLS_EX_DATA_MAX 8 |
Definition at line 359 of file backend_mbedtls.c.
Definition at line 149 of file backend_mbedtls.c.
References cap.
Definition at line 83 of file backend_mbedtls.c.
Definition at line 74 of file backend_mbedtls.c.
References cap.
Definition at line 68 of file backend_mbedtls.c.
References cap.
| const EVP_CIPHER * cwist_mtls_EVP_aes_256_cbc | ( | void | ) |
Definition at line 240 of file backend_mbedtls.c.
| void cwist_mtls_EVP_CIPHER_CTX_free | ( | EVP_CIPHER_CTX * | ctx | ) |
Definition at line 255 of file backend_mbedtls.c.
References cap, and cwist_free().
| EVP_CIPHER_CTX * cwist_mtls_EVP_CIPHER_CTX_new | ( | void | ) |
Definition at line 248 of file backend_mbedtls.c.
References cap, and cwist_malloc().
| int cwist_mtls_EVP_DecryptFinal_ex | ( | EVP_CIPHER_CTX * | ctx, |
| unsigned char * | out, | ||
| int * | outl | ||
| ) |
Definition at line 314 of file backend_mbedtls.c.
References cap, and cwist_mtls_EVP_EncryptFinal_ex().
| int cwist_mtls_EVP_DecryptInit_ex | ( | EVP_CIPHER_CTX * | ctx, |
| const EVP_CIPHER * | type, | ||
| void * | engine, | ||
| const unsigned char * | key, | ||
| const unsigned char * | iv | ||
| ) |
Definition at line 286 of file backend_mbedtls.c.
References cap.
| int cwist_mtls_EVP_DecryptUpdate | ( | EVP_CIPHER_CTX * | ctx, |
| unsigned char * | out, | ||
| int * | outl, | ||
| const unsigned char * | in, | ||
| int | inl | ||
| ) |
Definition at line 309 of file backend_mbedtls.c.
References cap, and cwist_mtls_EVP_EncryptUpdate().
| int cwist_mtls_EVP_EncryptFinal_ex | ( | EVP_CIPHER_CTX * | ctx, |
| unsigned char * | out, | ||
| int * | outl | ||
| ) |
Definition at line 301 of file backend_mbedtls.c.
References cap.
Referenced by cwist_mtls_EVP_DecryptFinal_ex().
| int cwist_mtls_EVP_EncryptInit_ex | ( | EVP_CIPHER_CTX * | ctx, |
| const EVP_CIPHER * | type, | ||
| void * | engine, | ||
| const unsigned char * | key, | ||
| const unsigned char * | iv | ||
| ) |
Definition at line 280 of file backend_mbedtls.c.
References cap.
| int cwist_mtls_EVP_EncryptUpdate | ( | EVP_CIPHER_CTX * | ctx, |
| unsigned char * | out, | ||
| int * | outl, | ||
| const unsigned char * | in, | ||
| int | inl | ||
| ) |
Definition at line 292 of file backend_mbedtls.c.
References cap.
Referenced by cwist_mtls_EVP_DecryptUpdate().
Definition at line 165 of file backend_mbedtls.c.
| unsigned char * cwist_mtls_HMAC | ( | const EVP_MD * | md, |
| const void * | key, | ||
| int | key_len, | ||
| const unsigned char * | msg, | ||
| size_t | msg_len, | ||
| unsigned char * | out, | ||
| unsigned int * | out_len | ||
| ) |
Definition at line 169 of file backend_mbedtls.c.
References cap.
Definition at line 196 of file backend_mbedtls.c.
References cap, and cwist_free().
Definition at line 189 of file backend_mbedtls.c.
References cap, and cwist_malloc().
Definition at line 224 of file backend_mbedtls.c.
References cap.
| int cwist_mtls_HMAC_Init_ex | ( | HMAC_CTX * | ctx, |
| const void * | key, | ||
| int | key_len, | ||
| const EVP_MD * | md, | ||
| void * | engine | ||
| ) |
Definition at line 202 of file backend_mbedtls.c.
References cap.
Definition at line 219 of file backend_mbedtls.c.
References cap.
Definition at line 145 of file backend_mbedtls.c.
References cap.
Definition at line 127 of file backend_mbedtls.c.
References cap.
Definition at line 935 of file backend_mbedtls.c.
Definition at line 940 of file backend_mbedtls.c.
Definition at line 619 of file backend_mbedtls.c.
References cap.
Definition at line 455 of file backend_mbedtls.c.
References cap.
Referenced by cwist_mtls_SSL_free().
Definition at line 820 of file backend_mbedtls.c.
References cap, and CWIST_MTLS_EX_DATA_MAX.
| int cwist_mtls_SSL_CTX_get_ex_new_index | ( | long | argl, |
| void * | argp, | ||
| void * | new_func, | ||
| void * | dup_func, | ||
| void * | free_func | ||
| ) |
Definition at line 803 of file backend_mbedtls.c.
References cap, and CWIST_MTLS_EX_DATA_MAX.
Definition at line 614 of file backend_mbedtls.c.
References cap, TLS1_2_VERSION, and TLS1_3_VERSION.
| SSL_CTX * cwist_mtls_SSL_CTX_new | ( | const SSL_METHOD * | method | ) |
Definition at line 394 of file backend_mbedtls.c.
References cap, cwist_free(), and cwist_malloc().
Definition at line 630 of file backend_mbedtls.c.
References cap.
Definition at line 846 of file backend_mbedtls.c.
References cap.
| int cwist_mtls_SSL_CTX_set_alpn_protos | ( | SSL_CTX * | ctx, |
| const unsigned char * | protos, | ||
| unsigned int | protos_len | ||
| ) |
Definition at line 692 of file backend_mbedtls.c.
References cap.
| void cwist_mtls_SSL_CTX_set_alpn_select_cb | ( | SSL_CTX * | ctx, |
| int(*)(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) | cb, | ||
| void * | arg | ||
| ) |
Definition at line 653 of file backend_mbedtls.c.
References cap, and SSL_TLSEXT_ERR_OK.
Definition at line 564 of file backend_mbedtls.c.
References cap.
Definition at line 568 of file backend_mbedtls.c.
References cap.
Definition at line 832 of file backend_mbedtls.c.
References cap.
Definition at line 814 of file backend_mbedtls.c.
References cap, and CWIST_MTLS_EX_DATA_MAX.
Definition at line 462 of file backend_mbedtls.c.
References cap, TLS1_2_VERSION, and TLS1_3_VERSION.
Definition at line 491 of file backend_mbedtls.c.
References cap, and SSL_MODE_AUTO_RETRY.
Definition at line 475 of file backend_mbedtls.c.
References cap, SSL_OP_NO_TICKET, and SSL_OP_NO_TLSv1_2.
Definition at line 624 of file backend_mbedtls.c.
References cap, and SSL_SESS_CACHE_SERVER.
| int cwist_mtls_SSL_CTX_set_session_id_context | ( | SSL_CTX * | ctx, |
| const unsigned char * | sid_ctx, | ||
| unsigned int | sid_ctx_len | ||
| ) |
Definition at line 637 of file backend_mbedtls.c.
References cap.
Definition at line 646 of file backend_mbedtls.c.
References cap.
| void cwist_mtls_SSL_CTX_set_tlsext_ticket_key_cb | ( | SSL_CTX * | ctx, |
| int(*)(SSL *ssl, unsigned char *key_name, unsigned char *iv, EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc) | cb | ||
| ) |
Definition at line 733 of file backend_mbedtls.c.
References cap, cwist_free(), cwist_malloc(), CWIST_MTLS_EX_DATA_MAX, and SSL_OP_NO_TICKET.
Definition at line 825 of file backend_mbedtls.c.
References cap, and SSL_VERIFY_PEER.
Definition at line 583 of file backend_mbedtls.c.
References cap.
Referenced by cwist_mtls_SSL_CTX_use_certificate_file().
Definition at line 609 of file backend_mbedtls.c.
References cap, and cwist_mtls_SSL_CTX_use_certificate_chain_file().
Definition at line 596 of file backend_mbedtls.c.
References cap, and SSL_FILETYPE_PEM.
Definition at line 894 of file backend_mbedtls.c.
References cap, cwist_free(), and cwist_mtls_SSL_CTX_free().
| void cwist_mtls_SSL_get0_alpn_selected | ( | const SSL * | ssl, |
| const unsigned char ** | data, | ||
| unsigned int * | len | ||
| ) |
Definition at line 1054 of file backend_mbedtls.c.
References cap.
Definition at line 1031 of file backend_mbedtls.c.
References cap.
Definition at line 1006 of file backend_mbedtls.c.
References cap, and SSL_ERROR_SSL.
Definition at line 1012 of file backend_mbedtls.c.
References cap.
Definition at line 873 of file backend_mbedtls.c.
References cap, cwist_free(), cwist_malloc(), and SSL_ERROR_NONE.
Definition at line 994 of file backend_mbedtls.c.
References cap.
Definition at line 945 of file backend_mbedtls.c.
References cap, SSL_ERROR_NONE, SSL_ERROR_SSL, SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE, and SSL_ERROR_ZERO_RETURN.
| int cwist_mtls_SSL_select_next_proto | ( | unsigned char ** | out, |
| unsigned char * | outlen, | ||
| const unsigned char * | server, | ||
| unsigned int | server_len, | ||
| const unsigned char * | client, | ||
| unsigned int | client_len | ||
| ) |
Definition at line 320 of file backend_mbedtls.c.
References cap, and OPENSSL_NPN_NEGOTIATED.
Definition at line 1016 of file backend_mbedtls.c.
References cap.
| int cwist_mtls_SSL_set_alpn_protos | ( | SSL * | ssl, |
| const unsigned char * | protos, | ||
| unsigned int | protos_len | ||
| ) |
Definition at line 1066 of file backend_mbedtls.c.
References cap.
Definition at line 903 of file backend_mbedtls.c.
References cap.
Definition at line 1061 of file backend_mbedtls.c.
References cap.
Definition at line 999 of file backend_mbedtls.c.
References cap.
Definition at line 1023 of file backend_mbedtls.c.
References cap, TLS1_2_VERSION, and TLS1_3_VERSION.
Definition at line 974 of file backend_mbedtls.c.
References cap, SSL_ERROR_NONE, SSL_ERROR_SSL, SSL_ERROR_WANT_READ, and SSL_ERROR_WANT_WRITE.
| const SSL_METHOD * cwist_mtls_TLS_client_method | ( | void | ) |
Definition at line 355 of file backend_mbedtls.c.
| const SSL_METHOD * cwist_mtls_TLS_server_method | ( | void | ) |
Definition at line 351 of file backend_mbedtls.c.