44 #define TLS_VERSION_TLS_1_1 0x0302 47 #define TLS_VERSION_TLS_1_2 0x0303 50 #define TLS_VERSION_MAX TLS_VERSION_TLS_1_2 53 #define TLS_TYPE_CHANGE_CIPHER 20 56 #define TLS_TYPE_ALERT 21 59 #define TLS_TYPE_HANDSHAKE 22 62 #define TLS_TYPE_DATA 23 65 #define TLS_HELLO_REQUEST 0 66 #define TLS_CLIENT_HELLO 1 67 #define TLS_SERVER_HELLO 2 68 #define TLS_NEW_SESSION_TICKET 4 69 #define TLS_CERTIFICATE 11 70 #define TLS_SERVER_KEY_EXCHANGE 12 71 #define TLS_CERTIFICATE_REQUEST 13 72 #define TLS_SERVER_HELLO_DONE 14 73 #define TLS_CERTIFICATE_VERIFY 15 74 #define TLS_CLIENT_KEY_EXCHANGE 16 75 #define TLS_FINISHED 20 78 #define TLS_ALERT_WARNING 1 79 #define TLS_ALERT_FATAL 2 82 #define TLS_RSA_WITH_NULL_MD5 0x0001 83 #define TLS_RSA_WITH_NULL_SHA 0x0002 84 #define TLS_RSA_WITH_AES_128_CBC_SHA 0x002f 85 #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033 86 #define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035 87 #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039 88 #define TLS_RSA_WITH_AES_128_CBC_SHA256 0x003c 89 #define TLS_RSA_WITH_AES_256_CBC_SHA256 0x003d 90 #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x0067 91 #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x006b 92 #define TLS_RSA_WITH_AES_128_GCM_SHA256 0x009c 93 #define TLS_RSA_WITH_AES_256_GCM_SHA384 0x009d 94 #define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x009e 95 #define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x009f 98 #define TLS_MD5_ALGORITHM 1 99 #define TLS_SHA1_ALGORITHM 2 100 #define TLS_SHA224_ALGORITHM 3 101 #define TLS_SHA256_ALGORITHM 4 102 #define TLS_SHA384_ALGORITHM 5 103 #define TLS_SHA512_ALGORITHM 6 106 #define TLS_RSA_ALGORITHM 1 109 #define TLS_SERVER_NAME 0 110 #define TLS_SERVER_NAME_HOST_NAME 0 113 #define TLS_MAX_FRAGMENT_LENGTH 1 114 #define TLS_MAX_FRAGMENT_LENGTH_512 1 115 #define TLS_MAX_FRAGMENT_LENGTH_1024 2 116 #define TLS_MAX_FRAGMENT_LENGTH_2048 3 117 #define TLS_MAX_FRAGMENT_LENGTH_4096 4 120 #define TLS_SIGNATURE_ALGORITHMS 13 123 #define TLS_SESSION_TICKET 35 126 #define TLS_RENEGOTIATION_INFO 0xff01 198 #define TLS_CIPHER_SUITES \ 199 __table ( struct tls_cipher_suite, "tls_cipher_suites" ) 202 #define __tls_cipher_suite( pref ) \ 203 __table_entry ( TLS_CIPHER_SUITES, pref ) 244 #define TLS_SIG_HASH_ALGORITHMS \ 245 __table ( struct tls_signature_hash_algorithm, \ 246 "tls_sig_hash_algorithms" ) 249 #define __tls_sig_hash_algorithm \ 250 __table_entry ( TLS_SIG_HASH_ALGORITHMS, 01 ) 269 #define MD5_SHA1_CTX_SIZE sizeof ( struct md5_sha1_context ) 280 #define MD5_SHA1_DIGEST_SIZE sizeof ( struct md5_sha1_digest ) 408 #define TLS_RX_BUFSIZE 4096 416 #define TLS_RX_MIN_BUFSIZE 512 419 #define TLS_RX_ALIGN 16 struct tls_verify_data verify
Verification data.
struct digest_algorithm * digest
Digest algorithm.
struct x509_chain * chain
Server certificate chain.
uint8_t sha1[SHA1_DIGEST_SIZE]
SHA-1 digest.
struct pending_operation client_negotiation
Client security negotiation pending operation.
struct tls_session * session
Session.
uint8_t master_secret[48]
Master secret.
struct tls_key_exchange_algorithm * exchange
Key exchange algorithm.
uint8_t md5[MD5_DIGEST_SIZE]
MD5 digest.
struct io_buffer rx_header_iobuf
Current received record header (static I/O buffer)
uint8_t record_iv_len
Record initialisation vector length.
struct stp_switch root
Root switch.
uint64_t rx_seq
RX sequence number.
struct tls_key_exchange_algorithm tls_dhe_exchange_algorithm
Ephemeral Diffie-Hellman key exchange algorithm.
size_t new_session_ticket_len
Length of new session ticket.
uint8_t server_random[32]
Server random bytes.
uint8_t session_id[32]
Session ID.
struct tls_key_exchange_algorithm tls_pubkey_exchange_algorithm
Public key exchange algorithm.
struct x509_root * root
Root of trust.
unsigned long long uint64_t
A TLS cipher specification.
const char * name
Algorithm name.
struct pubkey_algorithm * pubkey
Public-key encryption algorithm.
A doubly-linked list entry (or list head)
enum tls_rx_state rx_state
RX state.
An X.509 certificate chain.
uint8_t * handshake_ctx
Digest algorithm context used for handshake verification.
struct tls_cipherspec tx_cipherspec
Current TX cipher specification.
int(* exchange)(struct tls_connection *tls)
Transmit Client Key Exchange record.
size_t id_len
Length of session ID.
void * new_session_ticket
New session ticket.
void * cipher_ctx
Bulk encryption cipher context.
tls_tx_pending
TLS TX pending flags.
struct tls_cipher_suite * suite
Cipher suite.
struct x509_chain * certs
Client certificate chain (if used)
struct digest_algorithm * digest
MAC digest algorithm.
struct pending_operation validation
Certificate validation pending operation.
struct list_head list
List of connections within the same session.
uint32_t gmt_unix_time
GMT Unix time.
uint8_t fixed_iv_len
Fixed initialisation vector length.
A TLS signature algorithm.
size_t ticket_len
Length of session ticket.
uint8_t master_secret[48]
Master secret.
struct list_head list
List of sessions.
struct tls_client_random client_random
Client random bytes.
struct interface cipherstream
Ciphertext stream.
void * server_key
Server Key Exchange record (if any)
uint8_t hash
Hash algorithm.
void * ticket
Session ticket.
#define MD5_CTX_SIZE
MD5 context size.
uint8_t mac_len
MAC length.
void * pubkey_ctx
Public key encryption context.
uint8_t signature
Signature algorithm.
struct private_key * key
Private key.
struct tls_cipherspec rx_cipherspec
Current RX cipher specification.
int add_tls(struct interface *xfer, const char *name, struct x509_root *root, struct private_key *key)
Add TLS on an interface.
struct tls_signature_hash_id code
Numeric code.
struct tls_cipherspec tx_cipherspec_pending
Next TX cipher specification.
uint8_t client[12]
Client verification data.
struct pending_operation server_negotiation
Server security negotiation pending operation.
An X.509 root certificate list.
struct list_head rx_data
List of received data buffers.
unsigned int tx_pending
TX pending transmissions.
struct digest_algorithm * handshake_digest
Digest algorithm used for handshake verification.
uint8_t random[28]
Random data.
uint8_t sha1[SHA1_CTX_SIZE]
SHA-1 context.
struct digest_algorithm * handshake
Handshake digest algorithm (for TLSv1.2 and above)
struct tls_cipherspec rx_cipherspec_pending
Next RX cipher specification.
tls_rx_state
TLS RX state machine state.
#define SHA1_CTX_SIZE
SHA-1 context size.
A message digest algorithm.
uint16_t version
Protocol version.
uint8_t server[12]
Server verification data.
A TLS key exchange algorithm.
struct x509_root * root
Root of trust.
struct private_key * key
Private key.
#define MD5_DIGEST_SIZE
MD5 digest size.
uint8_t md5[MD5_CTX_SIZE]
MD5 context.
struct cipher_algorithm * cipher
Bulk encryption cipher algorithm.
struct list_head conn
List of connections.
int secure_renegotiation
Secure renegotiation flag.
struct pubkey_algorithm * pubkey
Public-key algorithm.
void * dynamic
Dynamically-allocated storage.
const char * name
Server name.
A TLS signature and hash algorithm identifier.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t session_id_len
Length of session ID.
struct interface plainstream
Plaintext stream.
void * fixed_iv
Fixed initialisation vector.
uint16_t code
Numeric code (in network-endian order)
void * mac_secret
MAC secret.
uint64_t tx_seq
TX sequence number.
size_t server_key_len
Server Key Exchange record length.
uint8_t key_len
Key length.