mirror of https://github.com/wolfSSL/wolfssl.git
commit
276e090a1f
|
@ -11214,6 +11214,27 @@ WOLFSSL_API int wolfSSL_CTX_set_TicketHint(WOLFSSL_CTX* ctx, int);
|
||||||
*/
|
*/
|
||||||
WOLFSSL_API int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void*);
|
WOLFSSL_API int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void*);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief This function gets the session ticket encrypt user context for the
|
||||||
|
callback. For server side use.
|
||||||
|
|
||||||
|
\return userCtx will be returned upon successfully getting the session.
|
||||||
|
\return NULL will be returned on failure. This is caused by
|
||||||
|
passing invalid arguments to the function, or when the user context has
|
||||||
|
not been set.
|
||||||
|
|
||||||
|
\param ctx pointer to the WOLFSSL_CTX object, created
|
||||||
|
with wolfSSL_CTX_new().
|
||||||
|
|
||||||
|
_Example_
|
||||||
|
\code
|
||||||
|
none
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\sa wolfSSL_CTX_set_TicketEncCtx
|
||||||
|
*/
|
||||||
|
WOLFSSL_API void* wolfSSL_CTX_get_TicketEncCtx(WOLFSSL_CTX* ctx);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\ingroup IO
|
\ingroup IO
|
||||||
|
|
||||||
|
|
|
@ -2893,6 +2893,14 @@ int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void* userCtx)
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get user context - returns userCtx on success, NULL on failure */
|
||||||
|
void* wolfSSL_CTX_get_TicketEncCtx(WOLFSSL_CTX* ctx)
|
||||||
|
{
|
||||||
|
if (ctx == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return ctx->ticketEncCtx;
|
||||||
|
}
|
||||||
#endif /* !NO_WOLFSSL_SERVER */
|
#endif /* !NO_WOLFSSL_SERVER */
|
||||||
|
|
||||||
#if !defined(NO_WOLFSSL_CLIENT)
|
#if !defined(NO_WOLFSSL_CLIENT)
|
||||||
|
|
21
tests/api.c
21
tests/api.c
|
@ -1748,6 +1748,26 @@ static void test_wolfSSL_CTX_enable_disable(void)
|
||||||
wolfSSL_CTX_free(ctx);
|
wolfSSL_CTX_free(ctx);
|
||||||
#endif /* NO_CERTS */
|
#endif /* NO_CERTS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_wolfSSL_CTX_ticket_API(void)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_SESSION_TICKET) && !defined(NO_WOLFSSL_SERVER)
|
||||||
|
WOLFSSL_CTX* ctx = NULL;
|
||||||
|
void *userCtx = (void*)"this is my ctx";
|
||||||
|
|
||||||
|
AssertNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
|
||||||
|
|
||||||
|
AssertIntEQ(WOLFSSL_SUCCESS, wolfSSL_CTX_set_TicketEncCtx(ctx, userCtx));
|
||||||
|
AssertTrue(userCtx == wolfSSL_CTX_get_TicketEncCtx(ctx));
|
||||||
|
|
||||||
|
wolfSSL_CTX_free(ctx);
|
||||||
|
|
||||||
|
AssertIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_set_TicketEncCtx(NULL, userCtx));
|
||||||
|
AssertNull(wolfSSL_CTX_get_TicketEncCtx(NULL));
|
||||||
|
#endif /* HAVE_SESSION_TICKET && !NO_WOLFSSL_SERVER */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*
|
/*----------------------------------------------------------------------------*
|
||||||
| SSL
|
| SSL
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -40289,6 +40309,7 @@ void ApiTest(void)
|
||||||
test_wolfSSL_CTX_SetMinMaxDhKey_Sz();
|
test_wolfSSL_CTX_SetMinMaxDhKey_Sz();
|
||||||
test_wolfSSL_CTX_der_load_verify_locations();
|
test_wolfSSL_CTX_der_load_verify_locations();
|
||||||
test_wolfSSL_CTX_enable_disable();
|
test_wolfSSL_CTX_enable_disable();
|
||||||
|
test_wolfSSL_CTX_ticket_API();
|
||||||
test_server_wolfSSL_new();
|
test_server_wolfSSL_new();
|
||||||
test_client_wolfSSL_new();
|
test_client_wolfSSL_new();
|
||||||
test_wolfSSL_SetTmpDH_file();
|
test_wolfSSL_SetTmpDH_file();
|
||||||
|
|
|
@ -3261,6 +3261,7 @@ WOLFSSL_API int wolfSSL_CTX_set_TicketEncCb(WOLFSSL_CTX* ctx,
|
||||||
SessionTicketEncCb);
|
SessionTicketEncCb);
|
||||||
WOLFSSL_API int wolfSSL_CTX_set_TicketHint(WOLFSSL_CTX* ctx, int);
|
WOLFSSL_API int wolfSSL_CTX_set_TicketHint(WOLFSSL_CTX* ctx, int);
|
||||||
WOLFSSL_API int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void*);
|
WOLFSSL_API int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void*);
|
||||||
|
WOLFSSL_API void* wolfSSL_CTX_get_TicketEncCtx(WOLFSSL_CTX* ctx);
|
||||||
|
|
||||||
#endif /* NO_WOLFSSL_SERVER */
|
#endif /* NO_WOLFSSL_SERVER */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue