mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 08:05:45 +01:00
Rename mbedtls_ssl_async_{get,set}_data for clarity
Rename to mbedtls_ssl_get_async_operation_data and mbedtls_ssl_set_async_operation_data so that they're about "async operation data" and not about some not-obvious "data".
This commit is contained in:
parent
6a8cb36c24
commit
1febfef561
@ -574,8 +574,8 @@ typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
|
|||||||
* is needed for later processing, because the \p hash buffer
|
* is needed for later processing, because the \p hash buffer
|
||||||
* is no longer valid after this function returns.
|
* is no longer valid after this function returns.
|
||||||
*
|
*
|
||||||
* This function may call mbedtls_ssl_async_set_data() to
|
* This function may call mbedtls_ssl_set_async_operation_data()
|
||||||
* store an operation context for later retrieval
|
* to store an operation context for later retrieval
|
||||||
* by the resume callback.
|
* by the resume callback.
|
||||||
*
|
*
|
||||||
* \note For RSA signatures, this function must produce output
|
* \note For RSA signatures, this function must produce output
|
||||||
@ -598,7 +598,8 @@ typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
|
|||||||
* [RFC 4492 section 5.4](https://tools.ietf.org/html/rfc4492#section-5.4).
|
* [RFC 4492 section 5.4](https://tools.ietf.org/html/rfc4492#section-5.4).
|
||||||
*
|
*
|
||||||
* \param ssl The SSL connection instance. It should not be
|
* \param ssl The SSL connection instance. It should not be
|
||||||
* modified other than via mbedtls_ssl_async_set_data().
|
* modified other than via
|
||||||
|
* mbedtls_ssl_set_async_operation_data().
|
||||||
* \param cert Certificate containing the public key.
|
* \param cert Certificate containing the public key.
|
||||||
* In simple cases, this is one of the pointers passed to
|
* In simple cases, this is one of the pointers passed to
|
||||||
* mbedtls_ssl_conf_own_cert() when configuring the SSL
|
* mbedtls_ssl_conf_own_cert() when configuring the SSL
|
||||||
@ -650,8 +651,8 @@ typedef int mbedtls_ssl_async_sign_t( mbedtls_ssl_context *ssl,
|
|||||||
* is needed for later processing, because the \p input buffer
|
* is needed for later processing, because the \p input buffer
|
||||||
* is no longer valid after this function returns.
|
* is no longer valid after this function returns.
|
||||||
*
|
*
|
||||||
* This function may call mbedtls_ssl_async_set_data() to
|
* This function may call mbedtls_ssl_set_async_operation_data()
|
||||||
* store an operation context for later retrieval
|
* to store an operation context for later retrieval
|
||||||
* by the resume callback.
|
* by the resume callback.
|
||||||
*
|
*
|
||||||
* \warning RSA decryption as used in TLS is subject to a potential
|
* \warning RSA decryption as used in TLS is subject to a potential
|
||||||
@ -664,7 +665,8 @@ typedef int mbedtls_ssl_async_sign_t( mbedtls_ssl_context *ssl,
|
|||||||
* invalid padding.
|
* invalid padding.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL connection instance. It should not be
|
* \param ssl The SSL connection instance. It should not be
|
||||||
* modified other than via mbedtls_ssl_async_set_data().
|
* modified other than via
|
||||||
|
* mbedtls_ssl_set_async_operation_data().
|
||||||
* \param cert Certificate containing the public key.
|
* \param cert Certificate containing the public key.
|
||||||
* In simple cases, this is one of the pointers passed to
|
* In simple cases, this is one of the pointers passed to
|
||||||
* mbedtls_ssl_conf_own_cert() when configuring the SSL
|
* mbedtls_ssl_conf_own_cert() when configuring the SSL
|
||||||
@ -709,13 +711,14 @@ typedef int mbedtls_ssl_async_decrypt_t( mbedtls_ssl_context *ssl,
|
|||||||
* does not wait for the operation to complete. This allows
|
* does not wait for the operation to complete. This allows
|
||||||
* the handshake step to be non-blocking.
|
* the handshake step to be non-blocking.
|
||||||
*
|
*
|
||||||
* This function may call mbedtls_ssl_async_get_data() to
|
* This function may call mbedtls_ssl_get_async_operation_data()
|
||||||
* retrieve an operation context set by the start callback.
|
* to retrieve an operation context set by the start callback.
|
||||||
* It may call mbedtls_ssl_async_set_data() to modify this
|
* It may call mbedtls_ssl_set_async_operation_data() to modify
|
||||||
* context.
|
* this context.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL connection instance. It should not be
|
* \param ssl The SSL connection instance. It should not be
|
||||||
* modified other than via mbedtls_ssl_async_set_data().
|
* modified other than via
|
||||||
|
* mbedtls_ssl_set_async_operation_data().
|
||||||
* \param output Buffer containing the output (signature or decrypted
|
* \param output Buffer containing the output (signature or decrypted
|
||||||
* data) on success.
|
* data) on success.
|
||||||
* \param output_len On success, number of bytes written to \p output.
|
* \param output_len On success, number of bytes written to \p output.
|
||||||
@ -744,8 +747,8 @@ typedef int mbedtls_ssl_async_resume_t( mbedtls_ssl_context *ssl,
|
|||||||
* This callback is called if an SSL connection is closed
|
* This callback is called if an SSL connection is closed
|
||||||
* while an asynchronous operation is in progress.
|
* while an asynchronous operation is in progress.
|
||||||
*
|
*
|
||||||
* This function may call mbedtls_ssl_async_get_data() to
|
* This function may call mbedtls_ssl_get_async_operation_data()
|
||||||
* retrieve an operation context set by the start callback.
|
* to retrieve an operation context set by the start callback.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL connection instance. It should not be
|
* \param ssl The SSL connection instance. It should not be
|
||||||
* modified.
|
* modified.
|
||||||
@ -1582,11 +1585,12 @@ void *mbedtls_ssl_conf_get_async_config_data( const mbedtls_ssl_config *conf );
|
|||||||
* \param ssl The SSL context to access.
|
* \param ssl The SSL context to access.
|
||||||
*
|
*
|
||||||
* \return The asynchronous operation user context that was last
|
* \return The asynchronous operation user context that was last
|
||||||
* set during the current handshake. If mbedtls_ssl_set_data()
|
* set during the current handshake. If
|
||||||
* has not been called during the current handshake yet,
|
* mbedtls_ssl_set_async_operation_data() has not yet been
|
||||||
* this function returns \c NULL.
|
* called during the current handshake, this function returns
|
||||||
|
* \c NULL.
|
||||||
*/
|
*/
|
||||||
void *mbedtls_ssl_async_get_data( const mbedtls_ssl_context *ssl );
|
void *mbedtls_ssl_get_async_operation_data( const mbedtls_ssl_context *ssl );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieve the asynchronous operation user context.
|
* \brief Retrieve the asynchronous operation user context.
|
||||||
@ -1596,10 +1600,10 @@ void *mbedtls_ssl_async_get_data( const mbedtls_ssl_context *ssl );
|
|||||||
*
|
*
|
||||||
* \param ssl The SSL context to access.
|
* \param ssl The SSL context to access.
|
||||||
* \param ctx The new value of the asynchronous operation user context.
|
* \param ctx The new value of the asynchronous operation user context.
|
||||||
* Call mbedtls_ssl_get_data() later during the same handshake
|
* Call mbedtls_ssl_get_async_operation_data() later during the
|
||||||
* to retrieve this value.
|
* same handshake to retrieve this value.
|
||||||
*/
|
*/
|
||||||
void mbedtls_ssl_async_set_data( mbedtls_ssl_context *ssl,
|
void mbedtls_ssl_set_async_operation_data( mbedtls_ssl_context *ssl,
|
||||||
void *ctx );
|
void *ctx );
|
||||||
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
|
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
|
||||||
|
|
||||||
|
@ -2852,7 +2852,7 @@ static int ssl_resume_server_key_exchange( mbedtls_ssl_context *ssl,
|
|||||||
if( ret != MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS )
|
if( ret != MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS )
|
||||||
{
|
{
|
||||||
ssl->handshake->async_in_progress = 0;
|
ssl->handshake->async_in_progress = 0;
|
||||||
mbedtls_ssl_async_set_data( ssl, NULL );
|
mbedtls_ssl_set_async_operation_data( ssl, NULL );
|
||||||
}
|
}
|
||||||
MBEDTLS_SSL_DEBUG_RET( 2, "ssl_resume_server_key_exchange", ret );
|
MBEDTLS_SSL_DEBUG_RET( 2, "ssl_resume_server_key_exchange", ret );
|
||||||
return( ret );
|
return( ret );
|
||||||
@ -3406,7 +3406,7 @@ static int ssl_resume_decrypt_pms( mbedtls_ssl_context *ssl,
|
|||||||
if( ret != MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS )
|
if( ret != MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS )
|
||||||
{
|
{
|
||||||
ssl->handshake->async_in_progress = 0;
|
ssl->handshake->async_in_progress = 0;
|
||||||
mbedtls_ssl_async_set_data( ssl, NULL );
|
mbedtls_ssl_set_async_operation_data( ssl, NULL );
|
||||||
}
|
}
|
||||||
MBEDTLS_SSL_DEBUG_RET( 2, "ssl_decrypt_encrypted_pms", ret );
|
MBEDTLS_SSL_DEBUG_RET( 2, "ssl_decrypt_encrypted_pms", ret );
|
||||||
return( ret );
|
return( ret );
|
||||||
|
@ -6499,7 +6499,7 @@ void *mbedtls_ssl_conf_get_async_config_data( const mbedtls_ssl_config *conf )
|
|||||||
return( conf->p_async_config_data );
|
return( conf->p_async_config_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void *mbedtls_ssl_async_get_data( const mbedtls_ssl_context *ssl )
|
void *mbedtls_ssl_get_async_operation_data( const mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
if( ssl->handshake == NULL )
|
if( ssl->handshake == NULL )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
@ -6507,7 +6507,7 @@ void *mbedtls_ssl_async_get_data( const mbedtls_ssl_context *ssl )
|
|||||||
return( ssl->handshake->user_async_ctx );
|
return( ssl->handshake->user_async_ctx );
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_ssl_async_set_data( mbedtls_ssl_context *ssl,
|
void mbedtls_ssl_set_async_operation_data( mbedtls_ssl_context *ssl,
|
||||||
void *ctx )
|
void *ctx )
|
||||||
{
|
{
|
||||||
if( ssl->handshake != NULL )
|
if( ssl->handshake != NULL )
|
||||||
|
@ -997,7 +997,7 @@ static int ssl_async_start( mbedtls_ssl_context *ssl,
|
|||||||
memcpy( ctx->input, input, input_len );
|
memcpy( ctx->input, input, input_len );
|
||||||
ctx->input_len = input_len;
|
ctx->input_len = input_len;
|
||||||
ctx->remaining_delay = config_data->slots[slot].delay;
|
ctx->remaining_delay = config_data->slots[slot].delay;
|
||||||
mbedtls_ssl_async_set_data( ssl, ctx );
|
mbedtls_ssl_set_async_operation_data( ssl, ctx );
|
||||||
|
|
||||||
if( ctx->remaining_delay == 0 )
|
if( ctx->remaining_delay == 0 )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -1031,7 +1031,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
|
|||||||
size_t *output_len,
|
size_t *output_len,
|
||||||
size_t output_size )
|
size_t output_size )
|
||||||
{
|
{
|
||||||
ssl_async_operation_context_t *ctx = mbedtls_ssl_async_get_data( ssl );
|
ssl_async_operation_context_t *ctx = mbedtls_ssl_get_async_operation_data( ssl );
|
||||||
ssl_async_key_context_t *config_data =
|
ssl_async_key_context_t *config_data =
|
||||||
mbedtls_ssl_conf_get_async_config_data( ssl->conf );
|
mbedtls_ssl_conf_get_async_config_data( ssl->conf );
|
||||||
ssl_async_key_slot_t *key_slot = &config_data->slots[ctx->slot];
|
ssl_async_key_slot_t *key_slot = &config_data->slots[ctx->slot];
|
||||||
@ -1085,7 +1085,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
|
|||||||
|
|
||||||
static void ssl_async_cancel( mbedtls_ssl_context *ssl )
|
static void ssl_async_cancel( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
ssl_async_operation_context_t *ctx = mbedtls_ssl_async_get_data( ssl );
|
ssl_async_operation_context_t *ctx = mbedtls_ssl_get_async_operation_data( ssl );
|
||||||
mbedtls_printf( "Async cancel callback.\n" );
|
mbedtls_printf( "Async cancel callback.\n" );
|
||||||
mbedtls_free( ctx );
|
mbedtls_free( ctx );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user