Minor fixes to parameter validation in ECDH module
This commit is contained in:
parent
a7634e8347
commit
c81cfece8f
@ -312,8 +312,8 @@ int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx,
|
|||||||
* \param ctx The ECDH context to set up. This must be initialized.
|
* \param ctx The ECDH context to set up. This must be initialized.
|
||||||
* \param key The EC key to use. This must be initialized.
|
* \param key The EC key to use. This must be initialized.
|
||||||
* \param side Defines the source of the key. Possible values are:
|
* \param side Defines the source of the key. Possible values are:
|
||||||
* - \c 1: The imported key is ours.
|
* - #MBEDTLS_ECDH_OURS: The key is ours.
|
||||||
* - \c 0: The imported key is that of the peer.
|
* - #MBEDTLS_ECDH_THEIRS: The key is that of the peer.
|
||||||
*
|
*
|
||||||
* \return \c 0 on success.
|
* \return \c 0 on success.
|
||||||
* \return Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
|
* \return Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
|
||||||
@ -338,7 +338,7 @@ int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx,
|
|||||||
* \param olen The address at which to store the number of Bytes written.
|
* \param olen The address at which to store the number of Bytes written.
|
||||||
* This must not be \c NULL.
|
* This must not be \c NULL.
|
||||||
* \param buf The destination buffer. This must be a writable buffer
|
* \param buf The destination buffer. This must be a writable buffer
|
||||||
* of lsength \p blen Bytes.
|
* of length \p blen Bytes.
|
||||||
* \param blen The size of the destination buffer \p buf in Bytes.
|
* \param blen The size of the destination buffer \p buf in Bytes.
|
||||||
* \param f_rng The RNG function to use. This must not be \c NULL.
|
* \param f_rng The RNG function to use. This must not be \c NULL.
|
||||||
* \param p_rng The RNG context to be passed to \p f_rng. This may be
|
* \param p_rng The RNG context to be passed to \p f_rng. This may be
|
||||||
|
@ -64,10 +64,6 @@ static int ecdh_gen_public_restartable( mbedtls_ecp_group *grp,
|
|||||||
mbedtls_ecp_restart_ctx *rs_ctx )
|
mbedtls_ecp_restart_ctx *rs_ctx )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
ECDH_VALIDATE_RET( grp != NULL );
|
|
||||||
ECDH_VALIDATE_RET( d != NULL );
|
|
||||||
ECDH_VALIDATE_RET( Q != NULL );
|
|
||||||
ECDH_VALIDATE_RET( f_rng != NULL );
|
|
||||||
|
|
||||||
/* If multiplication is in progress, we already generated a privkey */
|
/* If multiplication is in progress, we already generated a privkey */
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
@ -513,6 +509,7 @@ int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
|
|||||||
ECDH_VALIDATE_RET( ctx != NULL );
|
ECDH_VALIDATE_RET( ctx != NULL );
|
||||||
ECDH_VALIDATE_RET( olen != NULL );
|
ECDH_VALIDATE_RET( olen != NULL );
|
||||||
ECDH_VALIDATE_RET( buf != NULL );
|
ECDH_VALIDATE_RET( buf != NULL );
|
||||||
|
ECDH_VALIDATE_RET( f_rng != NULL );
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
restart_enabled = ctx->restart_enabled;
|
restart_enabled = ctx->restart_enabled;
|
||||||
|
Loading…
Reference in New Issue
Block a user