mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 16:55:40 +01:00
Fix pkwrite test that were failing on mingw32
Apparently fread() writes some junk after the contents of the file. Don't look at it.
This commit is contained in:
parent
bd6d0aba25
commit
04b7eec539
@ -25,16 +25,16 @@ void pk_write_pubkey_check( char *key_file )
|
||||
mbedtls_pk_init( &key );
|
||||
TEST_ASSERT( mbedtls_pk_parse_public_keyfile( &key, key_file ) == 0 );
|
||||
|
||||
ret = mbedtls_pk_write_pubkey_pem( &key, buf, sizeof( buf ) - 1);
|
||||
TEST_ASSERT( ret >= 0 );
|
||||
ret = mbedtls_pk_write_pubkey_pem( &key, buf, sizeof( buf ));
|
||||
TEST_ASSERT( ret == 0 );
|
||||
|
||||
f = fopen( key_file, "r" );
|
||||
TEST_ASSERT( f != NULL );
|
||||
ilen = fread( check_buf, 1, sizeof( check_buf ) - 1, f );
|
||||
ilen = fread( check_buf, 1, sizeof( check_buf ), f );
|
||||
fclose( f );
|
||||
|
||||
TEST_ASSERT( ilen == strlen( (char *) buf ) );
|
||||
TEST_ASSERT( strncmp( (char *) buf, (char *) check_buf, sizeof( buf ) ) == 0 );
|
||||
TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_pk_free( &key );
|
||||
@ -57,16 +57,16 @@ void pk_write_key_check( char *key_file )
|
||||
mbedtls_pk_init( &key );
|
||||
TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL ) == 0 );
|
||||
|
||||
ret = mbedtls_pk_write_key_pem( &key, buf, sizeof( buf ) - 1);
|
||||
ret = mbedtls_pk_write_key_pem( &key, buf, sizeof( buf ));
|
||||
TEST_ASSERT( ret >= 0 );
|
||||
|
||||
f = fopen( key_file, "r" );
|
||||
TEST_ASSERT( f != NULL );
|
||||
ilen = fread( check_buf, 1, sizeof( check_buf ) - 1, f );
|
||||
ilen = fread( check_buf, 1, sizeof( check_buf ), f );
|
||||
fclose( f );
|
||||
|
||||
TEST_ASSERT( ilen == strlen( (char *) buf ) );
|
||||
TEST_ASSERT( strncmp( (char *) buf, (char *) check_buf, sizeof( buf ) ) == 0 );
|
||||
TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_pk_free( &key );
|
||||
|
Loading…
Reference in New Issue
Block a user