45#define TLS_VERSION_TLS_1_1 0x0302
48#define TLS_VERSION_TLS_1_2 0x0303
51#define TLS_VERSION_TLS_1_3 0x0304
54#define TLS_TYPE_CHANGE_CIPHER 20
57#define TLS_CHANGE_CIPHER_SPEC 1
60#define TLS_TYPE_ALERT 21
63#define TLS_TYPE_HANDSHAKE 22
66#define TLS_TYPE_DATA 23
69#define TLS_HELLO_REQUEST 0
70#define TLS_CLIENT_HELLO 1
71#define TLS_SERVER_HELLO 2
72#define TLS_NEW_SESSION_TICKET 4
73#define TLS_CERTIFICATE 11
74#define TLS_SERVER_KEY_EXCHANGE 12
75#define TLS_CERTIFICATE_REQUEST 13
76#define TLS_SERVER_HELLO_DONE 14
77#define TLS_CERTIFICATE_VERIFY 15
78#define TLS_CLIENT_KEY_EXCHANGE 16
79#define TLS_FINISHED 20
82#define TLS_ALERT_WARNING 1
83#define TLS_ALERT_FATAL 2
86#define TLS_ALERT_CLOSE_NOTIFY 0
89#define TLS_RSA_WITH_NULL_MD5 0x0001
90#define TLS_RSA_WITH_NULL_SHA 0x0002
91#define TLS_RSA_WITH_AES_128_CBC_SHA 0x002f
92#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033
93#define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035
94#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039
95#define TLS_RSA_WITH_AES_128_CBC_SHA256 0x003c
96#define TLS_RSA_WITH_AES_256_CBC_SHA256 0x003d
97#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x0067
98#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x006b
99#define TLS_RSA_WITH_AES_128_GCM_SHA256 0x009c
100#define TLS_RSA_WITH_AES_256_GCM_SHA384 0x009d
101#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x009e
102#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x009f
103#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xc009
104#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xc00a
105#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xc013
106#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xc014
107#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xc023
108#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xc024
109#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xc027
110#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xc028
111#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xc02b
112#define TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xc02c
113#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xc02f
114#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xc030
117#define TLS_RSA_SHA1_ALGORITHM 0x0201
118#define TLS_RSA_SHA224_ALGORITHM 0x0301
119#define TLS_ECDSA_SHA224_ALGORITHM 0x0303
120#define TLS_RSA_SHA256_ALGORITHM 0x0401
121#define TLS_ECDSA_SHA256_ALGORITHM 0x0403
122#define TLS_RSA_SHA384_ALGORITHM 0x0501
123#define TLS_ECDSA_SHA384_ALGORITHM 0x0503
124#define TLS_RSA_SHA512_ALGORITHM 0x0601
125#define TLS_ECDSA_SHA512_ALGORITHM 0x0603
126#define TLS_RSA_PSS_RSAE_SHA256_ALGORITHM 0x0804
127#define TLS_RSA_PSS_RSAE_SHA384_ALGORITHM 0x0805
128#define TLS_RSA_PSS_RSAE_SHA512_ALGORITHM 0x0806
129#define TLS_RSA_PSS_PSS_SHA256_ALGORITHM 0x0809
130#define TLS_RSA_PSS_PSS_SHA384_ALGORITHM 0x080a
131#define TLS_RSA_PSS_PSS_SHA512_ALGORITHM 0x080b
134#define TLS_SERVER_NAME 0
135#define TLS_SERVER_NAME_HOST_NAME 0
138#define TLS_MAX_FRAGMENT_LENGTH 1
139#define TLS_MAX_FRAGMENT_LENGTH_512 1
140#define TLS_MAX_FRAGMENT_LENGTH_1024 2
141#define TLS_MAX_FRAGMENT_LENGTH_2048 3
142#define TLS_MAX_FRAGMENT_LENGTH_4096 4
145#define TLS_NAMED_GROUP 10
146#define TLS_NAMED_GROUP_SECP256R1 23
147#define TLS_NAMED_GROUP_SECP384R1 24
148#define TLS_NAMED_GROUP_X25519 29
149#define TLS_NAMED_GROUP_FFDHE2048 256
150#define TLS_NAMED_GROUP_FFDHE3072 257
151#define TLS_NAMED_GROUP_FFDHE4096 258
154#define TLS_SIGNATURE_ALGORITHMS 13
157#define TLS_EXTENDED_MASTER_SECRET 23
160#define TLS_SESSION_TICKET 35
163#define TLS_RENEGOTIATION_INFO 0xff01
263#define TLS_CIPHER_SUITES \
264 __table ( struct tls_cipher_suite, "tls_cipher_suites" )
267#define __tls_cipher_suite( pref ) \
268 __table_entry ( TLS_CIPHER_SUITES, pref )
271#define TLS_NAMED_CURVE_TYPE 3
282#define TLS_NAMED_GROUPS \
283 __table ( struct tls_named_group, "tls_named_groups" )
286#define __tls_named_group( pref ) \
287 __table_entry ( TLS_NAMED_GROUPS, pref )
290#define __tls_anon_named_group __tls_named_group ( 98 )
293#define TLS_NUM_NAMED_GROUPS \
295 ( __table_entries ( TLS_NAMED_GROUPS, 97 ) \
296 - table_start ( TLS_NAMED_GROUPS ) ) )
339#define TLS_SIG_HASH_ALGORITHMS \
340 __table ( struct tls_signature_hash_algorithm, \
341 "tls_sig_hash_algorithms" )
344#define __tls_sig_hash_algorithm \
345 __table_entry ( TLS_SIG_HASH_ALGORITHMS, 01 )
489#define TLS_MAX_FRAGMENT_LENGTH_VALUE TLS_MAX_FRAGMENT_LENGTH_4096
497#define TLS_TX_BUFSIZE 4096
507#define TLS_RX_BUFSIZE 4096
515#define TLS_RX_MIN_BUFSIZE 512
518#define TLS_RX_ALIGN 16
union @162305117151260234136356364136041353210355154177 key
unsigned long long uint64_t
Secure channel abstraction.
uint8_t data[48]
Additional event data.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
struct stp_switch root
Root switch.
An ASN.1 OID-identified algorithm.
A message digest algorithm.
A key exchange algorithm.
A doubly-linked list entry (or list head).
A pre-shared bound peer identity.
uint8_t fixed_iv_len
Fixed initialisation vector length.
struct cipher_algorithm * cipher
Bulk encryption cipher algorithm.
struct pubkey_algorithm * pubkey
Public-key encryption algorithm.
uint8_t key_len
Key length.
uint8_t mac_len
MAC length.
uint8_t record_iv_len
Record initialisation vector length.
struct digest_algorithm * digest
MAC digest algorithm.
struct tls_key_exchange_algorithm * exchange
Key exchange algorithm.
uint16_t code
Numeric code (in network-endian order).
struct digest_algorithm * handshake
Handshake digest algorithm (for TLSv1.2 and above).
A TLS cipher specification pair.
struct tls_cipherspec pending
Next cipher specification.
struct tls_cipherspec active
Current cipher specification.
const struct tls_endpoint * writer
Writer endpoint.
A TLS cipher specification.
void * fixed_iv
Fixed initialisation vector.
void * cipher_key
Cipher key.
struct tls_cipher_suite * suite
Cipher suite.
void * dynamic
Dynamically-allocated storage.
void * mac_secret
MAC secret.
struct private_key * key
Private key.
struct x509_chain * chain
Certificate chain (if any).
struct pending_operation negotiation
Security negotiation pending operation.
struct interface cipherstream
Ciphertext stream.
struct tls_session * session
Session.
struct tls_server server
Server state.
struct tls_key_schedule key
Key schedule.
struct tls_rx rx
Receive state.
struct tls_session_ticket new_ticket
New session ticket (if any).
struct tls_verify_data verify
Verification data.
struct secure_channel channel
Secure channel.
struct interface plainstream
Plaintext stream.
struct tls_tx tx
Transmit state.
struct exchange_algorithm * exchange
Key exchange algorithm.
int extended_master_secret
Extended master secret flag.
struct list_head list
List of connections within the same session.
struct tls_client client
Client state.
uint16_t version
Protocol version.
struct tls_session_id new_id
New session ID (if any).
struct refcnt refcnt
Reference counter.
int secure_renegotiation
Secure renegotiation flag.
A TLS key exchange algorithm.
const char * name
Algorithm name.
struct exchange_algorithm * exchange
Default key exchange algorithm.
int(* parse)(struct tls_connection *tls, const void *data, size_t len, struct tls_key_exchange_parameters *params)
Parse key exchange parameters from Server Key Exchange record.
uint8_t len_len
Length of length field in Client Key Exchange record.
TLS key exchange parameters.
struct exchange_algorithm * exchange
Key exchange algorithm.
size_t len
Length of parameters (excluding trailing signature).
size_t partner_len
Length of partner key.
const void * partner
Partner key.
uint16_t code
Numeric code (in network-endian order).
struct exchange_algorithm * exchange
Key exchange algorithm.
struct tls_cipherspec_pair cipherspec
Cipher specifications.
struct list_head data
List of received data buffers.
struct io_buffer iobuf
Current received record header (static I/O buffer).
struct io_buffer * handshake
Received handshake fragment (if any).
enum tls_rx_state state
State machine current state.
struct tls_header header
Current received record header.
uint64_t seq
Sequence number.
struct pending_operation validation
Certificate validation pending operation.
struct interface validator
Certificate validator.
struct x509_root * root
Root of trust.
struct pending_operation negotiation
Security negotiation pending operation.
struct x509_chain * chain
Certificate chain (if any).
size_t len
Length of ticket data.
struct private_key * key
Private key.
const char * name
Server name.
struct secure_preshared_identity psid
Bound peer identity.
struct x509_root * root
Root of trust.
struct tls_preshared_key psk
Pre-shared key.
struct list_head conn
List of connections.
struct refcnt refcnt
Reference counter.
struct tls_session_ticket ticket
Session ticket.
struct tls_session_id id
Session ID.
struct list_head list
List of sessions.
A TLS signature algorithm.
struct asn1_algorithm * algorithm
Required certificate OID-identified algorithm.
struct pubkey_algorithm * pubkey
Public-key algorithm.
uint16_t code
Numeric code (in network-endian order).
struct digest_algorithm * digest
Digest algorithm.
uint64_t seq
Sequence number.
unsigned int pending
Pending transmissions.
struct tls_cipherspec_pair cipherspec
Cipher specifications.
struct process process
Transmit process.
uint8_t client[12]
Client verification data.
uint8_t server[12]
Server verification data.
An X.509 certificate chain.
An X.509 root certificate list.
struct tls_key_exchange_algorithm tls_null_exchange_algorithm
Null key exchange algorithm.
struct tls_key_exchange_algorithm tls_pubkey_exchange_algorithm
Public key exchange algorithm.
struct tls_key_exchange_algorithm tls_ecdhe_exchange_algorithm
Ephemeral Elliptic Curve Diffie-Hellman key exchange algorithm.
struct tls_key_exchange_algorithm tls_dhe_exchange_algorithm
Ephemeral Diffie-Hellman key exchange algorithm.
tls_rx_state
TLS RX state machine state.
tls_tx_pending
TLS TX pending flags.
@ TLS_TX_CLIENT_KEY_EXCHANGE
@ TLS_TX_CERTIFICATE_VERIFY
int add_tls(struct interface *xfer, const char *name, struct x509_root *root, struct private_key *key)
Add TLS on an interface.
struct exchange_algorithm tls_classic_pre_master_algorithm
Classic pre-master secret key exchange algorithm.