ssl_server2: merge redundant async_private_error=resume/pk
Testing the case where the resume callback returns an error at the
beginning and the case where it returns an error at the end is
redundant. Keep the test after the output has been produced, to
validate that the product does not use even a valid output if the
return value is an error code.
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index 28d9e6f..544ff36 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -207,7 +207,7 @@
" async_private_delay2=%%d Asynchronous delay for key_file2\n" \
" default: -1 (not asynchronous)\n" \
" async_private_error=%%d Async callback error injection (default=0=none,\n" \
- " 1=start, 2=cancel, 3=resume, 4=pk, negative=first time only)"
+ " 1=start, 2=cancel, 3=resume, negative=first time only)"
#else
#define USAGE_SSL_ASYNC ""
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
@@ -875,8 +875,7 @@
SSL_ASYNC_INJECT_ERROR_START, /*!< Inject error during start */
SSL_ASYNC_INJECT_ERROR_CANCEL, /*!< Close the connection after async start */
SSL_ASYNC_INJECT_ERROR_RESUME, /*!< Inject error during resume */
- SSL_ASYNC_INJECT_ERROR_PK /*!< Inject error during resume */
-#define SSL_ASYNC_INJECT_ERROR_MAX SSL_ASYNC_INJECT_ERROR_PK
+#define SSL_ASYNC_INJECT_ERROR_MAX SSL_ASYNC_INJECT_ERROR_RESUME
} ssl_async_inject_error_t;
typedef struct
@@ -1019,12 +1018,6 @@
int ret;
const char *op_name = NULL;
- if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_RESUME )
- {
- mbedtls_printf( "Async resume callback: injected error\n" );
- return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
- }
-
if( ctx->remaining_delay > 0 )
{
--ctx->remaining_delay;
@@ -1057,7 +1050,7 @@
break;
}
- if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_PK )
+ if( config_data->inject_error == SSL_ASYNC_INJECT_ERROR_RESUME )
{
mbedtls_printf( "Async resume callback: %s done but injected error\n",
op_name );