diff options
Diffstat (limited to 'lib/handshake-tls13.c')
-rw-r--r-- | lib/handshake-tls13.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/handshake-tls13.c b/lib/handshake-tls13.c index 456442e3e9..4cce3d631d 100644 --- a/lib/handshake-tls13.c +++ b/lib/handshake-tls13.c @@ -52,6 +52,7 @@ #include "tls13/certificate_verify.h" #include "tls13/certificate.h" #include "tls13/finished.h" +#include "tls13/session_ticket.h" static int generate_hs_traffic_keys(gnutls_session_t session); static int generate_ap_traffic_keys(gnutls_session_t session); @@ -256,3 +257,43 @@ int _gnutls13_handshake_server(gnutls_session_t session) return 0; } +int +_gnutls13_recv_async_handshake(gnutls_session_t session, gnutls_buffer_st *buf) +{ + uint8_t type; + int ret; + size_t handshake_header_size = HANDSHAKE_HEADER_SIZE(session); + size_t length; + + if (buf->length < handshake_header_size) { + gnutls_assert(); + return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; + } + + if (session->security_parameters.entity == GNUTLS_CLIENT) { + ret = _gnutls_buffer_pop_prefix8(buf, &type, 0); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = _gnutls_buffer_pop_prefix24(buf, &length, 1); + if (ret < 0) + return gnutls_assert_val(ret); + + switch(type) { + case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: + ret = _gnutls13_recv_session_ticket(session, buf); + if (ret < 0) + return gnutls_assert_val(ret); + break; + default: + gnutls_assert(); + return GNUTLS_E_UNEXPECTED_PACKET; + } + + } else { + gnutls_assert(); + return GNUTLS_E_UNEXPECTED_PACKET; + } + + return 0; +} |