| 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 "tls/s2n_crypto_constants.h" |
| 20 |
#include "utils/s2n_blob.h" |
| 21 |
#include "utils/s2n_result.h" |
| 22 |
|
| 23 |
struct s2n_psk; |
| 24 |
|
| 25 |
typedef enum { |
| 26 |
S2N_UNKNOWN_EARLY_DATA_STATE = 0, |
| 27 |
S2N_EARLY_DATA_REQUESTED, |
| 28 |
S2N_EARLY_DATA_NOT_REQUESTED, |
| 29 |
S2N_EARLY_DATA_ACCEPTED, |
| 30 |
S2N_EARLY_DATA_REJECTED, |
| 31 |
S2N_END_OF_EARLY_DATA, |
| 32 |
S2N_EARLY_DATA_STATES_COUNT |
| 33 |
} s2n_early_data_state; |
| 34 |
|
| 35 |
S2N_RESULT s2n_connection_set_early_data_state(struct s2n_connection *conn, s2n_early_data_state state); |
| 36 |
|
| 37 |
struct s2n_early_data_config { |
| 38 |
uint32_t max_early_data_size; |
| 39 |
uint8_t protocol_version; |
| 40 |
struct s2n_cipher_suite *cipher_suite; |
| 41 |
struct s2n_blob application_protocol; |
| 42 |
struct s2n_blob context; |
| 43 |
}; |
| 44 |
S2N_CLEANUP_RESULT s2n_early_data_config_free(struct s2n_early_data_config *config); |
| 45 |
S2N_RESULT s2n_early_data_config_clone(struct s2n_psk *new_psk, struct s2n_early_data_config *old_config); |
| 46 |
|
| 47 |
struct s2n_offered_early_data { |
| 48 |
struct s2n_connection *conn; |
| 49 |
}; |
| 50 |
|
| 51 |
bool s2n_early_data_is_valid_for_connection(struct s2n_connection *conn); |
| 52 |
S2N_RESULT s2n_early_data_accept_or_reject(struct s2n_connection *conn); |
| 53 |
|
| 54 |
S2N_RESULT s2n_early_data_get_server_max_size(struct s2n_connection *conn, uint32_t *max_early_data_size); |
| 55 |
|
| 56 |
S2N_RESULT s2n_early_data_record_bytes(struct s2n_connection *conn, ssize_t data_len); |
| 57 |
S2N_RESULT s2n_early_data_validate_send(struct s2n_connection *conn, uint32_t bytes_to_send); |
| 58 |
S2N_RESULT s2n_early_data_validate_recv(struct s2n_connection *conn); |
| 59 |
bool s2n_early_data_is_trial_decryption_allowed(struct s2n_connection *conn, uint8_t record_type); |
| 60 |
|
| 61 |
int s2n_connection_set_early_data_expected(struct s2n_connection *conn); |
| 62 |
int s2n_connection_set_end_of_early_data(struct s2n_connection *conn); |