The Great Renaming

A simple execution of tmp/invoke-rename.pl
This commit is contained in:
Manuel Pégourié-Gonnard 2015-04-08 12:49:31 +02:00
parent b5904d25ef
commit 2cf5a7c98e
291 changed files with 36012 additions and 36012 deletions

View file

@ -5,137 +5,137 @@
/* END_HEADER */
/* BEGIN_DEPENDENCIES
* depends_on:POLARSSL_PK_PARSE_C:POLARSSL_BIGNUM_C
* depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_BIGNUM_C
* END_DEPENDENCIES
*/
/* BEGIN_CASE depends_on:POLARSSL_RSA_C:POLARSSL_FS_IO */
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_FS_IO */
void pk_parse_keyfile_rsa( char *key_file, char *password, int result )
{
pk_context ctx;
mbedtls_pk_context ctx;
int res;
char *pwd = password;
pk_init( &ctx );
mbedtls_pk_init( &ctx );
if( strcmp( pwd, "NULL" ) == 0 )
pwd = NULL;
res = pk_parse_keyfile( &ctx, key_file, pwd );
res = mbedtls_pk_parse_keyfile( &ctx, key_file, pwd );
TEST_ASSERT( res == result );
if( res == 0 )
{
rsa_context *rsa;
TEST_ASSERT( pk_can_do( &ctx, POLARSSL_PK_RSA ) );
rsa = pk_rsa( ctx );
TEST_ASSERT( rsa_check_privkey( rsa ) == 0 );
mbedtls_rsa_context *rsa;
TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_RSA ) );
rsa = mbedtls_pk_rsa( ctx );
TEST_ASSERT( mbedtls_rsa_check_privkey( rsa ) == 0 );
}
exit:
pk_free( &ctx );
mbedtls_pk_free( &ctx );
}
/* END_CASE */
/* BEGIN_CASE depends_on:POLARSSL_RSA_C:POLARSSL_FS_IO */
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_FS_IO */
void pk_parse_public_keyfile_rsa( char *key_file, int result )
{
pk_context ctx;
mbedtls_pk_context ctx;
int res;
pk_init( &ctx );
mbedtls_pk_init( &ctx );
res = pk_parse_public_keyfile( &ctx, key_file );
res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
TEST_ASSERT( res == result );
if( res == 0 )
{
rsa_context *rsa;
TEST_ASSERT( pk_can_do( &ctx, POLARSSL_PK_RSA ) );
rsa = pk_rsa( ctx );
TEST_ASSERT( rsa_check_pubkey( rsa ) == 0 );
mbedtls_rsa_context *rsa;
TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_RSA ) );
rsa = mbedtls_pk_rsa( ctx );
TEST_ASSERT( mbedtls_rsa_check_pubkey( rsa ) == 0 );
}
exit:
pk_free( &ctx );
mbedtls_pk_free( &ctx );
}
/* END_CASE */
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_ECP_C */
/* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_ECP_C */
void pk_parse_public_keyfile_ec( char *key_file, int result )
{
pk_context ctx;
mbedtls_pk_context ctx;
int res;
pk_init( &ctx );
mbedtls_pk_init( &ctx );
res = pk_parse_public_keyfile( &ctx, key_file );
res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
TEST_ASSERT( res == result );
if( res == 0 )
{
ecp_keypair *eckey;
TEST_ASSERT( pk_can_do( &ctx, POLARSSL_PK_ECKEY ) );
eckey = pk_ec( ctx );
TEST_ASSERT( ecp_check_pubkey( &eckey->grp, &eckey->Q ) == 0 );
mbedtls_ecp_keypair *eckey;
TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_ECKEY ) );
eckey = mbedtls_pk_ec( ctx );
TEST_ASSERT( mbedtls_ecp_check_pubkey( &eckey->grp, &eckey->Q ) == 0 );
}
exit:
pk_free( &ctx );
mbedtls_pk_free( &ctx );
}
/* END_CASE */
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_ECP_C */
/* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_ECP_C */
void pk_parse_keyfile_ec( char *key_file, char *password, int result )
{
pk_context ctx;
mbedtls_pk_context ctx;
int res;
pk_init( &ctx );
mbedtls_pk_init( &ctx );
res = pk_parse_keyfile( &ctx, key_file, password );
res = mbedtls_pk_parse_keyfile( &ctx, key_file, password );
TEST_ASSERT( res == result );
if( res == 0 )
{
ecp_keypair *eckey;
TEST_ASSERT( pk_can_do( &ctx, POLARSSL_PK_ECKEY ) );
eckey = pk_ec( ctx );
TEST_ASSERT( ecp_check_privkey( &eckey->grp, &eckey->d ) == 0 );
mbedtls_ecp_keypair *eckey;
TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_ECKEY ) );
eckey = mbedtls_pk_ec( ctx );
TEST_ASSERT( mbedtls_ecp_check_privkey( &eckey->grp, &eckey->d ) == 0 );
}
exit:
pk_free( &ctx );
mbedtls_pk_free( &ctx );
}
/* END_CASE */
/* BEGIN_CASE depends_on:POLARSSL_RSA_C */
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
void pk_parse_key_rsa( char *key_data, char *result_str, int result )
{
pk_context pk;
mbedtls_pk_context pk;
unsigned char buf[2000];
unsigned char output[2000];
int data_len;
((void) result_str);
pk_init( &pk );
mbedtls_pk_init( &pk );
memset( buf, 0, 2000 );
memset( output, 0, 2000 );
data_len = unhexify( buf, key_data );
TEST_ASSERT( pk_parse_key( &pk, buf, data_len, NULL, 0 ) == ( result ) );
TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf, data_len, NULL, 0 ) == ( result ) );
if( ( result ) == 0 )
{
TEST_ASSERT( 1 );
}
exit:
pk_free( &pk );
mbedtls_pk_free( &pk );
}
/* END_CASE */