ssl_server2: get op_name from context in ssl_async_resume as well

This commit is contained in:
Gilles Peskine 2018-04-30 16:37:23 +02:00
parent 9ceae8b4f6
commit 276b9a650c

View File

@ -1039,7 +1039,7 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
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];
int ret; int ret;
const char *op_name = NULL; const char *op_name;
if( ctx->remaining_delay > 0 ) if( ctx->remaining_delay > 0 )
{ {
@ -1052,14 +1052,12 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
switch( ctx->operation_type ) switch( ctx->operation_type )
{ {
case ASYNC_OP_DECRYPT: case ASYNC_OP_DECRYPT:
op_name = "decrypt";
ret = mbedtls_pk_decrypt( key_slot->pk, ret = mbedtls_pk_decrypt( key_slot->pk,
ctx->input, ctx->input_len, ctx->input, ctx->input_len,
output, output_len, output_size, output, output_len, output_size,
config_data->f_rng, config_data->p_rng ); config_data->f_rng, config_data->p_rng );
break; break;
case ASYNC_OP_SIGN: case ASYNC_OP_SIGN:
op_name = "sign";
ret = mbedtls_pk_sign( key_slot->pk, ret = mbedtls_pk_sign( key_slot->pk,
ctx->md_alg, ctx->md_alg,
ctx->input, ctx->input_len, ctx->input, ctx->input_len,
@ -1073,6 +1071,8 @@ static int ssl_async_resume( mbedtls_ssl_context *ssl,
break; break;
} }
op_name = ssl_async_operation_names[ctx->operation_type];
if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_RESUME ) if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_RESUME )
{ {
mbedtls_printf( "Async resume callback: %s done but injected error\n", mbedtls_printf( "Async resume callback: %s done but injected error\n",