Ensure RSA test suite calls rsa_private with PRNG

This commit is contained in:
Hanno Becker 2017-11-06 15:10:23 +00:00
parent 21f83753f5
commit e2ccaddf0a

View File

@ -43,16 +43,19 @@ int mbedtls_rsa_decrypt_func( void *ctx, int mode, size_t *olen,
const unsigned char *input, unsigned char *output, const unsigned char *input, unsigned char *output,
size_t output_max_len ) size_t output_max_len )
{ {
return( mbedtls_rsa_pkcs1_decrypt( (mbedtls_rsa_context *) ctx, NULL, NULL, mode, olen, return( mbedtls_rsa_pkcs1_decrypt( (mbedtls_rsa_context *) ctx,
input, output, output_max_len ) ); rnd_std_rand, NULL, mode, olen,
input, output, output_max_len ) );
} }
int mbedtls_rsa_sign_func( void *ctx, int mbedtls_rsa_sign_func( void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
int mode, mbedtls_md_type_t md_alg, unsigned int hashlen, int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
const unsigned char *hash, unsigned char *sig ) const unsigned char *hash, unsigned char *sig )
{ {
return( mbedtls_rsa_pkcs1_sign( (mbedtls_rsa_context *) ctx, f_rng, p_rng, mode, ((void) f_rng);
md_alg, hashlen, hash, sig ) ); ((void) p_rng);
return( mbedtls_rsa_pkcs1_sign( (mbedtls_rsa_context *) ctx, rnd_std_rand, NULL, mode,
md_alg, hashlen, hash, sig ) );
} }
size_t mbedtls_rsa_key_len_func( void *ctx ) size_t mbedtls_rsa_key_len_func( void *ctx )
{ {