Rework mbedtls_test_param_failed_get_state_buf()

Rework mbedtls_test_param_failed_get_state_buf() and
its documentation.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-09-25 10:45:06 +02:00
parent d8902b6e3d
commit bf4f40883e
2 changed files with 15 additions and 5 deletions

View file

@ -147,7 +147,7 @@ void mbedtls_test_param_failed_expect_call( void );
int mbedtls_test_param_failed_check_expected_call( void ); int mbedtls_test_param_failed_check_expected_call( void );
/** /**
* \brief Get a pointer to the object of type jmp_buf holding the execution * \brief Get the address of the object of type jmp_buf holding the execution
* state information used by mbedtls_param_failed() to do a long jump. * state information used by mbedtls_param_failed() to do a long jump.
* *
* \note If a call to mbedtls_param_failed() is not expected in the sense * \note If a call to mbedtls_param_failed() is not expected in the sense
@ -156,9 +156,19 @@ int mbedtls_test_param_failed_check_expected_call( void );
* execution to the state stored in the jmp_buf object whose address * execution to the state stored in the jmp_buf object whose address
* is returned by the present function. * is returned by the present function.
* *
* \note The returned pointer is of type void* as its type is opaque, * \note This function is intended to provide the parameter of the
* implementation dependent (jmp_buf is an array type not the type of * setjmp() function to set-up where mbedtls_param_failed() should
* one element of an array). * long-jump if it has to. It is foreseen to be used as:
*
* setjmp( mbedtls_test_param_failed_get_state_buf() ).
*
* \note The type of the returned value is not jmp_buf as jmp_buf is an
* an array type (C specification) and a function cannot return an
* array type.
*
* \note The type of the returned value is not jmp_buf* as then the return
* value couldn't be used by setjmp(), as its parameter's type is
* jmp_buf.
* *
* \return Address of the object of type jmp_buf holding the execution state * \return Address of the object of type jmp_buf holding the execution state
* information used by mbedtls_param_failed() to do a long jump. * information used by mbedtls_param_failed() to do a long jump.

View file

@ -211,7 +211,7 @@ int mbedtls_test_param_failed_check_expected_call( void )
void* mbedtls_test_param_failed_get_state_buf( void ) void* mbedtls_test_param_failed_get_state_buf( void )
{ {
return &param_failed_ctx.state[0]; return &param_failed_ctx.state;
} }
void mbedtls_test_param_failed_reset_state( void ) void mbedtls_test_param_failed_reset_state( void )