| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#include "tls/extensions/s2n_server_server_name.h" |
| 17 |
|
| 18 |
#include "stuffer/s2n_stuffer.h" |
| 19 |
#include "tls/s2n_connection.h" |
| 20 |
|
| 21 |
static bool s2n_server_name_should_send(struct s2n_connection *conn); |
| 22 |
static int s2n_server_name_send(struct s2n_connection *conn, struct s2n_stuffer *out); |
| 23 |
static int s2n_server_name_recv(struct s2n_connection *conn, struct s2n_stuffer *extension); |
| 24 |
|
| 25 |
const s2n_extension_type s2n_server_server_name_extension = { |
| 26 |
.iana_value = TLS_EXTENSION_SERVER_NAME, |
| 27 |
.is_response = true, |
| 28 |
.send = s2n_server_name_send, |
| 29 |
.recv = s2n_server_name_recv, |
| 30 |
.should_send = s2n_server_name_should_send, |
| 31 |
.if_missing = s2n_extension_noop_if_missing, |
| 32 |
}; |
| 33 |
|
| 34 |
static bool s2n_server_name_should_send(struct s2n_connection *conn) |
| 35 |
{ |
| 36 |
return conn && conn->server_name_used && !IS_RESUMPTION_HANDSHAKE(conn); |
| 37 |
} |
| 38 |
|
| 39 |
static int s2n_server_name_send(struct s2n_connection *conn, struct s2n_stuffer *out) |
| 40 |
{ |
| 41 |
|
| 42 |
return S2N_SUCCESS; |
| 43 |
} |
| 44 |
|
| 45 |
static int s2n_server_name_recv(struct s2n_connection *conn, struct s2n_stuffer *extension) |
| 46 |
{ |
| 47 |
POSIX_ENSURE_REF(conn); |
| 48 |
|
| 49 |
conn->server_name_used = 1; |
| 50 |
return S2N_SUCCESS; |
| 51 |
} |