mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-28 20:56:19 +00:00
cert_write: support all hash algorithms
For some reason, RIPEMD160, SHA224 and SHA384 were not supported. This fixes the build recipes for tests/data_files/cert_sha224.crt and tests/data_files/cert_sha384.crt . Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
741c4e2d64
commit
a3511b97c1
|
@ -145,8 +145,9 @@ int main( void )
|
||||||
" is_ca=%%d default: 0 (disabled)\n" \
|
" is_ca=%%d default: 0 (disabled)\n" \
|
||||||
" max_pathlen=%%d default: -1 (none)\n" \
|
" max_pathlen=%%d default: -1 (none)\n" \
|
||||||
" md=%%s default: SHA256\n" \
|
" md=%%s default: SHA256\n" \
|
||||||
" Supported values:\n" \
|
" Supported values (if enabled):\n" \
|
||||||
" MD2, MD4, MD5, SHA1, SHA256, SHA512\n"\
|
" MD2, MD4, MD5, RIPEMD160, SHA1,\n" \
|
||||||
|
" SHA224, SHA256, SHA384, SHA512\n" \
|
||||||
" version=%%d default: 3\n" \
|
" version=%%d default: 3\n" \
|
||||||
" Possible values: 1, 2, 3\n"\
|
" Possible values: 1, 2, 3\n"\
|
||||||
" subject_identifier=%%s default: 1\n" \
|
" subject_identifier=%%s default: 1\n" \
|
||||||
|
@ -379,23 +380,14 @@ int main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
else if( strcmp( p, "md" ) == 0 )
|
else if( strcmp( p, "md" ) == 0 )
|
||||||
{
|
{
|
||||||
if( strcmp( q, "SHA1" ) == 0 )
|
const mbedtls_md_info_t *md_info =
|
||||||
opt.md = MBEDTLS_MD_SHA1;
|
mbedtls_md_info_from_string( q );
|
||||||
else if( strcmp( q, "SHA256" ) == 0 )
|
if( md_info == NULL )
|
||||||
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
|
|
||||||
{
|
{
|
||||||
mbedtls_printf( "Invalid argument for option %s\n", p );
|
mbedtls_printf( "Invalid argument for option %s\n", p );
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
|
opt.md = mbedtls_md_get_type( md_info );
|
||||||
}
|
}
|
||||||
else if( strcmp( p, "version" ) == 0 )
|
else if( strcmp( p, "version" ) == 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue