|
iPXE
|
Transport Layer Security Protocol. More...
#include <stdint.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <errno.h>#include <byteswap.h>#include <ipxe/pending.h>#include <ipxe/hmac.h>#include <ipxe/md5.h>#include <ipxe/sha1.h>#include <ipxe/sha256.h>#include <ipxe/md5_sha1.h>#include <ipxe/aes.h>#include <ipxe/rsa.h>#include <ipxe/hkdf.h>#include <ipxe/iobuf.h>#include <ipxe/xfer.h>#include <ipxe/open.h>#include <ipxe/x509.h>#include <ipxe/privkey.h>#include <ipxe/certstore.h>#include <ipxe/rootcert.h>#include <ipxe/rbg.h>#include <ipxe/validator.h>#include <ipxe/job.h>#include <ipxe/ffdhe.h>#include <ipxe/tls.h>#include <config/crypto.h>Go to the source code of this file.
Data Structures | |
| struct | tls24_t |
| A TLS 24-bit integer. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| FILE_SECBOOT (PERMITTED) | |
| static | LIST_HEAD (tls_sessions) |
| List of TLS session. | |
| static void | tls_regenerate_ephemeral_master (struct tls_connection *tls) |
| Regenerate ephemeral master secret. | |
| static void | tls_tx_resume_all (struct tls_session *session) |
| Resume TX state machine for all connections within a session. | |
| static struct io_buffer * | tls_alloc_iob (struct tls_connection *tls, size_t len) |
| Allocate I/O buffer for transmitted record(s). | |
| static int | tls_send_handshake (struct tls_connection *tls, const void *data, size_t len) |
| Transmit Handshake record. | |
| static int | tls_send_alert (struct tls_connection *tls, unsigned int level, unsigned int description) |
| Transmit Alert record. | |
| static int | tls_send_record (struct tls_connection *tls, unsigned int type, struct io_buffer *iobuf) |
| Send plaintext record(s). | |
| static int | tls_send_plaintext (struct tls_connection *tls, unsigned int type, const void *data, size_t len) |
| Send plaintext record. | |
| static void | tls_clear_cipher (struct tls_connection *tls, struct tls_cipherspec *cipherspec) |
| static void | tls_clear_digest (struct tls_connection *tls) |
| Clear key schedule digest algorithm. | |
| static void | tls_verify_handshake (struct tls_connection *tls, void *out) |
| Calculate handshake verification hash. | |
| static unsigned long | tls_uint24 (const tls24_t *field24) |
| Extract 24-bit field value. | |
| static void | tls_set_uint24 (tls24_t *field24, unsigned long value) |
| Set 24-bit field value. | |
| static int | tls_ready (struct tls_connection *tls) |
| Determine if TLS connection is ready for application data. | |
| static int | tls_version (struct tls_connection *tls, unsigned int version) |
| Check for TLS version. | |
| static void | free_tls_session (struct refcnt *refcnt) |
| Free TLS session. | |
| static void | free_tls (struct refcnt *refcnt) |
| Free TLS connection. | |
| static void | tls_close (struct tls_connection *tls, int rc) |
| Finish with TLS connection. | |
| static void | tls_close_alert (struct tls_connection *tls, int rc) |
| Send closure alert and finish with TLS connection. | |
| static int | tls_generate_ephemeral_master (struct tls_connection *tls) |
| Generate ephemeral master secret. | |
| static void | tls_ephemeral (struct tls_connection *tls, const void *info, size_t info_len, void *out, size_t len) |
| Generate ephemeral secret. | |
| static void | tls_ephemeral_label (struct tls_connection *tls, const char *label, void *out, size_t len) |
| Generate ephemeral secret from label. | |
| static void | tls_clear_binding (struct tls_connection *tls) |
| Clear key schedule binding. | |
| static void | tls_set_binding (struct tls_connection *tls, struct x509_certificate *cert) |
| Bind key schedule to a server identity. | |
| static int | tls_set_digest (struct tls_connection *tls, struct digest_algorithm *digest) |
| Set key schedule digest algorithm. | |
| static void | tls_hmac_update_va (struct digest_algorithm *digest, void *ctx, va_list args) |
| Update HMAC with a list of ( data, len ) pairs. | |
| static void | tls_p_hash_va (struct tls_connection *tls, struct digest_algorithm *digest, const void *hkey, void *out, size_t out_len, va_list seeds) |
| Generate secure pseudo-random data using a single hash function. | |
| static void | tls_prf (struct tls_connection *tls, void *out, size_t out_len,...) |
| Generate secure pseudo-random data. | |
| static void | tls_set_kdf_master (struct tls_connection *tls, const void *secret, size_t secret_len) |
| Set key derivation function master secret. | |
| static int | tls_share_ephemeral (struct tls_connection *tls, void *public) |
| Share ephemeral public key. | |
| static int | tls_agree_ephemeral (struct tls_connection *tls, const void *partner, size_t partner_len, int strip) |
| Agree ephemeral public key (i.e. | |
| static void | tls_generate_master_secret (struct tls_connection *tls) |
| Generate master secret. | |
| static int | tls_generate_keys (struct tls_connection *tls) |
| Generate key material. | |
| static void | tls_generate_resumption_master (struct tls_connection *tls) |
| Generate resumption master secret. | |
| static void | tls_resume_secret (struct tls_connection *tls) |
| Resume from resumption master secret. | |
| static int | tls_add_handshake (struct tls_connection *tls, const void *data, size_t len) |
| Add handshake record to verification hash. | |
| static struct tls_cipher_suite * | tls_find_cipher_suite (unsigned int cipher_suite) |
| Identify cipher suite. | |
| static void | tls_clear_cipher (struct tls_connection *tls __unused, struct tls_cipherspec *cipherspec) |
| Clear cipher suite. | |
| static int | tls_set_cipher (struct tls_connection *tls, struct tls_cipherspec *cipherspec, struct tls_cipher_suite *suite) |
| Set cipher suite. | |
| static int | tls_select_cipher (struct tls_connection *tls, unsigned int cipher_suite) |
| Select next cipher suite. | |
| static int | tls_change_cipher (struct tls_connection *tls, struct tls_cipherspec_pair *pair) |
| Activate next cipher suite. | |
| static struct tls_signature_hash_algorithm * | tls_signature_hash_algorithm (struct pubkey_algorithm *pubkey, struct digest_algorithm *digest) |
| Find TLS signature and hash algorithm. | |
| static struct tls_signature_hash_algorithm * | tls_find_signature_hash (unsigned int code) |
| Find TLS signature and hash algorithm. | |
| static struct tls_named_group * | tls_find_named_group (unsigned int named_group) |
| Identify named key exchange group. | |
| static struct tls_named_group * | tls_find_param_group (const void *dh_p, size_t dh_p_len, const void *dh_g, size_t dh_g_len) |
| Identify named key exchange group by Diffie-Hellman parameters. | |
| static int | tls_verify_dh_params (struct tls_connection *tls, const void *data, size_t len, size_t param_len) |
| Verify Diffie-Hellman parameter signature. | |
| static int | tls_new_server_key_exchange_pubkey (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Key Exchange record using public key transport. | |
| static int | tls_send_client_key_exchange_pubkey (struct tls_connection *tls) |
| Transmit Client Key Exchange record using public key exchange. | |
| static int | tls_new_server_key_exchange_dhe (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Key Exchange record using DHE key exchange. | |
| static int | tls_send_client_key_exchange_dhe (struct tls_connection *tls) |
| Transmit Client Key Exchange record using DHE key exchange. | |
| static int | tls_new_server_key_exchange_ecdhe (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Key Exchange record using ECDHE key exchange. | |
| static int | tls_send_client_key_exchange_ecdhe (struct tls_connection *tls) |
| Transmit Client Key Exchange record using ECDHE key exchange. | |
| static void | tls_tx_resume (struct tls_connection *tls) |
| Resume TX state machine. | |
| static void | tls_restart (struct tls_connection *tls) |
| Restart negotiation. | |
| static int | tls_client_hello (struct tls_connection *tls, int(*action)(struct tls_connection *tls, const void *data, size_t len)) |
| Digest or transmit Client Hello record. | |
| static int | tls_send_client_hello (struct tls_connection *tls) |
| Transmit Client Hello record. | |
| static int | tls_send_certificate (struct tls_connection *tls) |
| Transmit Certificate record. | |
| static int | tls_send_client_key_exchange (struct tls_connection *tls) |
| Transmit Client Key Exchange record. | |
| static int | tls_send_certificate_verify (struct tls_connection *tls) |
| Transmit Certificate Verify record. | |
| static int | tls_send_change_cipher (struct tls_connection *tls) |
| Transmit Change Cipher record. | |
| static int | tls_send_finished (struct tls_connection *tls) |
| Transmit Finished record. | |
| static int | tls_new_change_cipher (struct tls_connection *tls, struct io_buffer *iobuf) |
| Receive new Change Cipher record. | |
| static int | tls_new_alert (struct tls_connection *tls, struct io_buffer *iobuf) |
| Receive new Alert record. | |
| static int | tls_new_hello_request (struct tls_connection *tls, const void *data __unused, size_t len __unused) |
| Receive new Hello Request handshake record. | |
| static int | tls_new_server_hello (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Hello handshake record. | |
| static int | tls_new_session_ticket (struct tls_connection *tls, const void *data, size_t len) |
| Receive New Session Ticket handshake record. | |
| static int | tls_parse_chain (struct tls_connection *tls, const void *data, size_t len) |
| Parse certificate chain. | |
| static int | tls_new_certificate (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Certificate handshake record. | |
| static int | tls_new_server_key_exchange (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Key Exchange handshake record. | |
| static int | tls_new_certificate_request (struct tls_connection *tls, const void *data __unused, size_t len __unused) |
| Receive new Certificate Request handshake record. | |
| static int | tls_new_server_hello_done (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Server Hello Done handshake record. | |
| static int | tls_new_finished (struct tls_connection *tls, const void *data, size_t len) |
| Receive new Finished handshake record. | |
| static int | tls_new_handshake (struct tls_connection *tls, struct io_buffer *iobuf) |
| Receive new Handshake record. | |
| static int | tls_new_unknown (struct tls_connection *tls __unused, struct io_buffer *iobuf) |
| Receive new unknown record. | |
| static int | tls_new_data (struct tls_connection *tls, struct list_head *rx_data) |
| Receive new data record. | |
| static int | tls_new_record (struct tls_connection *tls, unsigned int type, struct list_head *rx_data) |
| Receive new record. | |
| static void | tls_hmac_init (struct tls_cipherspec *cipherspec, void *ctx, struct tls_auth_header *authhdr) |
| Initialise HMAC. | |
| static void | tls_hmac_update (struct tls_cipherspec *cipherspec, void *ctx, const void *data, size_t len) |
| Update HMAC. | |
| static void | tls_hmac_final (struct tls_cipherspec *cipherspec, void *ctx, void *hmac) |
| Finalise HMAC. | |
| static void | tls_hmac (struct tls_cipherspec *cipherspec, struct tls_auth_header *authhdr, const void *data, size_t len, void *hmac) |
| Calculate HMAC. | |
| static void | tls_hmac_list (struct tls_cipherspec *cipherspec, struct tls_auth_header *authhdr, struct list_head *list, void *hmac) |
| Calculate HMAC over list of I/O buffers. | |
| static size_t | tls_iob_reserved (struct tls_connection *tls, size_t len) |
| Calculate maximum additional length required for transmitted record(s). | |
| static int | tls_verify_padding (struct tls_connection *tls, struct io_buffer *iobuf) |
| Verify block padding. | |
| static int | tls_new_ciphertext (struct tls_connection *tls, struct tls_header *tlshdr, struct list_head *rx_data) |
| Receive new ciphertext record. | |
| static size_t | tls_plainstream_window (struct tls_connection *tls) |
| Check flow control window. | |
| static int | tls_plainstream_deliver (struct tls_connection *tls, struct io_buffer *iobuf, struct xfer_metadata *meta __unused) |
| Deliver datagram as raw data. | |
| static int | tls_progress (struct tls_connection *tls, struct job_progress *progress) |
| Report job progress. | |
| static int | tls_newdata_process_header (struct tls_connection *tls) |
| Handle received TLS header. | |
| static int | tls_newdata_process_data (struct tls_connection *tls) |
| Handle received TLS data payload. | |
| static size_t | tls_cipherstream_window (struct tls_connection *tls) |
| Check flow control window. | |
| static int | tls_cipherstream_deliver (struct tls_connection *tls, struct io_buffer *iobuf, struct xfer_metadata *xfer __unused) |
| Receive new ciphertext. | |
| static void | tls_validator_done (struct tls_connection *tls, int rc) |
| Handle certificate validation completion. | |
| static void | tls_tx_step (struct tls_connection *tls) |
| TLS TX state machine. | |
| static int | tls_session (struct tls_connection *tls, const char *name) |
| Find or create session for TLS connection. | |
| int | add_tls (struct interface *xfer, const char *name, struct x509_root *root, struct private_key *key) |
| Add TLS on an interface. | |
| REQUIRING_SYMBOL (add_tls) | |
| REQUIRE_OBJECT (config_crypto) | |
Variables | |
| struct tls_cipher_suite | tls_cipher_suite_null |
| Null cipher suite. | |
| struct tls_key_exchange_algorithm | tls_pubkey_exchange_algorithm |
| Public key exchange algorithm. | |
| struct tls_key_exchange_algorithm | tls_dhe_exchange_algorithm |
| Ephemeral Diffie-Hellman key exchange algorithm. | |
| struct tls_key_exchange_algorithm | tls_ecdhe_exchange_algorithm |
| Ephemeral Elliptic Curve Diffie-Hellman key exchange algorithm. | |
| static struct interface_operation | tls_plainstream_ops [] |
| TLS plaintext stream interface operations. | |
| static struct interface_descriptor | tls_plainstream_desc |
| TLS plaintext stream interface descriptor. | |
| static struct interface_operation | tls_cipherstream_ops [] |
| TLS ciphertext stream interface operations. | |
| static struct interface_descriptor | tls_cipherstream_desc |
| TLS ciphertext stream interface descriptor. | |
| static struct interface_operation | tls_validator_ops [] |
| TLS certificate validator interface operations. | |
| static struct interface_descriptor | tls_validator_desc |
| TLS certificate validator interface descriptor. | |
| static struct process_descriptor | tls_process_desc |
| TLS TX process descriptor. | |
Transport Layer Security Protocol.
Definition in file tls.c.
| #define EINVAL_CHANGE_CIPHER __einfo_error ( EINFO_EINVAL_CHANGE_CIPHER ) |
Definition at line 59 of file tls.c.
Referenced by tls_new_change_cipher().
| #define EINFO_EINVAL_CHANGE_CIPHER |
Definition at line 60 of file tls.c.
| #define EINVAL_ALERT __einfo_error ( EINFO_EINVAL_ALERT ) |
Definition at line 63 of file tls.c.
Referenced by tls_new_alert().
| #define EINFO_EINVAL_ALERT |
Definition at line 64 of file tls.c.
| #define EINVAL_HELLO __einfo_error ( EINFO_EINVAL_HELLO ) |
Definition at line 67 of file tls.c.
Referenced by tls_new_server_hello().
| #define EINFO_EINVAL_HELLO |
Definition at line 68 of file tls.c.
| #define EINVAL_CERTIFICATE __einfo_error ( EINFO_EINVAL_CERTIFICATE ) |
Definition at line 71 of file tls.c.
Referenced by tls_parse_chain().
| #define EINFO_EINVAL_CERTIFICATE |
Definition at line 72 of file tls.c.
| #define EINVAL_CERTIFICATES __einfo_error ( EINFO_EINVAL_CERTIFICATES ) |
Definition at line 75 of file tls.c.
Referenced by tls_new_certificate().
| #define EINFO_EINVAL_CERTIFICATES |
Definition at line 76 of file tls.c.
| #define EINVAL_HELLO_DONE __einfo_error ( EINFO_EINVAL_HELLO_DONE ) |
Definition at line 79 of file tls.c.
Referenced by tls_new_server_hello_done().
| #define EINFO_EINVAL_HELLO_DONE |
Definition at line 80 of file tls.c.
| #define EINVAL_FINISHED __einfo_error ( EINFO_EINVAL_FINISHED ) |
Definition at line 83 of file tls.c.
Referenced by tls_new_finished().
| #define EINFO_EINVAL_FINISHED |
Definition at line 84 of file tls.c.
| #define EINVAL_HANDSHAKE __einfo_error ( EINFO_EINVAL_HANDSHAKE ) |
| #define EINFO_EINVAL_HANDSHAKE |
Definition at line 88 of file tls.c.
| #define EINVAL_IV __einfo_error ( EINFO_EINVAL_IV ) |
Definition at line 91 of file tls.c.
Referenced by tls_new_ciphertext().
| #define EINFO_EINVAL_IV |
Definition at line 92 of file tls.c.
| #define EINVAL_PADDING __einfo_error ( EINFO_EINVAL_PADDING ) |
Definition at line 95 of file tls.c.
Referenced by tls_verify_padding().
| #define EINFO_EINVAL_PADDING |
Definition at line 96 of file tls.c.
| #define EINVAL_RX_STATE __einfo_error ( EINFO_EINVAL_RX_STATE ) |
Definition at line 99 of file tls.c.
Referenced by tls_cipherstream_deliver().
| #define EINFO_EINVAL_RX_STATE |
Definition at line 100 of file tls.c.
| #define EINVAL_MAC __einfo_error ( EINFO_EINVAL_MAC ) |
Definition at line 103 of file tls.c.
Referenced by tls_new_ciphertext().
| #define EINFO_EINVAL_MAC |
Definition at line 104 of file tls.c.
| #define EINVAL_TICKET __einfo_error ( EINFO_EINVAL_TICKET ) |
Definition at line 107 of file tls.c.
Referenced by tls_new_session_ticket().
| #define EINFO_EINVAL_TICKET |
Definition at line 108 of file tls.c.
| #define EINVAL_KEY_EXCHANGE __einfo_error ( EINFO_EINVAL_KEY_EXCHANGE ) |
Definition at line 111 of file tls.c.
Referenced by tls_agree_ephemeral(), tls_new_server_key_exchange_dhe(), tls_new_server_key_exchange_ecdhe(), and tls_verify_dh_params().
| #define EINFO_EINVAL_KEY_EXCHANGE |
Definition at line 112 of file tls.c.
| #define EIO_ALERT __einfo_error ( EINFO_EIO_ALERT ) |
Definition at line 115 of file tls.c.
Referenced by tls_new_alert().
| #define EINFO_EIO_ALERT |
Definition at line 116 of file tls.c.
| #define ENOENT_CERT __einfo_error ( EINFO_ENOENT_CERT ) |
Definition at line 119 of file tls.c.
Referenced by tls_parse_chain(), tls_send_client_key_exchange_pubkey(), and tls_verify_dh_params().
| #define EINFO_ENOENT_CERT |
Definition at line 120 of file tls.c.
| #define ENOMEM_CONTEXT __einfo_error ( EINFO_ENOMEM_CONTEXT ) |
Definition at line 123 of file tls.c.
Referenced by tls_set_cipher().
| #define EINFO_ENOMEM_CONTEXT |
Definition at line 124 of file tls.c.
| #define ENOMEM_CERTIFICATE __einfo_error ( EINFO_ENOMEM_CERTIFICATE ) |
Definition at line 127 of file tls.c.
Referenced by tls_send_certificate().
| #define EINFO_ENOMEM_CERTIFICATE |
Definition at line 128 of file tls.c.
| #define ENOMEM_CHAIN __einfo_error ( EINFO_ENOMEM_CHAIN ) |
Definition at line 131 of file tls.c.
Referenced by tls_parse_chain().
| #define EINFO_ENOMEM_CHAIN |
Definition at line 132 of file tls.c.
| #define ENOMEM_TX_PLAINTEXT __einfo_error ( EINFO_ENOMEM_TX_PLAINTEXT ) |
Definition at line 135 of file tls.c.
Referenced by tls_send_plaintext().
| #define EINFO_ENOMEM_TX_PLAINTEXT |
Definition at line 136 of file tls.c.
| #define ENOMEM_TX_CIPHERTEXT __einfo_error ( EINFO_ENOMEM_TX_CIPHERTEXT ) |
| #define EINFO_ENOMEM_TX_CIPHERTEXT |
Definition at line 140 of file tls.c.
| #define ENOMEM_RX_DATA __einfo_error ( EINFO_ENOMEM_RX_DATA ) |
Definition at line 143 of file tls.c.
Referenced by tls_newdata_process_header().
| #define EINFO_ENOMEM_RX_DATA |
Definition at line 144 of file tls.c.
| #define ENOMEM_RX_CONCAT __einfo_error ( EINFO_ENOMEM_RX_CONCAT ) |
Definition at line 147 of file tls.c.
Referenced by tls_new_record().
| #define EINFO_ENOMEM_RX_CONCAT |
Definition at line 148 of file tls.c.
| #define ENOTSUP_CIPHER __einfo_error ( EINFO_ENOTSUP_CIPHER ) |
Definition at line 151 of file tls.c.
Referenced by tls_select_cipher().
| #define EINFO_ENOTSUP_CIPHER |
Definition at line 152 of file tls.c.
| #define ENOTSUP_NULL __einfo_error ( EINFO_ENOTSUP_NULL ) |
Definition at line 155 of file tls.c.
Referenced by tls_change_cipher().
| #define EINFO_ENOTSUP_NULL |
Definition at line 156 of file tls.c.
| #define ENOTSUP_SIG_HASH __einfo_error ( EINFO_ENOTSUP_SIG_HASH ) |
Definition at line 159 of file tls.c.
Referenced by tls_send_certificate_verify(), and tls_verify_dh_params().
| #define EINFO_ENOTSUP_SIG_HASH |
Definition at line 160 of file tls.c.
| #define ENOTSUP_VERSION __einfo_error ( EINFO_ENOTSUP_VERSION ) |
| #define EINFO_ENOTSUP_VERSION |
Definition at line 164 of file tls.c.
| #define ENOTSUP_GROUP __einfo_error ( EINFO_ENOTSUP_GROUP ) |
Definition at line 167 of file tls.c.
Referenced by tls_new_server_key_exchange_dhe(), and tls_new_server_key_exchange_ecdhe().
| #define EINFO_ENOTSUP_GROUP |
Definition at line 168 of file tls.c.
| #define EPERM_ALERT __einfo_error ( EINFO_EPERM_ALERT ) |
Definition at line 171 of file tls.c.
Referenced by tls_new_alert().
| #define EINFO_EPERM_ALERT |
Definition at line 172 of file tls.c.
| #define EPERM_VERIFY __einfo_error ( EINFO_EPERM_VERIFY ) |
Definition at line 175 of file tls.c.
Referenced by tls_new_finished().
| #define EINFO_EPERM_VERIFY |
Definition at line 176 of file tls.c.
| #define EPERM_RENEG_INSECURE __einfo_error ( EINFO_EPERM_RENEG_INSECURE ) |
Definition at line 179 of file tls.c.
Referenced by tls_new_hello_request().
| #define EINFO_EPERM_RENEG_INSECURE |
Definition at line 180 of file tls.c.
| #define EPERM_RENEG_VERIFY __einfo_error ( EINFO_EPERM_RENEG_VERIFY ) |
Definition at line 183 of file tls.c.
Referenced by tls_new_server_hello().
| #define EINFO_EPERM_RENEG_VERIFY |
Definition at line 184 of file tls.c.
| #define EPERM_KEY_EXCHANGE __einfo_error ( EINFO_EPERM_KEY_EXCHANGE ) |
Definition at line 187 of file tls.c.
Referenced by tls_verify_dh_params().
| #define EINFO_EPERM_KEY_EXCHANGE |
Definition at line 188 of file tls.c.
| #define EPERM_EMS __einfo_error ( EINFO_EPERM_EMS ) |
Definition at line 191 of file tls.c.
Referenced by tls_new_server_hello().
| #define EINFO_EPERM_EMS |
Definition at line 192 of file tls.c.
| #define EPERM_BOUND __einfo_error ( EINFO_EPERM_BOUND ) |
Definition at line 195 of file tls.c.
Referenced by tls_send_finished().
| #define EINFO_EPERM_BOUND |
Definition at line 196 of file tls.c.
| #define EPROTO_VERSION __einfo_error ( EINFO_EPROTO_VERSION ) |
Definition at line 199 of file tls.c.
Referenced by tls_new_server_hello().
| #define EINFO_EPROTO_VERSION |
Definition at line 200 of file tls.c.
Generate secure pseudo-random data.
| tls | TLS connection |
| out | Output buffer |
| out_len | Length of output buffer |
| label | String literal label |
| ... | ( data, len ) pairs of seed data |
Definition at line 746 of file tls.c.
Referenced by tls_generate_keys(), tls_generate_master_secret(), tls_new_finished(), and tls_send_finished().
| #define TLS_NUM_CIPHER_SUITES table_num_entries ( TLS_CIPHER_SUITES ) |
Number of supported cipher suites.
Definition at line 1199 of file tls.c.
Referenced by tls_client_hello().
| #define TLS_NUM_SIG_HASH_ALGORITHMS table_num_entries ( TLS_SIG_HASH_ALGORITHMS ) |
Number of supported signature and hash algorithms.
Definition at line 1345 of file tls.c.
Referenced by tls_client_hello().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
static |
Regenerate ephemeral master secret.
| tls | TLS connection |
Definition at line 488 of file tls.c.
References tls_connection::client, key, tls_connection::key, tls_client::random, tls_client_random::random, and tls_ephemeral_label().
Referenced by tls_close(), and tls_restart().
|
static |
Resume TX state machine for all connections within a session.
| session | TLS session |
Definition at line 1925 of file tls.c.
References tls_session::conn, tls_connection::list, list_for_each_entry, tls_connection::session, and tls_tx_resume().
Referenced by tls_close(), and tls_new_finished().
|
static |
Allocate I/O buffer for transmitted record(s).
| tls | TLS connection |
| len | I/O buffer payload length |
| iobuf | I/O buffer |
Definition at line 3472 of file tls.c.
References tls_connection::cipherstream, iob_reserve, len, NULL, tls_iob_reserved(), and xfer_alloc_iob().
Referenced by tls_send_certificate(), and tls_send_plaintext().
|
static |
Transmit Handshake record.
| rc | Return status code |
Definition at line 1963 of file tls.c.
References data, len, tls_send_plaintext(), and TLS_TYPE_HANDSHAKE.
Referenced by tls_send_certificate_verify(), tls_send_client_hello(), tls_send_client_key_exchange_dhe(), tls_send_client_key_exchange_ecdhe(), tls_send_client_key_exchange_pubkey(), and tls_send_finished().
|
static |
Transmit Alert record.
| tls | TLS connection |
| level | Alert level |
| description | Alert description |
| rc | Return status code |
Definition at line 2406 of file tls.c.
References __attribute__, alert(), tls_send_plaintext(), and TLS_TYPE_ALERT.
Referenced by tls_close_alert().
|
static |
Send plaintext record(s).
| tls | TLS connection |
| type | Record type |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 3499 of file tls.c.
References __attribute__, tls_cipherspec_pair::active, assert, cipher_algorithm::authsize, cipher_algorithm::blocksize, tls_cipher_suite::cipher, cipher_auth(), tls_cipherspec::cipher_ctx, cipher_encrypt, cipher_setiv(), tls_tx::cipherspec, tls_connection::cipherstream, cpu_to_be64, io_buffer::data, DBGC, DBGC2, DBGC2_HDA, tls_cipher_suite::digest, digest_algorithm::digestsize, fixed, tls_cipherspec::fixed_iv, tls_cipher_suite::fixed_iv_len, free_iob(), tls_auth_header::header, htons, iob_disown, iob_len(), iob_push, iob_put, iob_unput, is_auth_cipher(), is_block_cipher(), iv, len, tls_header::length, mac, tls_cipher_suite::mac_len, memcpy(), memmove(), memset(), NULL, rc, tls_cipher_suite::record_iv_len, tls_auth_header::seq, tls_tx::seq, strerror(), tls_cipherspec::suite, tls_add_handshake(), tls_ephemeral(), tls_hmac(), tls_iob_reserved(), TLS_TX_BUFSIZE, TLS_TYPE_HANDSHAKE, tls_connection::tx, tls_header::type, type, tls_connection::version, tls_header::version, and xfer_deliver_iob().
Referenced by tls_plainstream_deliver(), tls_send_certificate(), and tls_send_plaintext().
|
static |
Send plaintext record.
| rc | Return status code |
Definition at line 3646 of file tls.c.
References data, ENOMEM_TX_PLAINTEXT, iob_disown, iob_put, len, memcpy(), rc, tls_alloc_iob(), tls_send_record(), and type.
Referenced by tls_send_alert(), tls_send_change_cipher(), and tls_send_handshake().
|
static |
References out.
Referenced by add_tls(), free_tls(), tls_change_cipher(), and tls_set_cipher().
|
static |
Clear key schedule digest algorithm.
| tls | TLS connection |
Definition at line 542 of file tls.c.
References digest_null, key, tls_connection::key, NULL, tls_clear_binding(), and zfree().
Referenced by add_tls(), free_tls(), and tls_set_digest().
|
static |
Calculate handshake verification hash.
| tls | TLS connection |
| out | Output buffer |
Calculates the digest over all handshake messages seen so far.
Definition at line 1174 of file tls.c.
References ctx, digest_algorithm::ctxsize, digest_final(), key, tls_connection::key, memcpy(), and out.
Referenced by tls_generate_master_secret(), tls_new_finished(), tls_send_certificate_verify(), and tls_send_finished().
|
inlinestatic |
Extract 24-bit field value.
| field24 | 24-bit field |
| value | Field value |
Definition at line 251 of file tls.c.
References be16_to_cpu, tls24_t::high, and tls24_t::low.
Referenced by tls_new_certificate(), tls_new_handshake(), and tls_parse_chain().
|
static |
Set 24-bit field value.
| field24 | 24-bit field |
| value | Field value |
Definition at line 262 of file tls.c.
References cpu_to_be16, tls24_t::high, tls24_t::low, and value.
Referenced by tls_send_certificate().
|
static |
Determine if TLS connection is ready for application data.
| tls | TLS connection |
| is_ready | TLS connection is ready |
Definition at line 274 of file tls.c.
References tls_connection::client, is_pending(), tls_client::negotiation, tls_server::negotiation, and tls_connection::server.
Referenced by tls_cipherstream_window(), tls_new_data(), tls_new_hello_request(), tls_plainstream_deliver(), and tls_plainstream_window().
|
inlinestatic |
Check for TLS version.
| tls | TLS connection |
| version | TLS version |
| at_least | TLS connection is using at least the specified version |
Check that TLS connection uses at least the specified protocol version. Optimise down to a compile-time constant true result if this is already guaranteed by the minimum supported version check.
Definition at line 291 of file tls.c.
References TLS_VERSION_MIN, tls_connection::version, and version.
Referenced by tls_generate_resumption_master(), tls_prf(), tls_select_cipher(), tls_send_certificate_verify(), tls_set_digest(), tls_set_kdf_master(), and tls_verify_dh_params().
|
static |
Free TLS session.
| refcnt | Reference counter |
Definition at line 308 of file tls.c.
References assert, tls_session::cert, tls_session::conn, container_of, tls_session::key, tls_session::list, list_del, list_empty, privkey_put(), tls_session::root, tls_session::ticket, x509_put(), x509_root_put(), and zfree().
Referenced by tls_session().
|
static |
Free TLS connection.
| refcnt | Reference counter |
Definition at line 333 of file tls.c.
References tls_cipherspec_pair::active, assert, tls_client::chain, tls_server::chain, tls_rx::cipherspec, tls_tx::cipherspec, tls_connection::client, container_of, tls_rx::data, free_iob(), tls_rx::handshake, tls_client::key, io_buffer::list, tls_connection::list, list_del, list_empty, list_for_each_entry_safe, tls_connection::new_session_ticket, tls_cipherspec_pair::pending, privkey_put(), ref_put, tls_session::refcnt, tls_server::root, tls_connection::rx, tls_connection::server, tls_connection::session, tls_clear_cipher(), tls_clear_digest(), tmp, tls_connection::tx, x509_chain_put(), x509_root_put(), and zfree().
Referenced by add_tls().
|
static |
Finish with TLS connection.
| tls | TLS connection |
| rc | Status code |
Definition at line 371 of file tls.c.
References tls_connection::cipherstream, tls_connection::client, INIT_LIST_HEAD, intf_shutdown(), tls_connection::list, list_del, tls_client::negotiation, tls_server::negotiation, pending_put(), tls_connection::plainstream, tls_tx::process, process_del(), rc, tls_connection::server, tls_connection::session, tls_regenerate_ephemeral_master(), tls_tx_resume_all(), tls_connection::tx, tls_server::validation, and tls_server::validator.
Referenced by tls_close_alert(), and tls_new_alert().
|
static |
Send closure alert and finish with TLS connection.
| tls | TLS connection |
| rc | Status code |
Definition at line 403 of file tls.c.
References rc, TLS_ALERT_CLOSE_NOTIFY, TLS_ALERT_WARNING, tls_close(), and tls_send_alert().
Referenced by tls_cipherstream_deliver(), tls_tx_step(), and tls_validator_done().
|
static |
Generate ephemeral master secret.
| tls | TLS connection |
| rc | Return status code |
Definition at line 425 of file tls.c.
References DBGC, hkdf_extract(), key, tls_connection::key, NULL, rbg_generate(), rc, strerror(), and tls_ephemeral_algorithm.
Referenced by add_tls().
|
static |
Generate ephemeral secret.
| tls | TLS connection |
| info | Additional information (or NULL) |
| info_len | Length of additional information |
| out | Ephemeral secret to fill in |
| len | Length of ephemeral secret |
Definition at line 457 of file tls.c.
References hkdf_expand(), info, info_len, key, tls_connection::key, len, out, and tls_ephemeral_algorithm.
Referenced by tls_ephemeral_label(), and tls_send_record().
|
static |
Generate ephemeral secret from label.
| tls | TLS connection |
| label | Secret label |
| out | Ephemeral secret to fill in |
| len | Length of ephemeral secret |
Definition at line 474 of file tls.c.
References DBGC2, DBGC2_HDA, len, out, strlen(), and tls_ephemeral().
Referenced by tls_agree_ephemeral(), tls_regenerate_ephemeral_master(), tls_send_client_key_exchange_pubkey(), tls_session(), tls_set_digest(), and tls_share_ephemeral().
|
static |
Clear key schedule binding.
| tls | TLS connection |
Definition at line 505 of file tls.c.
References key, tls_connection::key, NULL, and x509_put().
Referenced by tls_agree_ephemeral(), tls_clear_digest(), tls_send_client_key_exchange_pubkey(), and tls_set_binding().
|
static |
Bind key schedule to a server identity.
| tls | TLS connection |
| cert | Server certificate |
Definition at line 519 of file tls.c.
References DBGC, key, tls_connection::key, tls_clear_binding(), x509_get(), and x509_name().
Referenced by tls_resume_secret(), tls_send_client_key_exchange_pubkey(), and tls_verify_dh_params().
|
static |
Set key schedule digest algorithm.
| tls | TLS connection |
| digest | Key schedule digest algorithm |
| rc | Return status code |
Definition at line 566 of file tls.c.
References assert, digest_algorithm::ctxsize, tls_key_schedule::digest, digest_init(), tls_key_schedule::dynamic, ENOMEM, hmac_keysize(), key, tls_connection::key, tls_clear_digest(), tls_ephemeral_label(), tls_version(), TLS_VERSION_TLS_1_2, and zalloc().
Referenced by tls_select_cipher().
|
static |
Update HMAC with a list of ( data, len ) pairs.
| digest | Hash function to use |
| ctx | HMAC context |
| args | ( data, len ) pairs of data, terminated by NULL |
Definition at line 616 of file tls.c.
References ctx, data, hmac_update(), len, and va_arg.
Referenced by tls_p_hash_va().
|
static |
Generate secure pseudo-random data using a single hash function.
| tls | TLS connection |
| digest | Hash function to use |
| hkey | HMAC key |
| out | Output buffer |
| out_len | Length of output buffer |
| seeds | ( data, len ) pairs of seed data, terminated by NULL |
Definition at line 637 of file tls.c.
References ctx, DBGC2, DBGC2_HD, digest_algorithm::digestsize, hmac_ctxsize(), hmac_final(), hmac_init_key(), hmac_update(), memcpy(), digest_algorithm::name, out, tls_hmac_update_va(), tmp, va_copy, and va_end.
Referenced by tls_prf().
|
static |
Generate secure pseudo-random data.
| tls | TLS connection |
| out | Output buffer |
| out_len | Length of output buffer |
| ... | ( data, len ) pairs of seed data, terminated by NULL |
Definition at line 693 of file tls.c.
References key, tls_connection::key, md5_sha1_hmac_keys::md5, md5_algorithm, out, md5_sha1_hmac_keys::sha1, sha1_algorithm, tls_p_hash_va(), tls_version(), TLS_VERSION_TLS_1_2, tmp, va_copy, va_end, and va_start.
|
static |
Set key derivation function master secret.
| tls | TLS connection |
| secret | Secret |
| secret_len | Length of secret |
Definition at line 757 of file tls.c.
References assert, ctx, DBGC2, DBGC2_HD, hmac_ctxsize(), hmac_key(), key, tls_connection::key, md5_sha1_hmac_keys::md5, md5_algorithm, md5_sha1_algorithm, md5_sha1_hmac_keys::sha1, sha1_algorithm, tls_version(), and TLS_VERSION_TLS_1_2.
Referenced by tls_agree_ephemeral(), tls_generate_master_secret(), tls_resume_secret(), and tls_send_client_key_exchange_pubkey().
|
static |
Share ephemeral public key.
| tls | TLS connection |
| public | Public key to fill in |
| rc | Return status code |
Definition at line 803 of file tls.c.
References DBGC, exchange_share(), group, key, tls_connection::key, memset(), exchange_algorithm::name, exchange_algorithm::privsize, rc, strerror(), tls_ephemeral_label(), and tmp.
Referenced by tls_send_client_key_exchange_dhe(), and tls_send_client_key_exchange_ecdhe().
|
static |
Agree ephemeral public key (i.e.
pre-master secret)
| tls | TLS connection |
| partner | Partner public key |
| partner_len | Length of partner public key |
| strip | Strip/pad leading zeros |
| rc | Return status code |
Definition at line 837 of file tls.c.
References DBGC, DBGC_HDA, EINVAL_KEY_EXCHANGE, ENOMEM, exchange_agree(), group, key, tls_connection::key, memcpy(), memset(), exchange_algorithm::name, partner, exchange_algorithm::privsize, exchange_algorithm::pubsize, rc, exchange_algorithm::sharedsize, strerror(), tls_clear_binding(), tls_ephemeral_label(), tls_set_kdf_master(), tmp, zalloc(), and zfree().
Referenced by tls_new_server_key_exchange_dhe(), and tls_new_server_key_exchange_ecdhe().
|
static |
Generate master secret.
| tls | TLS connection |
The client and server random values must already be known.
Definition at line 927 of file tls.c.
References assert, tls_connection::client, DBGC, DBGC_HD, digest_algorithm::digestsize, tls_connection::extended_master_secret, key, tls_connection::key, tls_client::random, tls_server::random, tls_connection::server, tls_prf_label, tls_set_kdf_master(), and tls_verify_handshake().
Referenced by tls_send_client_key_exchange().
|
static |
Generate key material.
| tls | TLS connection |
The master secret must already be known.
Definition at line 978 of file tls.c.
References assert, tls_key_schedule::bound, tls_cipher_suite::cipher, tls_cipherspec::cipher_ctx, cipher_setkey(), tls_rx::cipherspec, tls_tx::cipherspec, tls_connection::client, DBGC, DBGC_HD, tls_cipherspec::fixed_iv, tls_cipher_suite::fixed_iv_len, key, tls_connection::key, tls_cipher_suite::key_len, tls_key_schedule::keyed, tls_cipher_suite::mac_len, tls_cipherspec::mac_secret, memcpy(), tls_cipherspec_pair::pending, tls_client::random, tls_server::random, rc, tls_connection::rx, tls_connection::server, strerror(), tls_cipherspec::suite, tls_prf_label, and tls_connection::tx.
Referenced by tls_new_server_hello(), and tls_send_client_key_exchange().
|
static |
Generate resumption master secret.
| tls | TLS connection |
Definition at line 1059 of file tls.c.
References __attribute__, assert, hmac_keysize(), key, tls_connection::key, md5_sha1_hmac_keys::md5, md5_algorithm, md5_sha1_algorithm, memcpy(), tls_session::resumption_master_secret, tls_session::resumption_master_secret_len, tls_server::root, tls_connection::server, tls_connection::session, md5_sha1_hmac_keys::sha1, sha1_algorithm, tls_version(), TLS_VERSION_TLS_1_2, and x509_is_valid().
Referenced by tls_new_finished().
|
static |
Resume from resumption master secret.
| tls | TLS connection |
Definition at line 1119 of file tls.c.
References assert, tls_session::cert, key, tls_connection::key, len, tls_session::resumption_master_secret, tls_session::resumption_master_secret_len, tls_connection::session, tls_set_binding(), and tls_set_kdf_master().
Referenced by tls_new_server_hello().
|
static |
Add handshake record to verification hash.
| rc | Return status code |
Definition at line 1157 of file tls.c.
References data, digest_update(), key, tls_connection::key, and len.
Referenced by tls_new_handshake(), tls_new_server_hello(), and tls_send_record().
|
static |
Identify cipher suite.
| cipher_suite | Cipher suite specification |
| suite | Cipher suite, or NULL |
Definition at line 1208 of file tls.c.
References tls_cipher_suite::code, for_each_table_entry, NULL, and TLS_CIPHER_SUITES.
Referenced by tls_select_cipher().
|
static |
Clear cipher suite.
| cipherspec | TLS cipher specification |
Definition at line 1225 of file tls.c.
References __unused, tls_cipherspec::dynamic, memset(), tls_cipherspec::suite, tls_cipher_suite_null, and zfree().
|
static |
Set cipher suite.
| tls | TLS connection |
| cipherspec | TLS cipher specification |
| suite | Cipher suite |
| rc | Return status code |
Definition at line 1241 of file tls.c.
References assert, tls_cipher_suite::cipher, tls_cipherspec::cipher_ctx, cipher_algorithm::ctxsize, DBGC, tls_cipherspec::dynamic, ENOMEM_CONTEXT, tls_cipherspec::fixed_iv, tls_cipher_suite::fixed_iv_len, tls_cipher_suite::mac_len, tls_cipherspec::mac_secret, tls_cipherspec::suite, tls_clear_cipher(), and zalloc().
Referenced by tls_select_cipher().
|
static |
Select next cipher suite.
| tls | TLS connection |
| cipher_suite | Cipher suite specification |
| rc | Return status code |
Definition at line 1280 of file tls.c.
References tls_cipher_suite::cipher, tls_rx::cipherspec, tls_tx::cipherspec, DBGC, tls_cipher_suite::digest, ENOTSUP_CIPHER, tls_cipher_suite::exchange, tls_cipher_suite::handshake, tls_cipher_suite::key_len, md5_sha1_algorithm, cipher_algorithm::name, digest_algorithm::name, pubkey_algorithm::name, tls_key_exchange_algorithm::name, ntohs, tls_cipherspec_pair::pending, tls_cipher_suite::pubkey, rc, tls_connection::rx, tls_find_cipher_suite(), tls_set_cipher(), tls_set_digest(), tls_version(), TLS_VERSION_TLS_1_2, and tls_connection::tx.
Referenced by tls_new_server_hello().
|
static |
Activate next cipher suite.
| tls | TLS connection |
| pair | Cipher specification pair |
| rc | Return status code |
Definition at line 1323 of file tls.c.
References tls_cipherspec_pair::active, DBGC, ENOTSUP_NULL, memswap(), tls_cipherspec_pair::pending, tls_cipherspec::suite, tls_cipher_suite_null, and tls_clear_cipher().
Referenced by tls_new_change_cipher(), and tls_tx_step().
|
static |
Find TLS signature and hash algorithm.
| pubkey | Public-key algorithm |
| digest | Digest algorithm |
| sig_hash | Signature and hash algorithm, or NULL |
Definition at line 1356 of file tls.c.
References tls_signature_hash_algorithm::digest, for_each_table_entry, NULL, tls_signature_hash_algorithm::pubkey, and TLS_SIG_HASH_ALGORITHMS.
Referenced by tls_send_certificate_verify().
|
static |
Find TLS signature and hash algorithm.
| code | Signature and hash algorithm identifier |
| sig_hash | Signature and hash algorithm, or NULL |
Definition at line 1378 of file tls.c.
References code, tls_signature_hash_algorithm::code, for_each_table_entry, NULL, and TLS_SIG_HASH_ALGORITHMS.
Referenced by tls_verify_dh_params().
|
static |
Identify named key exchange group.
| named_group | Named group specification |
| group | Named group, or NULL |
Definition at line 1404 of file tls.c.
References for_each_table_entry, group, NULL, and TLS_NAMED_GROUPS.
Referenced by tls_new_server_key_exchange_ecdhe().
|
static |
Identify named key exchange group by Diffie-Hellman parameters.
| dh_p | Prime modulus |
| dh_p_len | Length of prime modulus |
| dh_g | Generator |
| dh_g_len | Length of generator |
| group | Named group, or NULL |
Definition at line 1426 of file tls.c.
References ffdhe_has_params(), for_each_table_entry, group, is_ffdhe(), NULL, and TLS_NAMED_GROUPS.
Referenced by tls_new_server_key_exchange_dhe().
|
static |
Verify Diffie-Hellman parameter signature.
| tls | TLS connection |
| data | Server Key Exchange handshake record |
| len | Length of Server Key Exchange handshake record |
| param_len | Length of Diffie-Hellman parameters |
| rc | Return status code |
Definition at line 1451 of file tls.c.
References __attribute__, tls_signature_hash_algorithm::algorithm, x509_public_key::algorithm, assert, tls_server::chain, tls_tx::cipherspec, tls_connection::client, ctx, digest_algorithm::ctxsize, data, DBGC, DBGC_HDA, tls_signature_hash_algorithm::digest, digest_final(), digest_init(), digest_update(), digest_algorithm::digestsize, EINVAL_KEY_EXCHANGE, ENOENT_CERT, ENOTSUP_SIG_HASH, EPERM_KEY_EXCHANGE, hash, len, md5_sha1_algorithm, asn1_algorithm::name, digest_algorithm::name, pubkey_algorithm::name, ntohs, tls_cipherspec_pair::pending, tls_cipher_suite::pubkey, tls_signature_hash_algorithm::pubkey, pubkey_verify(), x509_subject::public_key, tls_client::random, tls_server::random, x509_public_key::raw, rc, tls_connection::server, sig, signature, x509_certificate::subject, tls_cipherspec::suite, tls_find_signature_hash(), tls_set_binding(), tls_version(), TLS_VERSION_TLS_1_2, tls_connection::tx, and x509_first().
Referenced by tls_new_server_key_exchange_dhe(), and tls_new_server_key_exchange_ecdhe().
|
static |
Receive new Server Key Exchange record using public key transport.
| tls | TLS connection |
| data | Server Key Exchange handshake record |
| len | Length of Server Key Exchange handshake record |
| rc | Return status code |
Definition at line 1558 of file tls.c.
|
static |
Transmit Client Key Exchange record using public key exchange.
| tls | TLS connection |
| rc | Return status code |
Definition at line 1573 of file tls.c.
References __attribute__, asn1_prepend_raw(), tls_server::chain, tls_tx::cipherspec, cpu_to_le32, asn1_builder::data, DBGC, ENOENT_CERT, header, htonl, htons, key, tls_connection::key, asn1_builder::len, NULL, tls_cipherspec_pair::pending, tls_cipher_suite::pubkey, pubkey_encrypt(), x509_subject::public_key, random(), x509_public_key::raw, rc, tls_connection::server, strerror(), x509_certificate::subject, tls_cipherspec::suite, tls_clear_binding(), TLS_CLIENT_KEY_EXCHANGE, tls_ephemeral_label(), tls_send_handshake(), tls_set_binding(), tls_set_kdf_master(), TLS_VERSION_MAX, tls_connection::tx, version, x509_first(), and zfree().
|
static |
Receive new Server Key Exchange record using DHE key exchange.
| tls | TLS connection |
| data | Server Key Exchange handshake record |
| len | Length of Server Key Exchange handshake record |
| rc | Return status code |
Definition at line 1679 of file tls.c.
References __attribute__, data, DBGC, DBGC_HDA, EINVAL_KEY_EXCHANGE, ENOTSUP_GROUP, group, tls_key_schedule::group, tls_connection::key, len, exchange_algorithm::name, ntohs, param, rc, tls_agree_ephemeral(), tls_find_param_group(), tls_verify_dh_params(), and typeof().
|
static |
Transmit Client Key Exchange record using DHE key exchange.
| tls | TLS connection |
| rc | Return status code |
Definition at line 1751 of file tls.c.
References __attribute__, cpu_to_le32, ENOMEM, group, htonl, htons, key, tls_connection::key, malloc(), exchange_algorithm::pubsize, rc, TLS_CLIENT_KEY_EXCHANGE, tls_send_handshake(), tls_share_ephemeral(), and zfree().
|
static |
Receive new Server Key Exchange record using ECDHE key exchange.
| tls | TLS connection |
| data | Server Key Exchange handshake record |
| len | Length of Server Key Exchange handshake record |
| rc | Return status code |
Definition at line 1807 of file tls.c.
References __attribute__, data, DBGC, DBGC_HDA, EINVAL_KEY_EXCHANGE, ENOTSUP_GROUP, group, tls_key_schedule::group, tls_connection::key, len, exchange_algorithm::name, ntohs, rc, tls_agree_ephemeral(), tls_find_named_group(), TLS_NAMED_CURVE_TYPE, and tls_verify_dh_params().
|
static |
Transmit Client Key Exchange record using ECDHE key exchange.
| tls | TLS connection |
| rc | Return status code |
Definition at line 1867 of file tls.c.
References __attribute__, cpu_to_le32, group, htonl, key, tls_connection::key, exchange_algorithm::pubsize, rc, TLS_CLIENT_KEY_EXCHANGE, tls_send_handshake(), and tls_share_ephemeral().
|
static |
Resume TX state machine.
| tls | TLS connection |
Definition at line 1916 of file tls.c.
References tls_tx::process, process_add(), and tls_connection::tx.
Referenced by tls_new_finished(), tls_restart(), tls_tx_resume_all(), tls_tx_step(), and tls_validator_done().
|
static |
Restart negotiation.
| tls | TLS connection |
Definition at line 1937 of file tls.c.
References assert, tls_connection::client, is_pending(), tls_client::negotiation, tls_server::negotiation, tls_tx::pending, pending_get(), tls_connection::server, tls_regenerate_ephemeral_master(), TLS_TX_CLIENT_HELLO, tls_tx_resume(), tls_connection::tx, and tls_server::validation.
Referenced by add_tls(), and tls_new_hello_request().
|
static |
Digest or transmit Client Hello record.
| tls | TLS connection |
| action | Action to take on Client Hello record |
| rc | Return status code |
Definition at line 1977 of file tls.c.
References __attribute__, assert, tls_connection::client, tls_verify_data::client, code, tls_cipher_suite::code, tls_signature_hash_algorithm::code, cpu_to_le32, data, for_each_table_entry, group, hello, htonl, htons, len, tls_session::list, max, memcpy(), memset(), name, tls_session::name, random(), tls_client::random, tls_connection::secure_renegotiation, tls_connection::session, tls_connection::session_id, tls_connection::session_id_len, strlen(), tls_session::ticket, tls_session::ticket_len, TLS_CIPHER_SUITES, TLS_CLIENT_HELLO, TLS_EXTENDED_MASTER_SECRET, TLS_MAX_FRAGMENT_LENGTH, TLS_MAX_FRAGMENT_LENGTH_VALUE, TLS_NAMED_GROUP, TLS_NAMED_GROUPS, TLS_NUM_CIPHER_SUITES, TLS_NUM_NAMED_GROUPS, TLS_NUM_SIG_HASH_ALGORITHMS, TLS_RENEGOTIATION_INFO, TLS_SERVER_NAME, TLS_SERVER_NAME_HOST_NAME, TLS_SESSION_TICKET, TLS_SIG_HASH_ALGORITHMS, TLS_SIGNATURE_ALGORITHMS, TLS_VERSION_MAX, type, typeof(), tls_connection::verify, and version.
Referenced by tls_new_server_hello(), and tls_send_client_hello().
|
static |
Transmit Client Hello record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2160 of file tls.c.
References tls_client_hello(), and tls_send_handshake().
Referenced by tls_tx_step().
|
static |
Transmit Certificate record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2171 of file tls.c.
References __attribute__, tls_client::chain, tls_connection::client, cpu_to_le32, asn1_cursor::data, data, DBGC, ENOMEM_CERTIFICATE, htonl, iob_disown, iob_put, asn1_cursor::len, len, length, link, x509_chain::links, io_buffer::list, list_for_each_entry, memcpy(), x509_certificate::raw, tls_alloc_iob(), TLS_CERTIFICATE, tls_send_record(), tls_set_uint24(), TLS_TYPE_HANDSHAKE, typeof(), and x509_name().
Referenced by tls_tx_step().
|
static |
Transmit Client Key Exchange record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2228 of file tls.c.
References tls_tx::cipherspec, tls_key_exchange_algorithm::client, DBGC, tls_cipher_suite::exchange, tls_cipherspec_pair::pending, rc, strerror(), tls_cipherspec::suite, tls_generate_keys(), tls_generate_master_secret(), and tls_connection::tx.
Referenced by tls_tx_step().
|
static |
Transmit Certificate Verify record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2259 of file tls.c.
References __attribute__, asn1_prepend_raw(), tls_client::chain, tls_connection::client, tls_signature_hash_algorithm::code, cpu_to_le32, asn1_builder::data, DBGC, tls_key_schedule::digest, digest_algorithm::digestsize, ENOTSUP_SIG_HASH, header, htonl, htons, key, tls_client::key, tls_connection::key, asn1_builder::len, memcpy(), digest_algorithm::name, pubkey_algorithm::name, NULL, privkey_cursor(), asn1_algorithm::pubkey, pubkey_sign(), rc, x509_certificate::signature_algorithm, strerror(), TLS_CERTIFICATE_VERIFY, tls_send_handshake(), tls_signature_hash_algorithm(), tls_verify_handshake(), tls_version(), TLS_VERSION_TLS_1_2, x509_first(), and zfree().
Referenced by tls_tx_step().
|
static |
Transmit Change Cipher record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2340 of file tls.c.
References __attribute__, spec, TLS_CHANGE_CIPHER_SPEC, tls_send_plaintext(), and TLS_TYPE_CHANGE_CIPHER.
Referenced by tls_tx_step().
|
static |
Transmit Finished record.
| tls | TLS connection |
| rc | Return status code |
Definition at line 2357 of file tls.c.
References __attribute__, tls_connection::client, tls_verify_data::client, cpu_to_le32, DBGC, tls_key_schedule::digest, digest_algorithm::digestsize, EPERM_BOUND, htonl, key, tls_connection::key, memcpy(), memset(), tls_client::negotiation, pending_put(), rc, tls_server::root, tls_connection::server, TLS_FINISHED, tls_prf_label, tls_send_handshake(), tls_verify_handshake(), tls_connection::verify, and x509_is_valid().
Referenced by tls_tx_step().
|
static |
Receive new Change Cipher record.
| tls | TLS connection |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 2428 of file tls.c.
References __attribute__, tls_rx::cipherspec, io_buffer::data, DBGC, DBGC_HD, EINVAL_CHANGE_CIPHER, iob_len(), iob_pull, len, rc, tls_connection::rx, tls_rx::seq, spec, strerror(), tls_change_cipher(), and TLS_CHANGE_CIPHER_SPEC.
Referenced by tls_new_record().
|
static |
Receive new Alert record.
| tls | TLS connection |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 2463 of file tls.c.
References __attribute__, alert(), io_buffer::data, DBGC, DBGC_HD, EINVAL_ALERT, EIO_ALERT, EPERM_ALERT, iob_len(), iob_pull, len, next, TLS_ALERT_CLOSE_NOTIFY, TLS_ALERT_FATAL, TLS_ALERT_WARNING, and tls_close().
Referenced by tls_new_record().
|
static |
Receive new Hello Request handshake record.
| rc | Return status code |
Definition at line 2513 of file tls.c.
References __unused, data, DBGC, EPERM_RENEG_INSECURE, tls_connection::extended_master_secret, len, tls_connection::secure_renegotiation, tls_ready(), and tls_restart().
Referenced by tls_new_handshake().
|
static |
Receive new Server Hello handshake record.
| rc | Return status code |
Definition at line 2544 of file tls.c.
References __attribute__, data, DBGC, DBGC_HD, DBGC_HDA, EINVAL_HELLO, ENOTSUP_VERSION, EPERM_EMS, EPERM_RENEG_VERIFY, EPROTO_VERSION, ext, tls_connection::extended_master_secret, tls_session::extended_master_secret, htons, len, memcmp(), memcpy(), next, ntohs, NULL, random(), tls_server::random, rc, tls_connection::secure_renegotiation, tls_connection::server, tls_connection::session, tls_connection::session_id, tls_connection::session_id_len, tls_add_handshake(), tls_client_hello(), TLS_EXTENDED_MASTER_SECRET, tls_generate_keys(), TLS_RENEGOTIATION_INFO, tls_resume_secret(), tls_select_cipher(), TLS_VERSION_MIN, type, tls_connection::verify, tls_connection::version, and version.
Referenced by tls_new_handshake().
|
static |
Receive New Session Ticket handshake record.
| rc | Return status code |
Definition at line 2747 of file tls.c.
References __attribute__, data, DBGC, DBGC_HD, DBGC_HDA, EINVAL_TICKET, ENOMEM, len, lifetime, malloc(), memcpy(), tls_connection::new_session_ticket, tls_connection::new_session_ticket_len, ntohs, NULL, and zfree().
Referenced by tls_new_handshake().
|
static |
Parse certificate chain.
| rc | Return status code |
Definition at line 2798 of file tls.c.
References __attribute__, tls_key_schedule::bound, tls_server::chain, data, DBGC, DBGC_HDA, EINVAL_CERTIFICATE, ENOENT_CERT, ENOMEM_CHAIN, tls_connection::key, len, length, tls_session::name, NULL, rc, tls_connection::server, tls_connection::session, strerror(), tls_uint24(), x509_alloc_chain(), x509_append_raw(), x509_chain_put(), x509_check_name(), x509_first(), x509_last(), and x509_name().
Referenced by tls_new_certificate().
|
static |
Receive new Certificate handshake record.
| rc | Return status code |
Definition at line 2899 of file tls.c.
References __attribute__, data, DBGC, DBGC_HD, EINVAL_CERTIFICATES, len, length, rc, tls_parse_chain(), and tls_uint24().
Referenced by tls_new_handshake().
|
static |
Receive new Server Key Exchange handshake record.
| rc | Return status code |
Definition at line 2939 of file tls.c.
References tls_tx::cipherspec, data, tls_cipher_suite::exchange, len, tls_cipherspec_pair::pending, rc, tls_key_exchange_algorithm::server, tls_cipherspec::suite, and tls_connection::tx.
Referenced by tls_new_handshake().
|
static |
Receive new Certificate Request handshake record.
| rc | Return status code |
Definition at line 2960 of file tls.c.
References __unused, certstore, tls_client::chain, tls_connection::client, data, DBGC, ENOMEM, tls_client::key, len, NULL, rc, x509_alloc_chain(), x509_append(), x509_auto_append(), x509_chain_put(), x509_find_key(), and x509_name().
Referenced by tls_new_handshake().
|
static |
Receive new Server Hello Done handshake record.
| rc | Return status code |
Definition at line 3020 of file tls.c.
References __attribute__, tls_server::chain, create_validator(), data, DBGC, DBGC_HD, EINVAL_HELLO_DONE, len, next, pending_get(), rc, tls_server::root, tls_connection::server, strerror(), tls_server::validation, and tls_server::validator.
Referenced by tls_new_handshake().
|
static |
Receive new Finished handshake record.
| rc | Return status code |
Definition at line 3056 of file tls.c.
References __attribute__, tls_session::cert, tls_connection::client, tls_session::conn, data, DBGC, DBGC_HDA, tls_key_schedule::digest, digest_algorithm::digestsize, EINVAL_FINISHED, EPERM_VERIFY, tls_connection::extended_master_secret, tls_session::extended_master_secret, tls_session::id, tls_session::id_len, is_pending(), key, tls_connection::key, len, tls_connection::list, list_add_tail, list_del, memcmp(), memcpy(), tls_client::negotiation, tls_server::negotiation, tls_connection::new_session_ticket, tls_connection::new_session_ticket_len, next, NULL, tls_tx::pending, pending_put(), tls_connection::plainstream, tls_server::root, tls_connection::server, tls_verify_data::server, tls_connection::session, tls_connection::session_id, tls_connection::session_id_len, tls_session::ticket, tls_session::ticket_len, tls_generate_resumption_master(), tls_prf_label, TLS_TX_CHANGE_CIPHER, TLS_TX_FINISHED, tls_tx_resume(), tls_tx_resume_all(), tls_verify_handshake(), tls_connection::tx, tls_connection::verify, x509_get(), x509_is_valid(), x509_put(), xfer_window_changed(), and zfree().
Referenced by tls_new_handshake().
|
static |
Receive new Handshake record.
| tls | TLS connection |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 3142 of file tls.c.
References __attribute__, io_buffer::data, DBGC, iob_len(), iob_pull, length, rc, tls_add_handshake(), TLS_CERTIFICATE, TLS_CERTIFICATE_REQUEST, TLS_FINISHED, TLS_HELLO_REQUEST, tls_new_certificate(), tls_new_certificate_request(), tls_new_finished(), tls_new_hello_request(), tls_new_server_hello(), tls_new_server_hello_done(), tls_new_server_key_exchange(), TLS_NEW_SESSION_TICKET, tls_new_session_ticket(), TLS_SERVER_HELLO, TLS_SERVER_HELLO_DONE, TLS_SERVER_KEY_EXCHANGE, tls_uint24(), and type.
Referenced by tls_new_record().
|
static |
Receive new unknown record.
| tls | TLS connection |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 3232 of file tls.c.
References __unused, iob_len(), and iob_pull.
Referenced by tls_new_record().
|
static |
Receive new data record.
| tls | TLS connection |
| rx_data | List of received data buffers |
| rc | Return status code |
Definition at line 3247 of file tls.c.
References DBGC, ENOTCONN, io_buffer::list, list_del, list_first_entry, tls_connection::plainstream, rc, strerror(), tls_ready(), and xfer_deliver_iob().
Referenced by tls_new_record().
|
static |
Receive new record.
| tls | TLS connection |
| type | Record type |
| rx_data | List of received data buffers |
| rc | Return status code |
Definition at line 3279 of file tls.c.
References assert, DBGC, ENOMEM_RX_CONCAT, free_iob(), tls_rx::handshake, iob_concatenate(), iob_len(), list_add, NULL, rc, tls_connection::rx, tls_new_alert(), tls_new_change_cipher(), tls_new_data(), tls_new_handshake(), tls_new_unknown(), TLS_TYPE_ALERT, TLS_TYPE_CHANGE_CIPHER, TLS_TYPE_DATA, TLS_TYPE_HANDSHAKE, tmp, and type.
Referenced by tls_new_ciphertext().
|
static |
Initialise HMAC.
| cipherspec | Cipher specification |
| ctx | Context |
| authhdr | Authentication header |
Definition at line 3357 of file tls.c.
References ctx, tls_cipher_suite::digest, hmac_init(), hmac_update(), tls_cipher_suite::mac_len, tls_cipherspec::mac_secret, and tls_cipherspec::suite.
Referenced by tls_hmac(), and tls_hmac_list().
|
static |
Update HMAC.
Definition at line 3374 of file tls.c.
References ctx, data, tls_cipher_suite::digest, hmac_update(), len, and tls_cipherspec::suite.
Referenced by tls_hmac(), and tls_hmac_list().
|
static |
Finalise HMAC.
Definition at line 3388 of file tls.c.
References ctx, tls_cipher_suite::digest, hmac_final(), and tls_cipherspec::suite.
Referenced by tls_hmac(), and tls_hmac_list().
|
static |
Calculate HMAC.
| cipherspec | Cipher specification |
| authhdr | Authentication header |
| data | Data |
| len | Length of data |
| mac | HMAC to fill in |
Definition at line 3404 of file tls.c.
References ctx, data, tls_cipher_suite::digest, hmac_ctxsize(), len, tls_cipherspec::suite, tls_hmac_final(), tls_hmac_init(), and tls_hmac_update().
Referenced by tls_send_record().
|
static |
Calculate HMAC over list of I/O buffers.
| cipherspec | Cipher specification |
| authhdr | Authentication header |
| list | List of I/O buffers |
| mac | HMAC to fill in |
Definition at line 3423 of file tls.c.
References ctx, io_buffer::data, tls_cipher_suite::digest, hmac_ctxsize(), iob_len(), io_buffer::list, list_for_each_entry, tls_cipherspec::suite, tls_hmac_final(), tls_hmac_init(), and tls_hmac_update().
Referenced by tls_new_ciphertext().
|
static |
Calculate maximum additional length required for transmitted record(s).
| tls | TLS connection |
| len | I/O buffer payload length |
| reserve | Maximum additional length to reserve |
Definition at line 3445 of file tls.c.
References tls_cipherspec_pair::active, cipher_algorithm::authsize, cipher_algorithm::blocksize, tls_cipher_suite::cipher, tls_tx::cipherspec, count, is_block_cipher(), len, tls_cipher_suite::mac_len, tls_cipher_suite::record_iv_len, tls_cipherspec::suite, TLS_TX_BUFSIZE, and tls_connection::tx.
Referenced by tls_alloc_iob(), and tls_send_record().
|
static |
Verify block padding.
| tls | TLS connection |
| iobuf | Last received I/O buffer |
Definition at line 3672 of file tls.c.
References io_buffer::data, DBGC, DBGC_HD, EINVAL_PADDING, iob_len(), len, pad, and io_buffer::tail.
Referenced by tls_new_ciphertext().
|
static |
Receive new ciphertext record.
| tls | TLS connection |
| tlshdr | Record header |
| rx_data | List of received data buffers |
| rc | Return status code |
Definition at line 3707 of file tls.c.
References __attribute__, tls_cipherspec_pair::active, assert, cipher_algorithm::authsize, tls_cipher_suite::cipher, cipher_auth(), tls_cipherspec::cipher_ctx, cipher_decrypt, cipher_setiv(), tls_rx::cipherspec, cpu_to_be64, io_buffer::data, tls_rx::data, DBGC, DBGC2, DBGC2_HD, DBGC_HD, tls_cipher_suite::digest, digest_algorithm::digestsize, EINVAL_IV, EINVAL_MAC, first, fixed, tls_cipherspec::fixed_iv, tls_cipher_suite::fixed_iv_len, tls_auth_header::header, htons, iob_len(), iob_pull, iob_unput, is_auth_cipher(), is_block_cipher(), iv, len, tls_header::length, io_buffer::list, list_empty, list_first_entry, list_for_each_entry, list_last_entry, mac, tls_cipher_suite::mac_len, memcmp(), memcpy(), ntohs, NULL, rc, tls_cipher_suite::record_iv_len, tls_connection::rx, tls_auth_header::seq, tls_rx::seq, strerror(), tls_cipherspec::suite, io_buffer::tail, tls_hmac_list(), tls_new_record(), tls_verify_padding(), tls_header::type, and tls_header::version.
Referenced by tls_newdata_process_data().
|
static |
Check flow control window.
| tls | TLS connection |
| len | Length of window |
Definition at line 3858 of file tls.c.
References tls_connection::cipherstream, tls_ready(), and xfer_window().
|
static |
Deliver datagram as raw data.
| tls | TLS connection |
| iobuf | I/O buffer |
| meta | Data transfer metadata |
| rc | Return status code |
Definition at line 3875 of file tls.c.
References __unused, done, ENOTCONN, free_iob(), iob_disown, meta, rc, tls_ready(), tls_send_record(), and TLS_TYPE_DATA.
|
static |
Report job progress.
| tls | TLS connection |
| progress | Progress report to fill in |
| ongoing_rc | Ongoing job status code (if known) |
Definition at line 3903 of file tls.c.
References tls_connection::cipherstream, is_pending(), job_progress(), tls_connection::server, tls_server::validation, and tls_server::validator.
|
static |
Handle received TLS header.
| tls | TLS connection |
| rc | Returned status code |
Definition at line 3943 of file tls.c.
References tls_cipherspec_pair::active, cipher_algorithm::alignsize, alloc_iob_raw(), assert, tls_cipher_suite::cipher, tls_rx::cipherspec, tls_rx::data, data_len, DBGC, ENOMEM_RX_DATA, free_iob(), tls_rx::header, iob_reserve, iob_tailroom(), tls_header::length, io_buffer::list, list_add_tail, list_del, list_empty, list_for_each_entry_safe, ntohs, rc, tls_cipher_suite::record_iv_len, tls_connection::rx, tls_rx::state, tls_cipherspec::suite, TLS_RX_ALIGN, TLS_RX_BUFSIZE, TLS_RX_DATA, TLS_RX_MIN_BUFSIZE, and tmp.
Referenced by tls_cipherstream_deliver().
|
static |
Handle received TLS data payload.
| tls | TLS connection |
| rc | Returned status code |
Definition at line 4026 of file tls.c.
References assert, tls_rx::data, tls_rx::header, iob_tailroom(), iob_unput, tls_rx::iobuf, io_buffer::list, list_add_tail, list_del, list_empty, list_first_entry, rc, tls_connection::rx, tls_rx::seq, tls_rx::state, tls_new_ciphertext(), and TLS_RX_HEADER.
Referenced by tls_cipherstream_deliver().
|
static |
Check flow control window.
| tls | TLS connection |
| len | Length of window |
Definition at line 4062 of file tls.c.
References tls_connection::plainstream, tls_ready(), and xfer_window().
|
static |
Receive new ciphertext.
| tls | TLS connection |
| iobuf | I/O buffer |
| meta | Data transfer metadat |
| rc | Return status code |
Definition at line 4079 of file tls.c.
References __unused, assert, io_buffer::data, tls_rx::data, dest, done, EINVAL_RX_STATE, free_iob(), iob_len(), iob_pull, iob_put, iob_tailroom(), tls_rx::iobuf, io_buffer::list, list_first_entry, memcpy(), NULL, rc, tls_connection::rx, tls_rx::state, tls_close_alert(), tls_newdata_process_data(), tls_newdata_process_header(), TLS_RX_DATA, and TLS_RX_HEADER.
|
static |
Handle certificate validation completion.
| tls | TLS connection |
| rc | Reason for completion |
Definition at line 4158 of file tls.c.
References tls_client::chain, tls_connection::client, DBGC, intf_restart(), x509_chain::links, list_empty, tls_tx::pending, pending_put(), rc, tls_connection::server, strerror(), tls_close_alert(), TLS_TX_CERTIFICATE, TLS_TX_CERTIFICATE_VERIFY, TLS_TX_CHANGE_CIPHER, TLS_TX_CLIENT_KEY_EXCHANGE, TLS_TX_FINISHED, tls_tx_resume(), tls_connection::tx, tls_server::validation, and tls_server::validator.
|
static |
TLS TX state machine.
| tls | TLS connection |
Definition at line 4214 of file tls.c.
References assert, tls_tx::cipherspec, tls_connection::cipherstream, tls_connection::client, tls_session::conn, DBGC, tls_session::id, tls_session::id_len, is_pending(), tls_connection::list, list_for_each_entry, memcpy(), tls_server::negotiation, tls_tx::pending, tls_connection::plainstream, tls_client::random, rc, tls_tx::seq, tls_connection::server, tls_connection::session, tls_connection::session_id, tls_connection::session_id_len, strerror(), tls_change_cipher(), tls_close_alert(), tls_send_certificate(), tls_send_certificate_verify(), tls_send_change_cipher(), tls_send_client_hello(), tls_send_client_key_exchange(), tls_send_finished(), TLS_TX_CERTIFICATE, TLS_TX_CERTIFICATE_VERIFY, TLS_TX_CHANGE_CIPHER, TLS_TX_CLIENT_HELLO, TLS_TX_CLIENT_KEY_EXCHANGE, TLS_TX_FINISHED, tls_tx_resume(), tls_connection::tx, xfer_window(), and xfer_window_changed().
|
static |
Find or create session for TLS connection.
| tls | TLS connection |
| name | Server name |
| rc | Return status code |
Definition at line 4338 of file tls.c.
References tls_connection::client, tls_session::conn, DBGC, ENOMEM, free_tls_session(), INIT_LIST_HEAD, tls_client::key, tls_session::key, tls_session::list, list_add, list_for_each_entry, name, tls_session::name, privkey_get(), rc, ref_get, ref_init, ref_put, tls_session::refcnt, tls_session::resumption_master_secret, tls_server::root, tls_session::root, tls_connection::server, tls_connection::session, strcmp(), strcpy(), strlen(), tls_ephemeral_label(), x509_root_get(), and zalloc().
| int add_tls | ( | struct interface * | xfer, |
| const char * | name, | ||
| struct x509_root * | root, | ||
| struct private_key * | key ) |
Add TLS on an interface.
| xfer | Data transfer interface |
| name | Host name |
| root | Root of trust (or NULL to use default) |
| key | Private key (or NULL to use default) |
| rc | Return status code |
Definition at line 4403 of file tls.c.
References tls_cipherspec_pair::active, tls_rx::cipherspec, tls_tx::cipherspec, tls_connection::cipherstream, tls_connection::client, tls_session::conn, tls_rx::data, ENOMEM, free_tls(), tls_rx::header, INIT_LIST_HEAD, intf_init(), intf_insert(), iob_populate(), tls_rx::iobuf, key, tls_client::key, tls_connection::list, list_add_tail, malloc(), memset(), name, tls_cipherspec_pair::pending, tls_connection::plainstream, privkey_get(), tls_tx::process, process_init_stopped(), rc, ref_init, ref_put, tls_connection::refcnt, root, tls_server::root, root_certificates, tls_connection::rx, tls_connection::server, tls_connection::session, tls_cipherstream_desc, tls_clear_cipher(), tls_clear_digest(), tls_generate_ephemeral_master(), tls_plainstream_desc, tls_process_desc, tls_restart(), tls_validator_desc, TLS_VERSION_MAX, tls_connection::tx, tls_server::validator, tls_connection::version, and x509_root_get().
Referenced by apply_syslogs_settings(), https_filter(), ipair_rx_session(), and REQUIRING_SYMBOL().
| REQUIRE_OBJECT | ( | config_crypto | ) |
| struct tls_cipher_suite tls_cipher_suite_null |
Null cipher suite.
Definition at line 1191 of file tls.c.
Referenced by tls_change_cipher(), and tls_clear_cipher().
| struct tls_key_exchange_algorithm tls_pubkey_exchange_algorithm |
Public key exchange algorithm.
Definition at line 1665 of file tls.c.
Referenced by __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), and __tls_cipher_suite().
| struct tls_key_exchange_algorithm tls_dhe_exchange_algorithm |
Ephemeral Diffie-Hellman key exchange algorithm.
Definition at line 1793 of file tls.c.
Referenced by __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), and __tls_cipher_suite().
| struct tls_key_exchange_algorithm tls_ecdhe_exchange_algorithm |
Ephemeral Elliptic Curve Diffie-Hellman key exchange algorithm.
Definition at line 1898 of file tls.c.
Referenced by __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), and __tls_cipher_suite().
|
static |
TLS plaintext stream interface operations.
|
static |
TLS plaintext stream interface descriptor.
Definition at line 3926 of file tls.c.
Referenced by add_tls().
|
static |
TLS ciphertext stream interface operations.
Definition at line 4130 of file tls.c.
|
static |
TLS ciphertext stream interface descriptor.
Definition at line 4141 of file tls.c.
Referenced by add_tls().
|
static |
TLS certificate validator interface operations.
|
static |
TLS certificate validator interface descriptor.
Definition at line 4198 of file tls.c.
Referenced by add_tls().
|
static |
TLS TX process descriptor.
Definition at line 4321 of file tls.c.
Referenced by add_tls().