Use deterministic ECDSA in the PK layer

This commit is contained in:
Manuel Pégourié-Gonnard 2014-01-06 16:57:24 +01:00
parent 5e6edcfd96
commit 65ad3e4daf

View File

@ -303,10 +303,19 @@ static int ecdsa_sign_wrap( void *ctx, md_type_t md_alg,
unsigned char *sig, size_t *sig_len, unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng ) int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
{ {
/* Use deterministic ECDSA by default if available */
#if defined(POLARSSL_ECDSA_DETERMINISTIC)
((void) f_rng);
((void) p_rng);
return( ecdsa_write_signature_det( (ecdsa_context *) ctx,
hash, hash_len, sig, sig_len, md_alg ) );
#else
((void) md_alg); ((void) md_alg);
return( ecdsa_write_signature( (ecdsa_context *) ctx, return( ecdsa_write_signature( (ecdsa_context *) ctx,
hash, hash_len, sig, sig_len, f_rng, p_rng ) ); hash, hash_len, sig, sig_len, f_rng, p_rng ) );
#endif
} }
static void *ecdsa_alloc_wrap( void ) static void *ecdsa_alloc_wrap( void )