Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
type 'k cbc_state = {
cipher : 'k cbc_cipher;
cipher_secret : 'k;
iv_mode : iv_mode;
hmac : Mirage_crypto.Hash.hash;
hmac_secret : hmac_key;
}
type 'k aead_state = {
cipher : 'k aead_cipher;
cipher_secret : 'k;
nonce : nonce;
explicit_nonce : bool;
}
type common_session_data = {
server_random : Cstruct.t;
client_random : Cstruct.t;
peer_certificate_chain : X509.Certificate.t list;
peer_certificate : X509.Certificate.t option;
trust_anchor : X509.Certificate.t option;
received_certificates : X509.Certificate.t list;
own_certificate : X509.Certificate.t list;
own_private_key : X509.Private_key.t option;
own_name : [ `host ] Domain_name.t option;
client_auth : bool;
master_secret : Core.master_secret;
alpn_protocol : string option;
}
type session_data = {
common_session_data : common_session_data;
client_version : Core.tls_any_version;
ciphersuite : Ciphersuite.ciphersuite;
group : Core.group option;
renegotiation : reneg_params;
session_id : Cstruct.t;
extended_ms : bool;
}
type server_handshake_state =
| AwaitClientHello
| AwaitClientHelloRenegotiate
| AwaitClientCertificate_RSA of session_data * hs_log
| AwaitClientCertificate_DHE of session_data * dh_secret * hs_log
| AwaitClientKeyExchange_RSA of session_data * hs_log
| AwaitClientKeyExchange_DHE of session_data * dh_secret * hs_log
| AwaitClientCertificateVerify of session_data
* crypto_context
* crypto_context
* hs_log
| AwaitClientChangeCipherSpec of session_data
* crypto_context
* crypto_context
* hs_log
| AwaitClientChangeCipherSpecResume of session_data
* crypto_context
* Cstruct.t
* hs_log
| AwaitClientFinished of session_data * hs_log
| AwaitClientFinishedResume of session_data * Cstruct.t * hs_log
| Established
type client_handshake_state =
| ClientInitial
| AwaitServerHello of Core.client_hello * (Core.group * dh_secret) list * hs_log
| AwaitServerHelloRenegotiate of session_data * Core.client_hello * hs_log
| AwaitCertificate_RSA of session_data * hs_log
| AwaitCertificate_DHE of session_data * hs_log
| AwaitServerKeyExchange_DHE of session_data * hs_log
| AwaitCertificateRequestOrServerHelloDone of session_data
* Cstruct.t
* Cstruct.t
* hs_log
| AwaitServerHelloDone of session_data
* Core.signature_algorithm list option
* Cstruct.t
* Cstruct.t
* hs_log
| AwaitServerChangeCipherSpec of session_data
* crypto_context
* Cstruct.t
* hs_log
| AwaitServerChangeCipherSpecResume of session_data
* crypto_context
* crypto_context
* hs_log
| AwaitServerFinished of session_data * Cstruct.t * hs_log
| AwaitServerFinishedResume of session_data * hs_log
| Established
type session_data13 = {
common_session_data13 : common_session_data;
ciphersuite13 : Ciphersuite.ciphersuite13;
master_secret : kdf;
exporter_master_secret : Cstruct.t;
resumption_secret : Cstruct.t;
state : Core.epoch_state;
resumed : bool;
client_app_secret : Cstruct.t;
server_app_secret : Cstruct.t;
}
type client13_handshake_state =
| AwaitServerHello13 of Core.client_hello
* (Core.group * dh_secret) list
* Cstruct.t
| AwaitServerEncryptedExtensions13 of session_data13
* Cstruct.t
* Cstruct.t
* Cstruct.t
| AwaitServerCertificateRequestOrCertificate13 of session_data13
* Cstruct.t
* Cstruct.t
* Cstruct.t
| AwaitServerCertificate13 of session_data13
* Cstruct.t
* Cstruct.t
* Core.signature_algorithm list option
* Cstruct.t
| AwaitServerCertificateVerify13 of session_data13
* Cstruct.t
* Cstruct.t
* Core.signature_algorithm list option
* Cstruct.t
| AwaitServerFinished13 of session_data13
* Cstruct.t
* Cstruct.t
* Core.signature_algorithm list option
* Cstruct.t
| Established13
type server13_handshake_state =
| AwaitClientHelloHRR13
| AwaitClientCertificate13 of session_data13
* Cstruct.t
* crypto_context
* Core.session_ticket option
* Cstruct.t
| AwaitClientCertificateVerify13 of session_data13
* Cstruct.t
* crypto_context
* Core.session_ticket option
* Cstruct.t
| AwaitClientFinished13 of Cstruct.t
* crypto_context
* Core.session_ticket option
* Cstruct.t
| AwaitEndOfEarlyData13 of Cstruct.t
* crypto_context
* crypto_context
* Core.session_ticket option
* Cstruct.t
| Established13
type handshake_machina_state =
| Client of client_handshake_state
| Server of server_handshake_state
| Client13 of client13_handshake_state
| Server13 of server13_handshake_state
type handshake_state = {
session : [ `TLS of session_data | `TLS13 of session_data13 ] list;
protocol_version : Core.tls_version;
early_data_left : int32;
machina : handshake_machina_state;
config : Config.config;
hs_fragment : Cstruct.t;
}
type crypto_state = crypto_context option
type record = Packet.content_type * Cstruct.t
type rec_resp = [
| `Change_enc of crypto_context
| `Change_dec of crypto_context
| `Record of record
]
type handshake_return = handshake_state * rec_resp list
type state = {
handshake : handshake_state;
decryptor : crypto_state;
encryptor : crypto_state;
fragment : Cstruct.t;
}
type error = [
| `AuthenticationFailure of X509.Validation.validation_error
| `NoConfiguredCiphersuite of Ciphersuite.ciphersuite list
| `NoConfiguredVersions of Core.tls_version list
| `NoConfiguredSignatureAlgorithm of Core.signature_algorithm list
| `NoMatchingCertificateFound of string
| `NoCertificateConfigured
| `CouldntSelectCertificate
]
val pp_error :
Stdlib.Format.formatter ->
[< `AuthenticationFailure of X509.Validation.validation_error
| `CouldntSelectCertificate
| `NoCertificateConfigured
| `NoConfiguredCiphersuite of
[< `AES_128_CCM_SHA256
| `AES_128_GCM_SHA256
| `AES_256_GCM_SHA384
| `CHACHA20_POLY1305_SHA256
| `DHE_RSA_WITH_3DES_EDE_CBC_SHA
| `DHE_RSA_WITH_AES_128_CBC_SHA
| `DHE_RSA_WITH_AES_128_CBC_SHA256
| `DHE_RSA_WITH_AES_128_CCM
| `DHE_RSA_WITH_AES_128_GCM_SHA256
| `DHE_RSA_WITH_AES_256_CBC_SHA
| `DHE_RSA_WITH_AES_256_CBC_SHA256
| `DHE_RSA_WITH_AES_256_CCM
| `DHE_RSA_WITH_AES_256_GCM_SHA384
| `DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
| `ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_128_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
| `ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
| `ECDHE_ECDSA_WITH_AES_256_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
| `ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
| `ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
| `ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
| `ECDHE_RSA_WITH_AES_128_CBC_SHA
| `ECDHE_RSA_WITH_AES_128_CBC_SHA256
| `ECDHE_RSA_WITH_AES_128_GCM_SHA256
| `ECDHE_RSA_WITH_AES_256_CBC_SHA
| `ECDHE_RSA_WITH_AES_256_CBC_SHA384
| `ECDHE_RSA_WITH_AES_256_GCM_SHA384
| `ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
| `RSA_WITH_3DES_EDE_CBC_SHA
| `RSA_WITH_AES_128_CBC_SHA
| `RSA_WITH_AES_128_CBC_SHA256
| `RSA_WITH_AES_128_CCM
| `RSA_WITH_AES_128_GCM_SHA256
| `RSA_WITH_AES_256_CBC_SHA
| `RSA_WITH_AES_256_CBC_SHA256
| `RSA_WITH_AES_256_CCM
| `RSA_WITH_AES_256_GCM_SHA384 AES_128_CCM_SHA256 AES_128_GCM_SHA256 AES_256_GCM_SHA384 CHACHA20_POLY1305_SHA256 ]
list
| `NoConfiguredSignatureAlgorithm of
[< `ECDSA_SECP256R1_SHA1
| `ECDSA_SECP256R1_SHA256
| `ECDSA_SECP384R1_SHA384
| `ECDSA_SECP521R1_SHA512
| `ED25519
| `RSA_PKCS1_MD5
| `RSA_PKCS1_SHA1
| `RSA_PKCS1_SHA224
| `RSA_PKCS1_SHA256
| `RSA_PKCS1_SHA384
| `RSA_PKCS1_SHA512
| `RSA_PSS_RSAENC_SHA256
| `RSA_PSS_RSAENC_SHA384
| `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ]
list
| `NoConfiguredVersions of
[< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] list
| `NoMatchingCertificateFound of string ] ->
unit
type client_hello_errors = [
| `EmptyCiphersuites
| `NotSetCiphersuites of Packet.any_ciphersuite list
| `NoSupportedCiphersuite of Packet.any_ciphersuite list
| `NotSetExtension of Core.client_extension list
| `NoSignatureAlgorithmsExtension
| `NoGoodSignatureAlgorithms of Core.signature_algorithm list
| `NoSupportedGroupExtension
| `NotSetSupportedGroup of Packet.named_group list
| `Has0rttAfterHRR
| `NoCookie
]
val pp_client_hello_error :
Stdlib.Format.formatter ->
[< `EmptyCiphersuites
| `Has0rttAfterHRR
| `NoCookie
| `NoGoodSignatureAlgorithms of
[< `ECDSA_SECP256R1_SHA1
| `ECDSA_SECP256R1_SHA256
| `ECDSA_SECP384R1_SHA384
| `ECDSA_SECP521R1_SHA512
| `ED25519
| `RSA_PKCS1_MD5
| `RSA_PKCS1_SHA1
| `RSA_PKCS1_SHA224
| `RSA_PKCS1_SHA256
| `RSA_PKCS1_SHA384
| `RSA_PKCS1_SHA512
| `RSA_PSS_RSAENC_SHA256
| `RSA_PSS_RSAENC_SHA384
| `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ]
list
| `NoKeyShareExtension
| `NoSignatureAlgorithmsExtension
| `NoSupportedCiphersuite of Packet.any_ciphersuite list
| `NoSupportedGroupExtension
| `NotSetCiphersuites of Packet.any_ciphersuite list
| `NotSetExtension of 'a
| `NotSetKeyShare of (Packet.named_group * 'b) list
| `NotSetSupportedGroup of Packet.named_group list
| `NotSubsetKeyShareSupportedGroup of
Packet.named_group list * (Packet.named_group * 'c) list ] ->
unit
type fatal = [
| `NoSecureRenegotiation
| `NoSupportedGroup
| `NoVersions of Core.tls_any_version list
| `ReaderError of Reader.error
| `NoCertificateReceived
| `NoCertificateVerifyReceived
| `NotRSACertificate
| `KeyTooSmall
| `SignatureVerificationFailed of string
| `SigningFailed of string
| `BadCertificateChain
| `MACMismatch
| `MACUnderflow
| `RecordOverflow of int
| `UnknownRecordVersion of int * int
| `UnknownContentType of int
| `CannotHandleApplicationDataYet
| `NoHeartbeat
| `BadRecordVersion of Core.tls_any_version
| `BadFinished
| `HandshakeFragmentsNotEmpty
| `InsufficientDH
| `InvalidDH
| `BadECDH of Mirage_crypto_ec.error
| `InvalidRenegotiation
| `InvalidClientHello of client_hello_errors
| `InvalidServerHello
| `InvalidRenegotiationVersion of Core.tls_version
| `InappropriateFallback
| `UnexpectedCCS
| `UnexpectedHandshake of Core.tls_handshake
| `InvalidCertificateUsage
| `InvalidCertificateExtendedUsage
| `InvalidSession
| `NoApplicationProtocol
| `HelloRetryRequest
| `InvalidMessage
| `Toomany0rttbytes
| `MissingContentType
| `Downgrade12
| `Downgrade11
]
val pp_fatal :
Stdlib.Format.formatter ->
[< `BadCertificateChain
| `BadECDH of Mirage_crypto_ec.error
| `BadFinished
| `BadRecordVersion of
[< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ]
| `CannotHandleApplicationDataYet
| `Downgrade11
| `Downgrade12
| `HandshakeFragmentsNotEmpty
| `HelloRetryRequest
| `InappropriateFallback
| `InsufficientDH
| `InvalidCertificateExtendedUsage
| `InvalidCertificateUsage
| `InvalidClientHello of
[< `EmptyCiphersuites
| `Has0rttAfterHRR
| `NoCookie
| `NoGoodSignatureAlgorithms of
[< `ECDSA_SECP256R1_SHA1
| `ECDSA_SECP256R1_SHA256
| `ECDSA_SECP384R1_SHA384
| `ECDSA_SECP521R1_SHA512
| `ED25519
| `RSA_PKCS1_MD5
| `RSA_PKCS1_SHA1
| `RSA_PKCS1_SHA224
| `RSA_PKCS1_SHA256
| `RSA_PKCS1_SHA384
| `RSA_PKCS1_SHA512
| `RSA_PSS_RSAENC_SHA256
| `RSA_PSS_RSAENC_SHA384
| `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ]
list
| `NoKeyShareExtension
| `NoSignatureAlgorithmsExtension
| `NoSupportedCiphersuite of Packet.any_ciphersuite list
| `NoSupportedGroupExtension
| `NotSetCiphersuites of Packet.any_ciphersuite list
| `NotSetExtension of 'a
| `NotSetKeyShare of (Packet.named_group * 'b) list
| `NotSetSupportedGroup of Packet.named_group list
| `NotSubsetKeyShareSupportedGroup of
Packet.named_group list * (Packet.named_group * 'c) list ]
| `InvalidDH
| `InvalidMessage
| `InvalidRenegotiation
| `InvalidRenegotiationVersion of
[< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ]
| `InvalidServerHello
| `InvalidSession
| `KeyTooSmall
| `MACMismatch
| `MACUnderflow
| `MissingContentType
| `NoApplicationProtocol
| `NoCertificateReceived
| `NoCertificateVerifyReceived
| `NoHeartbeat
| `NoSecureRenegotiation
| `NoSupportedGroup
| `NoVersions of
[< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ]
list
| `NotRSACertificate
| `ReaderError of Reader.error
| `RecordOverflow of int
| `SignatureVerificationFailed of string
| `SigningFailed of string
| `Toomany0rttbytes
| `UnexpectedCCS
| `UnexpectedHandshake of Core.tls_handshake
| `UnknownContentType of int
| `UnknownRecordVersion of int * int ] ->
unit
val pp_failure :
Stdlib.Format.formatter ->
[< `Error of
[< `AuthenticationFailure of X509.Validation.validation_error
| `CouldntSelectCertificate
| `NoCertificateConfigured
| `NoConfiguredCiphersuite of
[< `AES_128_CCM_SHA256
| `AES_128_GCM_SHA256
| `AES_256_GCM_SHA384
| `CHACHA20_POLY1305_SHA256
| `DHE_RSA_WITH_3DES_EDE_CBC_SHA
| `DHE_RSA_WITH_AES_128_CBC_SHA
| `DHE_RSA_WITH_AES_128_CBC_SHA256
| `DHE_RSA_WITH_AES_128_CCM
| `DHE_RSA_WITH_AES_128_GCM_SHA256
| `DHE_RSA_WITH_AES_256_CBC_SHA
| `DHE_RSA_WITH_AES_256_CBC_SHA256
| `DHE_RSA_WITH_AES_256_CCM
| `DHE_RSA_WITH_AES_256_GCM_SHA384
| `DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
| `ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_128_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
| `ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
| `ECDHE_ECDSA_WITH_AES_256_CBC_SHA
| `ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
| `ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
| `ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
| `ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
| `ECDHE_RSA_WITH_AES_128_CBC_SHA
| `ECDHE_RSA_WITH_AES_128_CBC_SHA256
| `ECDHE_RSA_WITH_AES_128_GCM_SHA256
| `ECDHE_RSA_WITH_AES_256_CBC_SHA
| `ECDHE_RSA_WITH_AES_256_CBC_SHA384
| `ECDHE_RSA_WITH_AES_256_GCM_SHA384
| `ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
| `RSA_WITH_3DES_EDE_CBC_SHA
| `RSA_WITH_AES_128_CBC_SHA
| `RSA_WITH_AES_128_CBC_SHA256
| `RSA_WITH_AES_128_CCM
| `RSA_WITH_AES_128_GCM_SHA256
| `RSA_WITH_AES_256_CBC_SHA
| `RSA_WITH_AES_256_CBC_SHA256
| `RSA_WITH_AES_256_CCM
| `RSA_WITH_AES_256_GCM_SHA384 AES_128_CCM_SHA256 AES_128_GCM_SHA256 AES_256_GCM_SHA384 CHACHA20_POLY1305_SHA256 ]
list
| `NoConfiguredSignatureAlgorithm of
[< `ECDSA_SECP256R1_SHA1
| `ECDSA_SECP256R1_SHA256
| `ECDSA_SECP384R1_SHA384
| `ECDSA_SECP521R1_SHA512
| `ED25519
| `RSA_PKCS1_MD5
| `RSA_PKCS1_SHA1
| `RSA_PKCS1_SHA224
| `RSA_PKCS1_SHA256
| `RSA_PKCS1_SHA384
| `RSA_PKCS1_SHA512
| `RSA_PSS_RSAENC_SHA256
| `RSA_PSS_RSAENC_SHA384
| `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ]
list
| `NoConfiguredVersions of
[< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] list
| `NoMatchingCertificateFound of string ]
| `Fatal of
[< `BadCertificateChain
| `BadECDH of Mirage_crypto_ec.error
| `BadFinished
| `BadRecordVersion of
[< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ]
| `CannotHandleApplicationDataYet
| `Downgrade11
| `Downgrade12
| `HandshakeFragmentsNotEmpty
| `HelloRetryRequest
| `InappropriateFallback
| `InsufficientDH
| `InvalidCertificateExtendedUsage
| `InvalidCertificateUsage
| `InvalidClientHello of
[< `EmptyCiphersuites
| `Has0rttAfterHRR
| `NoCookie
| `NoGoodSignatureAlgorithms of
[< `ECDSA_SECP256R1_SHA1
| `ECDSA_SECP256R1_SHA256
| `ECDSA_SECP384R1_SHA384
| `ECDSA_SECP521R1_SHA512
| `ED25519
| `RSA_PKCS1_MD5
| `RSA_PKCS1_SHA1
| `RSA_PKCS1_SHA224
| `RSA_PKCS1_SHA256
| `RSA_PKCS1_SHA384
| `RSA_PKCS1_SHA512
| `RSA_PSS_RSAENC_SHA256
| `RSA_PSS_RSAENC_SHA384
| `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ]
list
| `NoKeyShareExtension
| `NoSignatureAlgorithmsExtension
| `NoSupportedCiphersuite of Packet.any_ciphersuite list
| `NoSupportedGroupExtension
| `NotSetCiphersuites of Packet.any_ciphersuite list
| `NotSetExtension of 'a
| `NotSetKeyShare of (Packet.named_group * 'b) list
| `NotSetSupportedGroup of Packet.named_group list
| `NotSubsetKeyShareSupportedGroup of
Packet.named_group list * (Packet.named_group * 'c) list ]
| `InvalidDH
| `InvalidMessage
| `InvalidRenegotiation
| `InvalidRenegotiationVersion of
[< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ]
| `InvalidServerHello
| `InvalidSession
| `KeyTooSmall
| `MACMismatch
| `MACUnderflow
| `MissingContentType
| `NoApplicationProtocol
| `NoCertificateReceived
| `NoCertificateVerifyReceived
| `NoHeartbeat
| `NoSecureRenegotiation
| `NoSupportedGroup
| `NoVersions of
[< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ]
list
| `NotRSACertificate
| `ReaderError of Reader.error
| `RecordOverflow of int
| `SignatureVerificationFailed of string
| `SigningFailed of string
| `Toomany0rttbytes
| `UnexpectedCCS
| `UnexpectedHandshake of Core.tls_handshake
| `UnknownContentType of int
| `UnknownRecordVersion of int * int ] ] ->
unit
val common_data_to_epoch :
common_session_data ->
bool ->
[ `host ] Domain_name.t option ->
Core.epoch_data
val epoch_of_session :
bool ->
[ `host ] Domain_name.t option ->
Core.tls_version ->
[< `TLS of session_data | `TLS13 of session_data13 ] ->
Core.epoch_data
val epoch_of_hs : handshake_state -> Core.epoch_data option