mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Merge branch 'mbedtls-2.16' into baremetal
This commit is contained in:
commit
1abb159e90
44 changed files with 2445 additions and 903 deletions
|
|
@ -132,8 +132,10 @@ int main( void )
|
|||
#define USAGE_IO \
|
||||
" ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
|
||||
" default: \"\" (pre-loaded)\n" \
|
||||
" use \"none\" to skip loading any top-level CAs.\n" \
|
||||
" ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
|
||||
" default: \"\" (pre-loaded) (overrides ca_file)\n" \
|
||||
" use \"none\" to skip loading any top-level CAs.\n" \
|
||||
" crt_file=%%s Your own cert and chain (in bottom to top order, top may be omitted)\n" \
|
||||
" default: \"\" (pre-loaded)\n" \
|
||||
" key_file=%%s default: \"\" (pre-loaded)\n"
|
||||
|
|
@ -1440,20 +1442,22 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_printf( " . Loading the CA root certificate ..." );
|
||||
fflush( stdout );
|
||||
|
||||
if( strcmp( opt.ca_path, "none" ) == 0 ||
|
||||
strcmp( opt.ca_file, "none" ) == 0 )
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
if( strlen( opt.ca_path ) )
|
||||
if( strcmp( opt.ca_path, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path );
|
||||
ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path );
|
||||
else if( strlen( opt.ca_file ) )
|
||||
if( strcmp( opt.ca_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
|
||||
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(MBEDTLS_CERTS_C)
|
||||
{
|
||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||
for( i = 0; mbedtls_test_cas[i] != NULL; i++ )
|
||||
{
|
||||
ret = mbedtls_x509_crt_parse( &cacert,
|
||||
|
|
@ -1462,12 +1466,23 @@ int main( int argc, char *argv[] )
|
|||
if( ret != 0 )
|
||||
break;
|
||||
}
|
||||
if( ret == 0 )
|
||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||
for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ )
|
||||
{
|
||||
ret = mbedtls_x509_crt_parse_der( &cacert,
|
||||
(const unsigned char *) mbedtls_test_cas_der[i],
|
||||
mbedtls_test_cas_der_len[i] );
|
||||
if( ret != 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
mbedtls_printf( "MBEDTLS_CERTS_C not defined." );
|
||||
}
|
||||
#endif
|
||||
#endif /* MBEDTLS_CERTS_C */
|
||||
if( ret < 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n",
|
||||
|
|
@ -1485,12 +1500,12 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_printf( " . Loading the client cert. and key..." );
|
||||
fflush( stdout );
|
||||
|
||||
if( strcmp( opt.crt_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
if( strlen( opt.crt_file ) )
|
||||
if( strcmp( opt.crt_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file );
|
||||
ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(MBEDTLS_CERTS_C)
|
||||
|
|
@ -1500,7 +1515,7 @@ int main( int argc, char *argv[] )
|
|||
#else
|
||||
{
|
||||
ret = 1;
|
||||
mbedtls_printf("MBEDTLS_CERTS_C not defined.");
|
||||
mbedtls_printf( "MBEDTLS_CERTS_C not defined." );
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
|
|
@ -1510,12 +1525,12 @@ int main( int argc, char *argv[] )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if( strcmp( opt.key_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
if( strlen( opt.key_file ) )
|
||||
if( strcmp( opt.key_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" );
|
||||
ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" );
|
||||
else
|
||||
#endif
|
||||
#if defined(MBEDTLS_CERTS_C)
|
||||
|
|
@ -1525,7 +1540,7 @@ int main( int argc, char *argv[] )
|
|||
#else
|
||||
{
|
||||
ret = 1;
|
||||
mbedtls_printf("MBEDTLS_CERTS_C not defined.");
|
||||
mbedtls_printf( "MBEDTLS_CERTS_C not defined." );
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
|
|
|
|||
|
|
@ -193,8 +193,10 @@ int main( void )
|
|||
#define USAGE_IO \
|
||||
" ca_file=%%s The single file containing the top-level CA(s) you fully trust\n" \
|
||||
" default: \"\" (pre-loaded)\n" \
|
||||
" use \"none\" to skip loading any top-level CAs.\n" \
|
||||
" ca_path=%%s The path containing the top-level CA(s) you fully trust\n" \
|
||||
" default: \"\" (pre-loaded) (overrides ca_file)\n" \
|
||||
" use \"none\" to skip loading any top-level CAs.\n" \
|
||||
" crt_file=%%s Your own cert and chain (in bottom to top order, top may be omitted)\n" \
|
||||
" default: see note after key_file2\n" \
|
||||
" key_file=%%s default: see note after key_file2\n" \
|
||||
|
|
@ -2175,20 +2177,22 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_printf( " . Loading the CA root certificate ..." );
|
||||
fflush( stdout );
|
||||
|
||||
if( strcmp( opt.ca_path, "none" ) == 0 ||
|
||||
strcmp( opt.ca_file, "none" ) == 0 )
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
if( strlen( opt.ca_path ) )
|
||||
if( strcmp( opt.ca_path, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path );
|
||||
ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path );
|
||||
else if( strlen( opt.ca_file ) )
|
||||
if( strcmp( opt.ca_file, "none" ) == 0 )
|
||||
ret = 0;
|
||||
else
|
||||
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
|
||||
ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(MBEDTLS_CERTS_C)
|
||||
{
|
||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||
for( i = 0; mbedtls_test_cas[i] != NULL; i++ )
|
||||
{
|
||||
ret = mbedtls_x509_crt_parse( &cacert,
|
||||
|
|
@ -2197,12 +2201,23 @@ int main( int argc, char *argv[] )
|
|||
if( ret != 0 )
|
||||
break;
|
||||
}
|
||||
if( ret == 0 )
|
||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||
for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ )
|
||||
{
|
||||
ret = mbedtls_x509_crt_parse_der( &cacert,
|
||||
(const unsigned char *) mbedtls_test_cas_der[i],
|
||||
mbedtls_test_cas_der_len[i] );
|
||||
if( ret != 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
mbedtls_printf("MBEDTLS_CERTS_C not defined.");
|
||||
mbedtls_printf( "MBEDTLS_CERTS_C not defined." );
|
||||
}
|
||||
#endif
|
||||
#endif /* MBEDTLS_CERTS_C */
|
||||
if( ret < 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", -ret );
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ int main( void )
|
|||
" Add NsCertType even if it is empty\n" \
|
||||
" md=%%s default: SHA256\n" \
|
||||
" possible values:\n" \
|
||||
" MD4, MD5, SHA1\n" \
|
||||
" MD2, MD4, MD5, SHA1\n" \
|
||||
" SHA224, SHA256\n" \
|
||||
" SHA384, SHA512\n" \
|
||||
"\n"
|
||||
|
|
@ -252,6 +252,13 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
else
|
||||
#endif /* MBEDTLS_MD5_C */
|
||||
#if defined(MBEDTLS_MD2_C)
|
||||
if( strcmp( q, "MD2" ) == 0 )
|
||||
{
|
||||
opt.md_alg = MBEDTLS_MD_MD2;
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_MD2_C */
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
if( strcmp( q, "SHA1" ) == 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ int main( void )
|
|||
" max_pathlen=%%d default: -1 (none)\n" \
|
||||
" md=%%s default: SHA256\n" \
|
||||
" Supported values:\n" \
|
||||
" MD5, SHA1, SHA256, SHA512\n"\
|
||||
" MD2, MD4, MD5, SHA1, SHA256, SHA512\n"\
|
||||
" version=%%d default: 3\n" \
|
||||
" Possible values: 1, 2, 3\n"\
|
||||
" subject_identifier=%%s default: 1\n" \
|
||||
|
|
@ -372,6 +372,10 @@ int main( int argc, char *argv[] )
|
|||
opt.md = MBEDTLS_MD_SHA256;
|
||||
else if( strcmp( q, "SHA512" ) == 0 )
|
||||
opt.md = MBEDTLS_MD_SHA512;
|
||||
else if( strcmp( q, "MD2" ) == 0 )
|
||||
opt.md = MBEDTLS_MD_MD2;
|
||||
else if( strcmp( q, "MD4" ) == 0 )
|
||||
opt.md = MBEDTLS_MD_MD4;
|
||||
else if( strcmp( q, "MD5" ) == 0 )
|
||||
opt.md = MBEDTLS_MD_MD5;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue