@@ -150,7 +150,8 @@ int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid);
150150 * buffer of length \p blen Bytes. It may be \c NULL if
151151 * \p blen is zero.
152152 * \param blen The length of \p buf in Bytes.
153- * \param f_rng The RNG function. This must not be \c NULL.
153+ * \param f_rng The RNG function, used both to generate the ECDSA nonce
154+ * and for blinding. This must not be \c NULL.
154155 * \param p_rng The RNG context to be passed to \p f_rng. This may be
155156 * \c NULL if \p f_rng doesn't need a context parameter.
156157 *
@@ -160,7 +161,7 @@ int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid);
160161 */
161162int mbedtls_ecdsa_sign (mbedtls_ecp_group * grp , mbedtls_mpi * r , mbedtls_mpi * s ,
162163 const mbedtls_mpi * d , const unsigned char * buf , size_t blen ,
163- int ( * f_rng )( void * , unsigned char * , size_t ) , void * p_rng );
164+ mbedtls_f_rng_t * f_rng , void * p_rng );
164165
165166#if defined(MBEDTLS_ECDSA_DETERMINISTIC )
166167/**
@@ -207,7 +208,7 @@ int mbedtls_ecdsa_sign_det_ext(mbedtls_ecp_group *grp, mbedtls_mpi *r,
207208 mbedtls_mpi * s , const mbedtls_mpi * d ,
208209 const unsigned char * buf , size_t blen ,
209210 mbedtls_md_type_t md_alg ,
210- int ( * f_rng_blind )( void * , unsigned char * , size_t ) ,
211+ mbedtls_f_rng_t * f_rng_blind ,
211212 void * p_rng_blind );
212213#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
213214
@@ -247,7 +248,8 @@ int mbedtls_ecdsa_sign_det_ext(mbedtls_ecp_group *grp, mbedtls_mpi *r,
247248 * buffer of length \p blen Bytes. It may be \c NULL if
248249 * \p blen is zero.
249250 * \param blen The length of \p buf in Bytes.
250- * \param f_rng The RNG function. This must not be \c NULL.
251+ * \param f_rng The RNG function used to generate the ECDSA nonce.
252+ * This must not be \c NULL.
251253 * \param p_rng The RNG context to be passed to \p f_rng. This may be
252254 * \c NULL if \p f_rng doesn't need a context parameter.
253255 * \param f_rng_blind The RNG function used for blinding. This must not be
@@ -271,9 +273,9 @@ int mbedtls_ecdsa_sign_restartable(
271273 mbedtls_mpi * r , mbedtls_mpi * s ,
272274 const mbedtls_mpi * d ,
273275 const unsigned char * buf , size_t blen ,
274- int ( * f_rng )( void * , unsigned char * , size_t ) ,
276+ mbedtls_f_rng_t * f_rng ,
275277 void * p_rng ,
276- int ( * f_rng_blind )( void * , unsigned char * , size_t ) ,
278+ mbedtls_f_rng_t * f_rng_blind ,
277279 void * p_rng_blind ,
278280 mbedtls_ecdsa_restart_ctx * rs_ctx );
279281
@@ -334,7 +336,7 @@ int mbedtls_ecdsa_sign_det_restartable(
334336 mbedtls_mpi * r , mbedtls_mpi * s ,
335337 const mbedtls_mpi * d , const unsigned char * buf , size_t blen ,
336338 mbedtls_md_type_t md_alg ,
337- int ( * f_rng_blind )( void * , unsigned char * , size_t ) ,
339+ mbedtls_f_rng_t * f_rng_blind ,
338340 void * p_rng_blind ,
339341 mbedtls_ecdsa_restart_ctx * rs_ctx );
340342
@@ -458,10 +460,10 @@ int mbedtls_ecdsa_verify_restartable(mbedtls_ecp_group *grp,
458460 * \param sig_size The size of the \p sig buffer in bytes.
459461 * \param slen The address at which to store the actual length of
460462 * the signature written. Must not be \c NULL.
461- * \param f_rng The RNG function. This must not be \c NULL if
462- * #MBEDTLS_ECDSA_DETERMINISTIC is unset. Otherwise,
463- * it is used only for blinding and may be set to \c NULL, but
464- * doing so is DEPRECATED .
463+ * \param f_rng The RNG function. This is used for blinding.
464+ * If #MBEDTLS_ECDSA_DETERMINISTIC is unset, this is also
465+ * used to generate the ECDSA nonce.
466+ * This must not be \c NULL .
465467 * \param p_rng The RNG context to be passed to \p f_rng. This may be
466468 * \c NULL if \p f_rng is \c NULL or doesn't use a context.
467469 *
@@ -473,7 +475,7 @@ int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context *ctx,
473475 mbedtls_md_type_t md_alg ,
474476 const unsigned char * hash , size_t hlen ,
475477 unsigned char * sig , size_t sig_size , size_t * slen ,
476- int ( * f_rng )( void * , unsigned char * , size_t ) ,
478+ mbedtls_f_rng_t * f_rng ,
477479 void * p_rng );
478480
479481/**
@@ -501,9 +503,10 @@ int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context *ctx,
501503 * \param sig_size The size of the \p sig buffer in bytes.
502504 * \param slen The address at which to store the actual length of
503505 * the signature written. Must not be \c NULL.
504- * \param f_rng The RNG function. This must not be \c NULL if
505- * #MBEDTLS_ECDSA_DETERMINISTIC is unset. Otherwise,
506- * it is unused and may be set to \c NULL.
506+ * \param f_rng The RNG function. This is used for blinding.
507+ * If #MBEDTLS_ECDSA_DETERMINISTIC is unset, this is also
508+ * used to generate the ECDSA nonce.
509+ * This must not be \c NULL.
507510 * \param p_rng The RNG context to be passed to \p f_rng. This may be
508511 * \c NULL if \p f_rng is \c NULL or doesn't use a context.
509512 * \param rs_ctx The restart context to use. This may be \c NULL to disable
@@ -520,7 +523,7 @@ int mbedtls_ecdsa_write_signature_restartable(mbedtls_ecdsa_context *ctx,
520523 mbedtls_md_type_t md_alg ,
521524 const unsigned char * hash , size_t hlen ,
522525 unsigned char * sig , size_t sig_size , size_t * slen ,
523- int ( * f_rng )( void * , unsigned char * , size_t ) ,
526+ mbedtls_f_rng_t * f_rng ,
524527 void * p_rng ,
525528 mbedtls_ecdsa_restart_ctx * rs_ctx );
526529
@@ -608,7 +611,7 @@ int mbedtls_ecdsa_read_signature_restartable(mbedtls_ecdsa_context *ctx,
608611 * \return An \c MBEDTLS_ERR_ECP_XXX code on failure.
609612 */
610613int mbedtls_ecdsa_genkey (mbedtls_ecdsa_context * ctx , mbedtls_ecp_group_id gid ,
611- int ( * f_rng )( void * , unsigned char * , size_t ) , void * p_rng );
614+ mbedtls_f_rng_t * f_rng , void * p_rng );
612615
613616/**
614617 * \brief This function sets up an ECDSA context from an EC key pair.
0 commit comments