1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

- Added test coverage for X509parse

- Fixed segfault in rsa_check_privkey() and rsa_check_pubkey() and added test
This commit is contained in:
Paul Bakker
2009-07-10 22:38:58 +00:00
parent 7d8a100783
commit 37940d9ff6
12 changed files with 495 additions and 1 deletions

View File

@ -133,6 +133,9 @@ cleanup:
*/
int rsa_check_pubkey( rsa_context *ctx )
{
if( !ctx->N.p || !ctx->E.p )
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
if( ( ctx->N.p[0] & 1 ) == 0 ||
( ctx->E.p[0] & 1 ) == 0 )
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
@ -159,6 +162,9 @@ int rsa_check_privkey( rsa_context *ctx )
if( ( ret = rsa_check_pubkey( ctx ) ) != 0 )
return( ret );
if( !ctx->P.p || !ctx->Q.p || !ctx->D.p )
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
mpi_init( &PQ, &DE, &P1, &Q1, &H, &I, &G, NULL );
MPI_CHK( mpi_mul_mpi( &PQ, &ctx->P, &ctx->Q ) );