| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#include "utils/s2n_events.h" |
| 17 |
|
| 18 |
#include "tls/s2n_connection.h" |
| 19 |
#include "tls/s2n_security_policies.h" |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
S2N_RESULT s2n_event_handshake_populate(struct s2n_connection *conn, struct s2n_event_handshake *event) |
| 27 |
{ |
| 28 |
RESULT_ENSURE_REF(event); |
| 29 |
|
| 30 |
event->protocol_version = s2n_connection_get_actual_protocol_version(conn); |
| 31 |
event->cipher = s2n_connection_get_cipher(conn); |
| 32 |
|
| 33 |
|
| 34 |
s2n_connection_get_key_exchange_group(conn, &event->group); |
| 35 |
|
| 36 |
const struct s2n_security_policy *security_policy = NULL; |
| 37 |
if (s2n_connection_get_security_policy(conn, &security_policy) == S2N_SUCCESS) { |
| 38 |
event->security_policy_label = s2n_find_version_from_security_policy(security_policy); |
| 39 |
} |
| 40 |
|
| 41 |
return S2N_RESULT_OK; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
S2N_RESULT s2n_event_handshake_send(struct s2n_connection *conn, struct s2n_event_handshake *event) |
| 51 |
{ |
| 52 |
RESULT_ENSURE_REF(conn); |
| 53 |
RESULT_ENSURE_REF(conn->config); |
| 54 |
RESULT_ENSURE_REF(event); |
| 55 |
|
| 56 |
if (conn->config->subscriber == NULL || conn->config->on_handshake_event == NULL) { |
| 57 |
return S2N_RESULT_OK; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
if (event->handshake_start_ns == HANDSHAKE_EVENT_SENT) { |
| 62 |
return S2N_RESULT_OK; |
| 63 |
} |
| 64 |
|
| 65 |
conn->config->on_handshake_event(conn, conn->config->subscriber, event); |
| 66 |
event->handshake_start_ns = HANDSHAKE_EVENT_SENT; |
| 67 |
return S2N_RESULT_OK; |
| 68 |
} |