diff --git a/include/mbedtls/dhm.h b/include/mbedtls/dhm.h index 6c319f8047..e8c8a82f50 100644 --- a/include/mbedtls/dhm.h +++ b/include/mbedtls/dhm.h @@ -315,18 +315,18 @@ size_t mbedtls_dhm_get_len( const mbedtls_dhm_context *ctx ); /** * \brief This function copies a parameter of a DHM key. * - * \param dest The MPI object to copy the value into. It must be - * initialized. * \param ctx The DHM context to query. * \param param The parameter to copy. + * \param dest The MPI object to copy the value into. It must be + * initialized. * * \return \c 0 on success. * \return #MBEDTLS_ERR_DHM_BAD_INPUT_DATA if \p field is invalid. * \return An \c MBEDTLS_ERR_MPI_XXX error code if the copy fails. */ -int mbedtls_dhm_get_value( mbedtls_mpi *dest, - const mbedtls_dhm_context *ctx, - mbedtls_dhm_parameter param ); +int mbedtls_dhm_get_value( const mbedtls_dhm_context *ctx, + mbedtls_dhm_parameter param, + mbedtls_mpi *dest ); /** * \brief This function frees and clears the components diff --git a/library/dhm.c b/library/dhm.c index cb9299faba..e88f3a2c73 100644 --- a/library/dhm.c +++ b/library/dhm.c @@ -134,9 +134,9 @@ size_t mbedtls_dhm_get_len( const mbedtls_dhm_context *ctx ) return( mbedtls_mpi_size( &ctx->P ) ); } -int mbedtls_dhm_get_value( mbedtls_mpi *dest, - const mbedtls_dhm_context *ctx, - mbedtls_dhm_parameter param ) +int mbedtls_dhm_get_value( const mbedtls_dhm_context *ctx, + mbedtls_dhm_parameter param, + mbedtls_mpi *dest ) { const mbedtls_mpi *src = NULL; switch( param ) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index bef686403d..560597dec7 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3871,10 +3871,10 @@ int mbedtls_ssl_conf_dh_param_ctx( mbedtls_ssl_config *conf, mbedtls_dhm_context { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; - if( ( ret = mbedtls_dhm_get_value( &conf->dhm_P, dhm_ctx, - MBEDTLS_DHM_PARAM_P ) ) != 0 || - ( ret = mbedtls_dhm_get_value( &conf->dhm_G, dhm_ctx, - MBEDTLS_DHM_PARAM_G ) ) != 0 ) + if( ( ret = mbedtls_dhm_get_value( dhm_ctx, MBEDTLS_DHM_PARAM_P, + &conf->dhm_P ) ) != 0 || + ( ret = mbedtls_dhm_get_value( dhm_ctx, MBEDTLS_DHM_PARAM_G, + &conf->dhm_G ) ) != 0 ) { mbedtls_mpi_free( &conf->dhm_P ); mbedtls_mpi_free( &conf->dhm_G ); diff --git a/tests/suites/test_suite_dhm.function b/tests/suites/test_suite_dhm.function index d48c4e38e6..62e634a7f7 100644 --- a/tests/suites/test_suite_dhm.function +++ b/tests/suites/test_suite_dhm.function @@ -9,7 +9,7 @@ int check_get_value( const mbedtls_dhm_context *ctx, int ok = 0; mbedtls_mpi_init( &actual ); - TEST_ASSERT( mbedtls_dhm_get_value( &actual, ctx, param ) == 0 ); + TEST_ASSERT( mbedtls_dhm_get_value( ctx, param, &actual ) == 0 ); TEST_ASSERT( mbedtls_mpi_cmp_mpi( &actual, expected ) == 0 ); ok = 1;