| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include "api/s2n.h" |
| 19 |
#include "api/unstable/async_offload.h" |
| 20 |
#include "api/unstable/cert_authorities.h" |
| 21 |
#include "api/unstable/events.h" |
| 22 |
#include "crypto/s2n_certificate.h" |
| 23 |
#include "crypto/s2n_dhe.h" |
| 24 |
#include "tls/s2n_crl.h" |
| 25 |
#include "tls/s2n_key_update.h" |
| 26 |
#include "tls/s2n_psk.h" |
| 27 |
#include "tls/s2n_record.h" |
| 28 |
#include "tls/s2n_renegotiate.h" |
| 29 |
#include "tls/s2n_resume.h" |
| 30 |
#include "tls/s2n_tls_parameters.h" |
| 31 |
#include "tls/s2n_x509_validator.h" |
| 32 |
#include "utils/s2n_blob.h" |
| 33 |
#include "utils/s2n_prelude.h" |
| 34 |
|
| 35 |
#define S2N_MAX_TICKET_KEYS 48 |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
#define S2N_MIN_SEND_BUFFER_FRAGMENT_SIZE S2N_MAX(S2N_KEY_UPDATE_MESSAGE_SIZE, S2N_ALERT_LENGTH) |
| 47 |
#define S2N_MIN_SEND_BUFFER_SIZE S2N_TLS_MAX_RECORD_LEN_FOR(S2N_MIN_SEND_BUFFER_FRAGMENT_SIZE) |
| 48 |
|
| 49 |
struct s2n_cipher_preferences; |
| 50 |
|
| 51 |
typedef enum { |
| 52 |
S2N_NOT_OWNED = 0, |
| 53 |
S2N_APP_OWNED, |
| 54 |
S2N_LIB_OWNED, |
| 55 |
} s2n_cert_ownership; |
| 56 |
|
| 57 |
struct s2n_config { |
| 58 |
unsigned use_tickets : 1; |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
unsigned quic_enabled : 1; |
| 63 |
|
| 64 |
unsigned default_certs_are_explicit : 1; |
| 65 |
unsigned use_session_cache : 1; |
| 66 |
|
| 67 |
unsigned accept_mfl : 1; |
| 68 |
unsigned check_ocsp : 1; |
| 69 |
unsigned disable_x509_time_validation : 1; |
| 70 |
unsigned disable_x509_intent_verification : 1; |
| 71 |
unsigned disable_x509_validation : 1; |
| 72 |
unsigned max_verify_cert_chain_depth_set : 1; |
| 73 |
|
| 74 |
|
| 75 |
unsigned cert_req_dss_legacy_compat_enabled : 1; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
unsigned is_rsa_cert_configured : 1; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
unsigned no_signing_key : 1; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
unsigned verify_after_sign : 1; |
| 89 |
|
| 90 |
|
| 91 |
unsigned npn_supported : 1; |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
unsigned recv_multi_record : 1; |
| 99 |
|
| 100 |
|
| 101 |
unsigned ocsp_status_requested_by_user : 1; |
| 102 |
|
| 103 |
|
| 104 |
unsigned ocsp_status_requested_by_s2n : 1; |
| 105 |
|
| 106 |
|
| 107 |
unsigned ktls_tls13_enabled : 1; |
| 108 |
|
| 109 |
unsigned custom_blinding_set : 1; |
| 110 |
|
| 111 |
unsigned ticket_forward_secrecy : 1; |
| 112 |
|
| 113 |
struct s2n_dh_params *dhparams; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
struct s2n_map *domain_name_to_cert_map; |
| 118 |
struct certs_by_type default_certs_by_type; |
| 119 |
struct s2n_blob application_protocols; |
| 120 |
s2n_clock_time_nanoseconds wall_clock; |
| 121 |
s2n_clock_time_nanoseconds monotonic_clock; |
| 122 |
|
| 123 |
const struct s2n_security_policy *security_policy; |
| 124 |
|
| 125 |
void *sys_clock_ctx; |
| 126 |
void *monotonic_clock_ctx; |
| 127 |
|
| 128 |
s2n_client_hello_fn *client_hello_cb; |
| 129 |
s2n_client_hello_cb_mode client_hello_cb_mode; |
| 130 |
|
| 131 |
uint32_t max_blinding; |
| 132 |
|
| 133 |
void *client_hello_cb_ctx; |
| 134 |
|
| 135 |
uint64_t session_state_lifetime_in_nanos; |
| 136 |
|
| 137 |
struct s2n_array *ticket_keys; |
| 138 |
uint64_t encrypt_decrypt_key_lifetime_in_nanos; |
| 139 |
uint64_t decrypt_key_lifetime_in_nanos; |
| 140 |
|
| 141 |
|
| 142 |
s2n_cache_store_callback cache_store; |
| 143 |
void *cache_store_data; |
| 144 |
|
| 145 |
s2n_cache_retrieve_callback cache_retrieve; |
| 146 |
void *cache_retrieve_data; |
| 147 |
|
| 148 |
s2n_cache_delete_callback cache_delete; |
| 149 |
void *cache_delete_data; |
| 150 |
|
| 151 |
s2n_ct_support_level ct_type; |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
uint8_t client_cert_auth_type_overridden; |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
s2n_cert_auth_type client_cert_auth_type; |
| 164 |
|
| 165 |
s2n_alert_behavior alert_behavior; |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
s2n_verify_host_fn verify_host_fn; |
| 170 |
void *data_for_verify_host; |
| 171 |
unsigned allow_ip_in_cn : 1; |
| 172 |
|
| 173 |
s2n_crl_lookup_callback crl_lookup_cb; |
| 174 |
void *crl_lookup_ctx; |
| 175 |
|
| 176 |
s2n_cert_validation_callback cert_validation_cb; |
| 177 |
void *cert_validation_ctx; |
| 178 |
|
| 179 |
STACK_OF(ASN1_OBJECT) *custom_x509_extension_oids; |
| 180 |
|
| 181 |
|
| 182 |
s2n_cert_tiebreak_callback cert_tiebreak_cb; |
| 183 |
|
| 184 |
uint8_t mfl_code; |
| 185 |
|
| 186 |
uint8_t initial_tickets_to_send; |
| 187 |
|
| 188 |
struct s2n_x509_trust_store trust_store; |
| 189 |
uint16_t max_verify_cert_chain_depth; |
| 190 |
|
| 191 |
s2n_async_offload_cb async_offload_cb; |
| 192 |
uint32_t async_offload_allow_list; |
| 193 |
void *async_offload_ctx; |
| 194 |
|
| 195 |
s2n_async_pkey_fn async_pkey_cb; |
| 196 |
|
| 197 |
s2n_psk_selection_callback psk_selection_cb; |
| 198 |
void *psk_selection_ctx; |
| 199 |
|
| 200 |
s2n_key_log_fn key_log_cb; |
| 201 |
void *key_log_ctx; |
| 202 |
|
| 203 |
s2n_session_ticket_fn session_ticket_cb; |
| 204 |
void *session_ticket_ctx; |
| 205 |
|
| 206 |
s2n_cert_request_callback cert_request_cb; |
| 207 |
void *cert_request_cb_ctx; |
| 208 |
|
| 209 |
s2n_early_data_cb early_data_cb; |
| 210 |
|
| 211 |
uint32_t server_max_early_data_size; |
| 212 |
|
| 213 |
s2n_psk_mode psk_mode; |
| 214 |
|
| 215 |
s2n_async_pkey_validation_mode async_pkey_validation_mode; |
| 216 |
|
| 217 |
void *subscriber; |
| 218 |
s2n_event_on_handshake_cb on_handshake_event; |
| 219 |
|
| 220 |
|
| 221 |
void *context; |
| 222 |
|
| 223 |
s2n_cert_ownership cert_ownership; |
| 224 |
|
| 225 |
|
| 226 |
uint32_t send_buffer_size_override; |
| 227 |
|
| 228 |
void *renegotiate_request_ctx; |
| 229 |
s2n_renegotiate_request_cb renegotiate_request_cb; |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
s2n_serialization_version serialized_connection_version; |
| 247 |
|
| 248 |
|
| 249 |
struct s2n_blob cert_authorities; |
| 250 |
}; |
| 251 |
|
| 252 |
S2N_CLEANUP_RESULT s2n_config_ptr_free(struct s2n_config **config); |
| 253 |
|
| 254 |
int s2n_config_defaults_init(void); |
| 255 |
struct s2n_config *s2n_fetch_default_config(void); |
| 256 |
int s2n_config_set_unsafe_for_testing(struct s2n_config *config); |
| 257 |
|
| 258 |
int s2n_config_init_session_ticket_keys(struct s2n_config *config); |
| 259 |
int s2n_config_free_session_ticket_keys(struct s2n_config *config); |
| 260 |
|
| 261 |
void s2n_wipe_static_configs(void); |
| 262 |
struct s2n_cert_chain_and_key *s2n_config_get_single_default_cert(struct s2n_config *config); |
| 263 |
int s2n_config_get_num_default_certs(const struct s2n_config *config); |
| 264 |
S2N_RESULT s2n_config_wall_clock(struct s2n_config *config, uint64_t *output); |
| 265 |
S2N_RESULT s2n_config_monotonic_clock(struct s2n_config *config, uint64_t *output); |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
S2N_RESULT s2n_config_validate_loaded_certificates(const struct s2n_config *config, |
| 270 |
const struct s2n_security_policy *security_policy); |
| 271 |
int s2n_default_monotonic_clock(void *data, uint64_t *nanoseconds); |