iPXE
tls.h
Go to the documentation of this file.
1#ifndef _IPXE_TLS_H
2#define _IPXE_TLS_H
3
4/**
5 * @file
6 *
7 * Transport Layer Security Protocol
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/refcnt.h>
15#include <ipxe/interface.h>
16#include <ipxe/process.h>
17#include <ipxe/crypto.h>
18#include <ipxe/md5.h>
19#include <ipxe/sha1.h>
20#include <ipxe/sha256.h>
21#include <ipxe/x509.h>
22#include <ipxe/privkey.h>
23#include <ipxe/pending.h>
24#include <ipxe/iobuf.h>
25#include <ipxe/tables.h>
26
27struct tls_connection;
28
29/** A TLS header */
30struct tls_header {
31 /** Content type
32 *
33 * This is a TLS_TYPE_XXX constant
34 */
36 /** Protocol version
37 *
38 * This is a TLS_VERSION_XXX constant
39 */
41 /** Length of payload */
43} __attribute__ (( packed ));
44
45/** TLS version 1.1 */
46#define TLS_VERSION_TLS_1_1 0x0302
47
48/** TLS version 1.2 */
49#define TLS_VERSION_TLS_1_2 0x0303
50
51/** Change cipher content type */
52#define TLS_TYPE_CHANGE_CIPHER 20
53
54/** Change cipher spec magic byte */
55#define TLS_CHANGE_CIPHER_SPEC 1
56
57/** Alert content type */
58#define TLS_TYPE_ALERT 21
59
60/** Handshake content type */
61#define TLS_TYPE_HANDSHAKE 22
62
63/** Application data content type */
64#define TLS_TYPE_DATA 23
65
66/* Handshake message types */
67#define TLS_HELLO_REQUEST 0
68#define TLS_CLIENT_HELLO 1
69#define TLS_SERVER_HELLO 2
70#define TLS_NEW_SESSION_TICKET 4
71#define TLS_CERTIFICATE 11
72#define TLS_SERVER_KEY_EXCHANGE 12
73#define TLS_CERTIFICATE_REQUEST 13
74#define TLS_SERVER_HELLO_DONE 14
75#define TLS_CERTIFICATE_VERIFY 15
76#define TLS_CLIENT_KEY_EXCHANGE 16
77#define TLS_FINISHED 20
78
79/* TLS alert levels */
80#define TLS_ALERT_WARNING 1
81#define TLS_ALERT_FATAL 2
82
83/* TLS alert descriptions */
84#define TLS_ALERT_CLOSE_NOTIFY 0
85
86/* TLS cipher specifications */
87#define TLS_RSA_WITH_NULL_MD5 0x0001
88#define TLS_RSA_WITH_NULL_SHA 0x0002
89#define TLS_RSA_WITH_AES_128_CBC_SHA 0x002f
90#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033
91#define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035
92#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039
93#define TLS_RSA_WITH_AES_128_CBC_SHA256 0x003c
94#define TLS_RSA_WITH_AES_256_CBC_SHA256 0x003d
95#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x0067
96#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x006b
97#define TLS_RSA_WITH_AES_128_GCM_SHA256 0x009c
98#define TLS_RSA_WITH_AES_256_GCM_SHA384 0x009d
99#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x009e
100#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x009f
101#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xc009
102#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xc00a
103#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xc013
104#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xc014
105#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xc023
106#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xc024
107#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xc027
108#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xc028
109#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xc02b
110#define TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xc02c
111#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xc02f
112#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xc030
113
114/* TLS signature hash algorithm identifiers */
115#define TLS_RSA_SHA1_ALGORITHM 0x0201
116#define TLS_RSA_SHA224_ALGORITHM 0x0301
117#define TLS_ECDSA_SHA224_ALGORITHM 0x0303
118#define TLS_RSA_SHA256_ALGORITHM 0x0401
119#define TLS_ECDSA_SHA256_ALGORITHM 0x0403
120#define TLS_RSA_SHA384_ALGORITHM 0x0501
121#define TLS_ECDSA_SHA384_ALGORITHM 0x0503
122#define TLS_RSA_SHA512_ALGORITHM 0x0601
123#define TLS_ECDSA_SHA512_ALGORITHM 0x0603
124#define TLS_RSA_PSS_RSAE_SHA256_ALGORITHM 0x0804
125#define TLS_RSA_PSS_RSAE_SHA384_ALGORITHM 0x0805
126#define TLS_RSA_PSS_RSAE_SHA512_ALGORITHM 0x0806
127#define TLS_RSA_PSS_PSS_SHA256_ALGORITHM 0x0809
128#define TLS_RSA_PSS_PSS_SHA384_ALGORITHM 0x080a
129#define TLS_RSA_PSS_PSS_SHA512_ALGORITHM 0x080b
130
131/* TLS server name extension */
132#define TLS_SERVER_NAME 0
133#define TLS_SERVER_NAME_HOST_NAME 0
134
135/* TLS maximum fragment length extension */
136#define TLS_MAX_FRAGMENT_LENGTH 1
137#define TLS_MAX_FRAGMENT_LENGTH_512 1
138#define TLS_MAX_FRAGMENT_LENGTH_1024 2
139#define TLS_MAX_FRAGMENT_LENGTH_2048 3
140#define TLS_MAX_FRAGMENT_LENGTH_4096 4
141
142/* TLS named key exchange group extension */
143#define TLS_NAMED_GROUP 10
144#define TLS_NAMED_GROUP_SECP256R1 23
145#define TLS_NAMED_GROUP_SECP384R1 24
146#define TLS_NAMED_GROUP_X25519 29
147#define TLS_NAMED_GROUP_FFDHE2048 256
148#define TLS_NAMED_GROUP_FFDHE3072 257
149#define TLS_NAMED_GROUP_FFDHE4096 258
150
151/* TLS signature algorithms extension */
152#define TLS_SIGNATURE_ALGORITHMS 13
153
154/* TLS extended master secret extension */
155#define TLS_EXTENDED_MASTER_SECRET 23
156
157/* TLS session ticket extension */
158#define TLS_SESSION_TICKET 35
159
160/* TLS renegotiation information extension */
161#define TLS_RENEGOTIATION_INFO 0xff01
162
163/** TLS authentication header */
165 /** Sequence number */
167 /** TLS header */
169} __attribute__ (( packed ));
170
171/** TLS verification data */
173 /** Client verification data */
175 /** Server verification data */
177} __attribute__ (( packed ));
178
179/** TLS RX state machine state */
184
185/** TLS TX pending flags */
194
195/** A TLS key exchange algorithm */
197 /** Algorithm name */
198 const char *name;
199 /**
200 * Receive new Server Key Exchange record using ECDHE key exchange
201 *
202 * @v tls TLS connection
203 * @v data Server Key Exchange handshake record
204 * @v len Length of Server Key Exchange handshake record
205 * @ret rc Return status code
206 */
207 int ( * server ) ( struct tls_connection *tls, const void *data,
208 size_t len );
209 /**
210 * Transmit Client Key Exchange record
211 *
212 * @v tls TLS connection
213 * @ret rc Return status code
214 */
215 int ( * client ) ( struct tls_connection *tls );
216};
217
218/** A TLS cipher suite */
220 /** Key exchange algorithm */
222 /** Public-key encryption algorithm */
224 /** Bulk encryption cipher algorithm */
226 /** MAC digest algorithm */
228 /** Handshake digest algorithm (for TLSv1.2 and above) */
230 /** Numeric code (in network-endian order) */
232 /** Key length */
234 /** Fixed initialisation vector length */
236 /** Record initialisation vector length */
238 /** MAC length */
240};
241
242/** TLS cipher suite table */
243#define TLS_CIPHER_SUITES \
244 __table ( struct tls_cipher_suite, "tls_cipher_suites" )
245
246/** Declare a TLS cipher suite */
247#define __tls_cipher_suite( pref ) \
248 __table_entry ( TLS_CIPHER_SUITES, pref )
249
250/** TLS named curve type */
251#define TLS_NAMED_CURVE_TYPE 3
252
253/** A TLS named group */
255 /** Key exchange algorithm */
257 /** Numeric code (in network-endian order) */
259};
260
261/** TLS named group table */
262#define TLS_NAMED_GROUPS \
263 __table ( struct tls_named_group, "tls_named_groups" )
264
265/** Declare a TLS named group */
266#define __tls_named_group( pref ) \
267 __table_entry ( TLS_NAMED_GROUPS, pref )
268
269/** Declare a TLS anonymous named group */
270#define __tls_anon_named_group __tls_named_group ( 98 )
271
272/** Number of non-anonymous TLS named groups */
273#define TLS_NUM_NAMED_GROUPS \
274 ( ( unsigned int ) \
275 ( __table_entries ( TLS_NAMED_GROUPS, 97 ) \
276 - table_start ( TLS_NAMED_GROUPS ) ) )
277
278/** A TLS cipher specification */
280 /** Cipher suite */
282 /** Dynamically-allocated storage */
283 void *dynamic;
284 /** Bulk encryption cipher context */
286 /** MAC secret */
288 /** Fixed initialisation vector */
289 void *fixed_iv;
290};
291
292/** A TLS cipher specification pair */
294 /** Current cipher specification */
296 /** Next cipher specification */
298};
299
300/** A TLS signature algorithm */
302 /** Digest algorithm */
304 /** Public-key algorithm */
306 /** Required certificate OID-identified algorithm */
308 /** Numeric code (in network-endian order) */
310};
311
312/** TLS signature hash algorithm table
313 *
314 * Note that the default (TLSv1.1 and earlier) algorithm using
315 * MD5+SHA1 is never explicitly specified.
316 */
317#define TLS_SIG_HASH_ALGORITHMS \
318 __table ( struct tls_signature_hash_algorithm, \
319 "tls_sig_hash_algorithms" )
320
321/** Declare a TLS signature hash algorithm */
322#define __tls_sig_hash_algorithm \
323 __table_entry ( TLS_SIG_HASH_ALGORITHMS, 01 )
324
325/** TLS client random data */
327 /** Random data */
329} __attribute__ (( packed ));
330
331/** A TLS session */
333 /** Reference counter */
335 /** List of sessions */
337
338 /** Server name */
339 const char *name;
340 /** Root of trust */
342 /** Private key */
344
345 /** Server certificate */
347 /** Session ID */
348 uint8_t id[32];
349 /** Length of session ID */
350 size_t id_len;
351 /** Session ticket */
352 void *ticket;
353 /** Length of session ticket */
355 /** Resumption master secret */
357 /** Length of resumption master secret */
359 /** Extended master secret flag */
361
362 /** List of connections */
364};
365
366/** HKDF algorithm for ephemeral secrets */
367#define tls_ephemeral_algorithm sha256_algorithm
368
369/** TLS key schedule */
371 /** Digest algorithm
372 *
373 * This is the digest algorithm specified by the cipher suite.
374 * It is used to construct the handshake running transcript
375 * digest value, and as the HMAC digest algorithm for key
376 * derivation.
377 */
379 /** Named key exchange group */
381 /** Schedule holds secret key material
382 *
383 * This flag is set when shared secret key material is
384 * introduced into the schedule (e.g. when the TLS pre-master
385 * secret is calculated, or when a session is resumed).
386 *
387 * If this flag has not been set, then the key schedule
388 * contains only public information.
389 *
390 * This flag must be cleared whenever the key schedule is
391 * reset.
392 */
393 int keyed;
394 /** Server identity to which the schedule has been bound (if any)
395 *
396 * This reference to the server certificate is set when the
397 * shared secret key material has been bound to the identity
398 * represented by the server's certificate. It represents the
399 * successful delegation of authority from the server's
400 * long-term authentication key to the per-connection shared
401 * secret key material for the purpose of authenticating the
402 * connection via a successfully verified server Finished
403 * message.
404 *
405 * Note that this reference may be set before the server
406 * certificate has been validated. The validation of the
407 * server certificate's chain is independent from the binding
408 * of the key schedule to the server certificate.
409 *
410 * The binding may take place in several different ways,
411 * depending on the protocol version and options:
412 *
413 * - For classic RSA key transport, the binding occurs when
414 * the encrypted ClientKeyExchange message is sent and
415 * incorporated into the handshake digest. A subsequent
416 * successfully verified server Finished message
417 * simultaneously proves knowledge of the certificate's
418 * private key and agreement on the shared secret key
419 * material.
420 *
421 * - For ephemeral key exchange via ServerKeyExchange, the
422 * binding occurs when the signature over the DH
423 * parameters within ServerKeyExchange is verified against
424 * the certificate's public key. That signature
425 * represents the server's intention to delegate authority
426 * to any shared secret constructed from the signed DH
427 * parameters.
428 *
429 * - For ephemeral key exchange via ClientHello/ServerHello,
430 * the binding occurs when the signature over the
431 * handshake digest within the server CertificateVerify is
432 * verified against the certificate's public key. The
433 * handshake digest incorporates the ephemeral key
434 * exchange and so the signature represents the server's
435 * intention to delegate authority to any shared secret
436 * constructed from the indirectly signed DH parameters.
437 *
438 * - For session resumption, the binding occurs when the key
439 * schedule is resumed from the session secret. The
440 * server's choice to accept the resumption represents its
441 * intention to delegate authority to the shared secret
442 * derived from the session secret.
443 *
444 * This reference may not be set unless the "keyed" flag has
445 * already been set, and must be cleared whenever the "keyed"
446 * flag is cleared.
447 *
448 * This reference must be cleared whenever the server identity
449 * represented by the current certificate changes (e.g. when a
450 * new certificate chain is provided), or whenever the key
451 * derivation function master secret is overwritten with a
452 * value that is not cryptographically derived from its
453 * current value.
454 */
456 /** Dynamically-allocated storage */
457 void *dynamic;
458 /** Handshake running transcript digest context */
460 /** Key derivation function master secret */
461 void *kdf;
462 /** Ephemeral master secret */
464};
465
466/** TLS transmit state */
467struct tls_tx {
468 /** Cipher specifications */
470 /** Sequence number */
472 /** Pending transmissions */
473 unsigned int pending;
474 /** Transmit process */
476};
477
478/** TLS receive state */
479struct tls_rx {
480 /** Cipher specifications */
482 /** Sequence number */
484 /** State machine current state */
486 /** Current received record header */
488 /** Current received record header (static I/O buffer) */
490 /** List of received data buffers */
492 /** Received handshake fragment */
494};
495
496/** TLS client state */
498 /** Random bytes */
500 /** Private key (if used) */
502 /** Certificate chain (if used) */
504 /** Security negotiation pending operation */
506};
507
508/** TLS server state */
510 /** Random bytes */
512 /** Root of trust */
514 /** Certificate chain */
516 /** Certificate validator */
518 /** Certificate validation pending operation */
520 /** Security negotiation pending operation */
522};
523
524/** A TLS connection */
526 /** Reference counter */
528
529 /** Session */
531 /** List of connections within the same session */
533 /** Session ID */
535 /** Length of session ID */
537 /** New session ticket */
539 /** Length of new session ticket */
541
542 /** Plaintext stream */
544 /** Ciphertext stream */
546
547 /** Protocol version */
549 /** Secure renegotiation flag */
551 /** Extended master secret flag */
553 /** Verification data */
555
556 /** Key schedule */
558 /** Transmit state */
559 struct tls_tx tx;
560 /** Receive state */
561 struct tls_rx rx;
562 /** Client state */
564 /** Server state */
566};
567
568/** Advertised maximum fragment length */
569#define TLS_MAX_FRAGMENT_LENGTH_VALUE TLS_MAX_FRAGMENT_LENGTH_4096
570
571/** TX maximum fragment length
572 *
573 * TLS requires us to limit our transmitted records to the maximum
574 * fragment length that we attempt to negotiate, even if the server
575 * does not respect this choice.
576 */
577#define TLS_TX_BUFSIZE 4096
578
579/** RX I/O buffer size
580 *
581 * The maximum fragment length extension is optional, and many common
582 * implementations (including OpenSSL) do not support it. We must
583 * therefore be prepared to receive records of up to 16kB in length.
584 * The chance of an allocation of this size failing is non-negligible,
585 * so we must split received data into smaller allocations.
586 */
587#define TLS_RX_BUFSIZE 4096
588
589/** Minimum RX I/O buffer size
590 *
591 * To simplify manipulations, we ensure that no RX I/O buffer is
592 * smaller than this size. This allows us to assume that the MAC and
593 * padding are entirely contained within the final I/O buffer.
594 */
595#define TLS_RX_MIN_BUFSIZE 512
596
597/** RX I/O buffer alignment */
598#define TLS_RX_ALIGN 16
599
603
604extern int add_tls ( struct interface *xfer, const char *name,
605 struct x509_root *root, struct private_key *key );
606
607#endif /* _IPXE_TLS_H */
union @162305117151260234136356364136041353210355154177 key
#define SHA256_DIGEST_SIZE
Definition Tpm20.h:29
unsigned short uint16_t
Definition stdint.h:11
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
const char * name
Definition ath9k_hw.c:1986
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:951
#define __attribute__(x)
Definition compiler.h:10
Cryptographic API.
Object interfaces.
I/O buffers.
MD5 algorithm.
Pending operations.
Private key.
Processes.
Reference counting.
SHA-1 algorithm.
SHA-256 algorithm.
struct stp_switch root
Root switch.
Definition stp.h:15
An ASN.1 OID-identified algorithm.
Definition asn1.h:414
A cipher algorithm.
Definition crypto.h:58
A message digest algorithm.
Definition crypto.h:19
A key exchange algorithm.
Definition crypto.h:210
An object interface.
Definition interface.h:125
A persistent I/O buffer.
Definition iobuf.h:38
A doubly-linked list entry (or list head).
Definition list.h:19
A pending operation.
Definition pending.h:14
A private key.
Definition privkey.h:17
A public key algorithm.
Definition crypto.h:142
TLS authentication header.
Definition tls.h:164
uint64_t seq
Sequence number.
Definition tls.h:166
struct tls_header header
TLS header.
Definition tls.h:168
A TLS cipher suite.
Definition tls.h:219
uint8_t fixed_iv_len
Fixed initialisation vector length.
Definition tls.h:235
struct cipher_algorithm * cipher
Bulk encryption cipher algorithm.
Definition tls.h:225
struct pubkey_algorithm * pubkey
Public-key encryption algorithm.
Definition tls.h:223
uint8_t key_len
Key length.
Definition tls.h:233
uint8_t mac_len
MAC length.
Definition tls.h:239
uint8_t record_iv_len
Record initialisation vector length.
Definition tls.h:237
struct digest_algorithm * digest
MAC digest algorithm.
Definition tls.h:227
struct tls_key_exchange_algorithm * exchange
Key exchange algorithm.
Definition tls.h:221
uint16_t code
Numeric code (in network-endian order).
Definition tls.h:231
struct digest_algorithm * handshake
Handshake digest algorithm (for TLSv1.2 and above).
Definition tls.h:229
A TLS cipher specification pair.
Definition tls.h:293
struct tls_cipherspec pending
Next cipher specification.
Definition tls.h:297
struct tls_cipherspec active
Current cipher specification.
Definition tls.h:295
A TLS cipher specification.
Definition tls.h:279
void * fixed_iv
Fixed initialisation vector.
Definition tls.h:289
struct tls_cipher_suite * suite
Cipher suite.
Definition tls.h:281
void * cipher_ctx
Bulk encryption cipher context.
Definition tls.h:285
void * dynamic
Dynamically-allocated storage.
Definition tls.h:283
void * mac_secret
MAC secret.
Definition tls.h:287
TLS client random data.
Definition tls.h:326
uint8_t random[32]
Random data.
Definition tls.h:328
TLS client state.
Definition tls.h:497
struct tls_client_random random
Random bytes.
Definition tls.h:499
struct private_key * key
Private key (if used).
Definition tls.h:501
struct x509_chain * chain
Certificate chain (if used).
Definition tls.h:503
struct pending_operation negotiation
Security negotiation pending operation.
Definition tls.h:505
A TLS connection.
Definition tls.h:525
struct interface cipherstream
Ciphertext stream.
Definition tls.h:545
struct tls_session * session
Session.
Definition tls.h:530
struct tls_server server
Server state.
Definition tls.h:565
struct tls_key_schedule key
Key schedule.
Definition tls.h:557
struct tls_rx rx
Receive state.
Definition tls.h:561
void * new_session_ticket
New session ticket.
Definition tls.h:538
struct tls_verify_data verify
Verification data.
Definition tls.h:554
size_t session_id_len
Length of session ID.
Definition tls.h:536
struct interface plainstream
Plaintext stream.
Definition tls.h:543
struct tls_tx tx
Transmit state.
Definition tls.h:559
uint8_t session_id[32]
Session ID.
Definition tls.h:534
int extended_master_secret
Extended master secret flag.
Definition tls.h:552
struct list_head list
List of connections within the same session.
Definition tls.h:532
struct tls_client client
Client state.
Definition tls.h:563
uint16_t version
Protocol version.
Definition tls.h:548
size_t new_session_ticket_len
Length of new session ticket.
Definition tls.h:540
struct refcnt refcnt
Reference counter.
Definition tls.h:527
int secure_renegotiation
Secure renegotiation flag.
Definition tls.h:550
A TLS header.
Definition tls.h:30
uint16_t version
Protocol version.
Definition tls.h:40
uint16_t length
Length of payload.
Definition tls.h:42
uint8_t type
Content type.
Definition tls.h:35
A TLS key exchange algorithm.
Definition tls.h:196
const char * name
Algorithm name.
Definition tls.h:198
int(* server)(struct tls_connection *tls, const void *data, size_t len)
Receive new Server Key Exchange record using ECDHE key exchange.
Definition tls.h:207
int(* client)(struct tls_connection *tls)
Transmit Client Key Exchange record.
Definition tls.h:215
TLS key schedule.
Definition tls.h:370
void * kdf
Key derivation function master secret.
Definition tls.h:461
struct x509_certificate * bound
Server identity to which the schedule has been bound (if any).
Definition tls.h:455
int keyed
Schedule holds secret key material.
Definition tls.h:393
uint8_t ephemeral[SHA256_DIGEST_SIZE]
Ephemeral master secret.
Definition tls.h:463
void * handshake
Handshake running transcript digest context.
Definition tls.h:459
struct digest_algorithm * digest
Digest algorithm.
Definition tls.h:378
struct tls_named_group * group
Named key exchange group.
Definition tls.h:380
void * dynamic
Dynamically-allocated storage.
Definition tls.h:457
A TLS named group.
Definition tls.h:254
uint16_t code
Numeric code (in network-endian order).
Definition tls.h:258
struct exchange_algorithm * exchange
Key exchange algorithm.
Definition tls.h:256
TLS receive state.
Definition tls.h:479
struct tls_cipherspec_pair cipherspec
Cipher specifications.
Definition tls.h:481
struct list_head data
List of received data buffers.
Definition tls.h:491
struct io_buffer iobuf
Current received record header (static I/O buffer).
Definition tls.h:489
struct io_buffer * handshake
Received handshake fragment.
Definition tls.h:493
enum tls_rx_state state
State machine current state.
Definition tls.h:485
struct tls_header header
Current received record header.
Definition tls.h:487
uint64_t seq
Sequence number.
Definition tls.h:483
TLS server state.
Definition tls.h:509
struct pending_operation validation
Certificate validation pending operation.
Definition tls.h:519
struct interface validator
Certificate validator.
Definition tls.h:517
struct x509_root * root
Root of trust.
Definition tls.h:513
struct pending_operation negotiation
Security negotiation pending operation.
Definition tls.h:521
struct x509_chain * chain
Certificate chain.
Definition tls.h:515
uint8_t random[32]
Random bytes.
Definition tls.h:511
A TLS session.
Definition tls.h:332
struct private_key * key
Private key.
Definition tls.h:343
uint8_t resumption_master_secret[48]
Resumption master secret.
Definition tls.h:356
int extended_master_secret
Extended master secret flag.
Definition tls.h:360
const char * name
Server name.
Definition tls.h:339
struct x509_certificate * cert
Server certificate.
Definition tls.h:346
size_t id_len
Length of session ID.
Definition tls.h:350
size_t ticket_len
Length of session ticket.
Definition tls.h:354
struct x509_root * root
Root of trust.
Definition tls.h:341
struct list_head conn
List of connections.
Definition tls.h:363
struct refcnt refcnt
Reference counter.
Definition tls.h:334
size_t resumption_master_secret_len
Length of resumption master secret.
Definition tls.h:358
void * ticket
Session ticket.
Definition tls.h:352
struct list_head list
List of sessions.
Definition tls.h:336
A TLS signature algorithm.
Definition tls.h:301
struct asn1_algorithm * algorithm
Required certificate OID-identified algorithm.
Definition tls.h:307
struct pubkey_algorithm * pubkey
Public-key algorithm.
Definition tls.h:305
uint16_t code
Numeric code (in network-endian order).
Definition tls.h:309
struct digest_algorithm * digest
Digest algorithm.
Definition tls.h:303
TLS transmit state.
Definition tls.h:467
uint64_t seq
Sequence number.
Definition tls.h:471
unsigned int pending
Pending transmissions.
Definition tls.h:473
struct tls_cipherspec_pair cipherspec
Cipher specifications.
Definition tls.h:469
struct process process
Transmit process.
Definition tls.h:475
TLS verification data.
Definition tls.h:172
uint8_t client[12]
Client verification data.
Definition tls.h:174
uint8_t server[12]
Server verification data.
Definition tls.h:176
An X.509 certificate.
Definition x509.h:216
An X.509 certificate chain.
Definition x509.h:201
An X.509 root certificate list.
Definition x509.h:375
Linker tables.
struct tls_key_exchange_algorithm tls_pubkey_exchange_algorithm
Public key exchange algorithm.
Definition tls.c:1665
struct tls_key_exchange_algorithm tls_ecdhe_exchange_algorithm
Ephemeral Elliptic Curve Diffie-Hellman key exchange algorithm.
Definition tls.c:1898
struct tls_key_exchange_algorithm tls_dhe_exchange_algorithm
Ephemeral Diffie-Hellman key exchange algorithm.
Definition tls.c:1793
tls_rx_state
TLS RX state machine state.
Definition tls.h:180
@ TLS_RX_HEADER
Definition tls.h:181
@ TLS_RX_DATA
Definition tls.h:182
tls_tx_pending
TLS TX pending flags.
Definition tls.h:186
@ TLS_TX_FINISHED
Definition tls.h:192
@ TLS_TX_CLIENT_KEY_EXCHANGE
Definition tls.h:189
@ TLS_TX_CLIENT_HELLO
Definition tls.h:187
@ TLS_TX_CHANGE_CIPHER
Definition tls.h:191
@ TLS_TX_CERTIFICATE_VERIFY
Definition tls.h:190
@ TLS_TX_CERTIFICATE
Definition tls.h:188
int add_tls(struct interface *xfer, const char *name, struct x509_root *root, struct private_key *key)
Add TLS on an interface.
Definition tls.c:4403
X.509 certificates.