Skip to content

Commit

Permalink
Rebase mbedtls_ssl_ticket -> mbedtls_ssl_session
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
lhuang04 committed Mar 16, 2021
1 parent 810b7a3 commit aa4ddd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/mbedtls/quic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {
#endif

typedef struct mbedtls_ssl_context mbedtls_ssl_context;
typedef struct mbedtls_ssl_ticket mbedtls_ssl_ticket;
typedef struct mbedtls_ssl_session mbedtls_ssl_session;
typedef struct mbedtls_quic_input mbedtls_quic_input;
typedef struct quic_input_msg quic_input_msg;
typedef struct quic_input_queue quic_input_queue;
Expand Down Expand Up @@ -176,7 +176,7 @@ typedef int mbedtls_quic_send_alert_t(
*/
typedef void mbedtls_quic_process_new_session_t(
void *param,
mbedtls_ssl_ticket *session_ticket);
mbedtls_ssl_session *session_ticket);
/**
* \brief QUIC method callbacks.
*/
Expand Down
17 changes: 10 additions & 7 deletions library/ssl_tls13_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4920,21 +4920,24 @@ int mbedtls_ssl_quic_post_handshake(mbedtls_ssl_context *ssl)
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_parse_new_session_ticket", ret);
return(ret);
}
mbedtls_ssl_ticket* ticket = mbedtls_calloc(1, sizeof(mbedtls_ssl_ticket));
if (ticket == NULL)

mbedtls_ssl_session* session_ticket = mbedtls_calloc(1, sizeof(mbedtls_ssl_session));
if (session_ticket == NULL)
{
return (MBEDTLS_ERR_SSL_ALLOC_FAILED);
}
if ((mbedtls_ssl_get_client_ticket(ssl, ticket) != 0))

if( ( ret = mbedtls_ssl_get_session( ssl, session_ticket ) ) != 0 )
{
mbedtls_free(ticket->ticket);
mbedtls_free(ticket);
return (MBEDTLS_ERR_SSL_INTERNAL_ERROR);
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_get_session", ret);
mbedtls_ssl_session_free(session_ticket);
return(ret);
}

// the ticket will be transfered to and be released by the app
ssl->quic_method->process_new_session(
ssl->p_quic_method,
ticket);
session_ticket);
return (ret);
}

Expand Down

0 comments on commit aa4ddd9

Please sign in to comment.