mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Implement pk_check_pair() for RSA-alt
This commit is contained in:
@@ -83,18 +83,27 @@ exit:
|
||||
/* BEGIN_CASE depends_on:POLARSSL_PK_PARSE_C */
|
||||
void pk_check_pair( char *pub_file, char *prv_file, int ret )
|
||||
{
|
||||
pk_context pub, prv;
|
||||
pk_context pub, prv, alt;
|
||||
|
||||
pk_init( &pub );
|
||||
pk_init( &prv );
|
||||
pk_init( &alt );
|
||||
|
||||
TEST_ASSERT( pk_parse_public_keyfile( &pub, pub_file ) == 0 );
|
||||
TEST_ASSERT( pk_parse_keyfile( &prv, prv_file, NULL ) == 0 );
|
||||
|
||||
TEST_ASSERT( pk_check_pair( &pub, &prv ) == ret );
|
||||
|
||||
if( pk_get_type( &prv ) == POLARSSL_PK_RSA )
|
||||
{
|
||||
TEST_ASSERT( pk_init_ctx_rsa_alt( &alt, pk_rsa( prv ),
|
||||
rsa_decrypt_func, rsa_sign_func, rsa_key_len_func ) == 0 );
|
||||
TEST_ASSERT( pk_check_pair( &pub, &alt ) == ret );
|
||||
}
|
||||
|
||||
pk_free( &pub );
|
||||
pk_free( &prv );
|
||||
pk_free( &alt );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
Reference in New Issue
Block a user