mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-07 15:09:28 +01:00
Merge changes to config examples and configuration issues
This commit is contained in:
commit
2a45d1c8bb
19 changed files with 290 additions and 117 deletions
|
|
@ -16,7 +16,11 @@ my %configs = (
|
|||
'config-mini-tls1_1.h'
|
||||
=> '-m tls1_1 -f \'^DES-CBC3-SHA$\|^TLS-RSA-WITH-3DES-EDE-CBC-SHA$\'',
|
||||
'config-suite-b.h'
|
||||
=> "-m tls1_2 -f 'ECDHE-ECDSA.*AES.*GCM'",
|
||||
=> "-m tls1_2 -f 'ECDHE-ECDSA.*AES.*GCM' -p PolarSSL",
|
||||
'config-picocoin.h'
|
||||
=> 0,
|
||||
'config-ccm-psk-tls1_2.h'
|
||||
=> '-m tls1_2 -f \'TLS-PSK.*AES.*CCM\'',
|
||||
);
|
||||
|
||||
# If no config-name is provided, use all known configs.
|
||||
|
|
@ -59,9 +63,17 @@ while( my ($conf, $args) = each %configs ) {
|
|||
|
||||
system( "make" ) and abort "Failed to build: $conf\n";
|
||||
system( "make $test" ) and abort "Failed test suite: $conf\n";
|
||||
print "\nrunning compat.sh $args\n";
|
||||
system( "cd tests && ./compat.sh $args" )
|
||||
and abort "Failed compat.sh: $conf\n";
|
||||
|
||||
if( $args )
|
||||
{
|
||||
print "\nrunning compat.sh $args\n";
|
||||
system( "cd tests && ./compat.sh $args" )
|
||||
and abort "Failed compat.sh: $conf\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\nskipping compat.sh\n";
|
||||
}
|
||||
}
|
||||
|
||||
system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n";
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void cipher_null_args( )
|
|||
TEST_ASSERT( cipher_reset( NULL ) == POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_ASSERT( cipher_reset( &ctx ) == POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( cipher_update_ad( NULL, buf, 0 )
|
||||
== POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_ASSERT( cipher_update_ad( &ctx, buf, 0 )
|
||||
|
|
@ -77,7 +77,7 @@ void cipher_null_args( )
|
|||
TEST_ASSERT( cipher_finish( &ctx, buf, &olen )
|
||||
== POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( cipher_write_tag( NULL, buf, olen )
|
||||
== POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
TEST_ASSERT( cipher_write_tag( &ctx, buf, olen )
|
||||
|
|
@ -157,10 +157,10 @@ void enc_dec_buf( int cipher_id, char *cipher_string, int key_len,
|
|||
TEST_ASSERT( 0 == cipher_reset( &ctx_dec ) );
|
||||
TEST_ASSERT( 0 == cipher_reset( &ctx_enc ) );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx_dec, ad, sizeof( ad ) - i ) );
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx_enc, ad, sizeof( ad ) - i ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* encode length number of bytes from inbuf */
|
||||
TEST_ASSERT( 0 == cipher_update( &ctx_enc, inbuf, length, encbuf, &outlen ) );
|
||||
|
|
@ -174,9 +174,9 @@ void enc_dec_buf( int cipher_id, char *cipher_string, int key_len,
|
|||
TEST_ASSERT( 0 == cipher_finish( &ctx_enc, encbuf + outlen, &outlen ) );
|
||||
total_len += outlen;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_write_tag( &ctx_enc, tag, sizeof( tag ) ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
TEST_ASSERT( total_len == length ||
|
||||
( total_len % cipher_get_block_size( &ctx_enc ) == 0 &&
|
||||
|
|
@ -195,9 +195,9 @@ void enc_dec_buf( int cipher_id, char *cipher_string, int key_len,
|
|||
TEST_ASSERT( 0 == cipher_finish( &ctx_dec, decbuf + outlen, &outlen ) );
|
||||
total_len += outlen;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_check_tag( &ctx_dec, tag, sizeof( tag ) ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* check result */
|
||||
TEST_ASSERT( total_len == length );
|
||||
|
|
@ -250,9 +250,9 @@ void enc_fail( int cipher_id, int pad_mode, int key_len,
|
|||
#endif /* POLARSSL_CIPHER_MODE_WITH_PADDING */
|
||||
TEST_ASSERT( 0 == cipher_set_iv( &ctx, iv, 16 ) );
|
||||
TEST_ASSERT( 0 == cipher_reset( &ctx ) );
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx, NULL, 0 ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* encode length number of bytes from inbuf */
|
||||
TEST_ASSERT( 0 == cipher_update( &ctx, inbuf, length, encbuf, &outlen ) );
|
||||
|
|
@ -297,9 +297,9 @@ void dec_empty_buf()
|
|||
|
||||
TEST_ASSERT( 0 == cipher_reset( &ctx_dec ) );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx_dec, NULL, 0 ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* decode 0-byte string */
|
||||
TEST_ASSERT( 0 == cipher_update( &ctx_dec, encbuf, 0, decbuf, &outlen ) );
|
||||
|
|
@ -359,10 +359,10 @@ void enc_dec_buf_multipart( int cipher_id, int key_len, int first_length_val,
|
|||
TEST_ASSERT( 0 == cipher_reset( &ctx_dec ) );
|
||||
TEST_ASSERT( 0 == cipher_reset( &ctx_enc ) );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx_dec, NULL, 0 ) );
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx_enc, NULL, 0 ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* encode length number of bytes from inbuf */
|
||||
TEST_ASSERT( 0 == cipher_update( &ctx_enc, inbuf, first_length, encbuf, &outlen ) );
|
||||
|
|
@ -416,7 +416,7 @@ void decrypt_test_vec( int cipher_id, int pad_mode,
|
|||
unsigned char ad[200];
|
||||
unsigned char tag[20];
|
||||
size_t key_len, iv_len, cipher_len, clear_len;
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
size_t ad_len, tag_len;
|
||||
#endif
|
||||
cipher_context_t ctx;
|
||||
|
|
@ -435,7 +435,7 @@ void decrypt_test_vec( int cipher_id, int pad_mode,
|
|||
iv_len = unhexify( iv, hex_iv );
|
||||
cipher_len = unhexify( cipher, hex_cipher );
|
||||
clear_len = unhexify( clear, hex_clear );
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
ad_len = unhexify( ad, hex_ad );
|
||||
tag_len = unhexify( tag, hex_tag );
|
||||
#else
|
||||
|
|
@ -455,9 +455,9 @@ void decrypt_test_vec( int cipher_id, int pad_mode,
|
|||
#endif /* POLARSSL_CIPHER_MODE_WITH_PADDING */
|
||||
TEST_ASSERT( 0 == cipher_set_iv( &ctx, iv, iv_len ) );
|
||||
TEST_ASSERT( 0 == cipher_reset( &ctx ) );
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( 0 == cipher_update_ad( &ctx, ad, ad_len ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* decode buffer and check tag */
|
||||
total_len = 0;
|
||||
|
|
@ -466,9 +466,9 @@ void decrypt_test_vec( int cipher_id, int pad_mode,
|
|||
TEST_ASSERT( finish_result == cipher_finish( &ctx, output + outlen,
|
||||
&outlen ) );
|
||||
total_len += outlen;
|
||||
#if defined(POLARSSL_CIPHER_MODE_AEAD)
|
||||
#if defined(POLARSSL_GCM_C)
|
||||
TEST_ASSERT( tag_result == cipher_check_tag( &ctx, tag, tag_len ) );
|
||||
#endif /* POLARSSL_CIPHER_MODE_AEAD */
|
||||
#endif
|
||||
|
||||
/* check plaintext only if everything went fine */
|
||||
if( 0 == finish_result && 0 == tag_result )
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED
|
|||
ecdsa_prim_test_vectors:POLARSSL_ECP_DP_SECP256R1:"DC51D3866A15BACDE33D96F992FCA99DA7E6EF0934E7097559C27F1614C88A7F":"2442A5CC0ECD015FA3CA31DC8E2BBC70BF42D60CBCA20085E0822CB04235E970":"6FC98BD7E50211A4A27102FA3549DF79EBCB4BF246B80945CDDFE7D509BBFD7D":"9E56F509196784D963D1C0A401510EE7ADA3DCC5DEE04B154BF61AF1D5A6DECE":"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD":"CB28E0999B9C7715FD0A80D8E47A77079716CBBF917DD72E97566EA1C066957C":"86FA3BB4E26CAD5BF90B7F81899256CE7594BB1EA0C89212748BFF3B3D5B0315"
|
||||
|
||||
ECDSA primitive rfc 4754 p384
|
||||
depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED
|
||||
depends_on:POLARSSL_ECP_DP_SECP384R1_ENABLED
|
||||
ecdsa_prim_test_vectors:POLARSSL_ECP_DP_SECP384R1:"0BEB646634BA87735D77AE4809A0EBEA865535DE4C1E1DCB692E84708E81A5AF62E528C38B2A81B35309668D73524D9F":"96281BF8DD5E0525CA049C048D345D3082968D10FEDF5C5ACA0C64E6465A97EA5CE10C9DFEC21797415710721F437922":"447688BA94708EB6E2E4D59F6AB6D7EDFF9301D249FE49C33096655F5D502FAD3D383B91C5E7EDAA2B714CC99D5743CA":"B4B74E44D71A13D568003D7489908D564C7761E229C58CBFA18950096EB7463B854D7FA992F934D927376285E63414FA":"CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7":"FB017B914E29149432D8BAC29A514640B46F53DDAB2C69948084E2930F1C8F7E08E07C9C63F2D21A07DCB56A6AF56EB3":"B263A1305E057F984D38726A1B46874109F417BCA112674C528262A40A629AF1CBB9F516CE0FA7D2FF630863A00E8B9F"
|
||||
|
||||
ECDSA primitive rfc 4754 p521
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED
|
|||
ecp_tls_read_group:"030017":0:256
|
||||
|
||||
ECP tls read group #5 (OK, buffer continues)
|
||||
depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED
|
||||
depends_on:POLARSSL_ECP_DP_SECP384R1_ENABLED
|
||||
ecp_tls_read_group:"0300180000":0:384
|
||||
|
||||
ECP tls write-read group #1
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_PEM_WRITE_C */
|
||||
void pk_write_pubkey_check( char *key_file )
|
||||
{
|
||||
pk_context key;
|
||||
|
|
@ -40,7 +40,7 @@ void pk_write_pubkey_check( char *key_file )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_PEM_WRITE_C */
|
||||
void pk_write_key_check( char *key_file )
|
||||
{
|
||||
pk_context key;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ void x509_verify( char *crt_file, char *ca_file, char *crl_file,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_USE_C */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_C */
|
||||
void x509_dn_gets( char *crt_file, char *entity, char *result_str )
|
||||
{
|
||||
x509_crt crt;
|
||||
|
|
@ -169,7 +169,7 @@ void x509_dn_gets( char *crt_file, char *entity, char *result_str )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_USE_C */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_C */
|
||||
void x509_time_expired( char *crt_file, char *entity, int result )
|
||||
{
|
||||
x509_crt crt;
|
||||
|
|
@ -189,7 +189,7 @@ void x509_time_expired( char *crt_file, char *entity, int result )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_USE_C */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_C */
|
||||
void x509_time_future( char *crt_file, char *entity, int result )
|
||||
{
|
||||
x509_crt crt;
|
||||
|
|
@ -316,7 +316,7 @@ void x509_crt_parse_path( char *crt_path, int ret, int nb_crt )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_X509_USE_C */
|
||||
void x509_oid_desc( char *oid_str, char *ref_desc )
|
||||
{
|
||||
x509_buf oid;
|
||||
|
|
@ -341,7 +341,7 @@ void x509_oid_desc( char *oid_str, char *ref_desc )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
/* BEGIN_CASE depends_on:POLARSSL_X509_USE_C */
|
||||
void x509_oid_numstr( char *oid_str, char *numstr, int blen, int ret )
|
||||
{
|
||||
x509_buf oid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue