mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 08:16:33 +01:00
Start parsing RSASSA-PSS parameters
This commit is contained in:
parent
59a75d5b9d
commit
f346bab139
4 changed files with 120 additions and 1 deletions
|
|
@ -622,6 +622,22 @@ static int x509_crt_parse_der_core( x509_crt *crt, const unsigned char *buf,
|
|||
return( ret );
|
||||
}
|
||||
|
||||
if( crt->sig_pk == POLARSSL_PK_RSASSA_PSS )
|
||||
{
|
||||
int salt_len, trailer_field;
|
||||
|
||||
if( ( ret = x509_get_rsassa_pss_params( &crt->sig_params,
|
||||
&crt->sig_md, &salt_len, &trailer_field ) ) != 0 )
|
||||
return( ret );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure parameters were absent or NULL */
|
||||
if( ( crt->sig_params.tag != ASN1_NULL && crt->sig_params.tag != 0 ) ||
|
||||
crt->sig_params.len != 0 )
|
||||
return( POLARSSL_ERR_X509_INVALID_ALG );
|
||||
}
|
||||
|
||||
/*
|
||||
* issuer Name
|
||||
*/
|
||||
|
|
@ -1300,6 +1316,21 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
|
|||
ret = snprintf( p, n, "%s", desc );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
if( crt->sig_pk == POLARSSL_PK_RSASSA_PSS )
|
||||
{
|
||||
md_type_t md_alg;
|
||||
int salt_len, trailer_field;
|
||||
|
||||
if( ( ret = x509_get_rsassa_pss_params( &crt->sig_params,
|
||||
&md_alg, &salt_len, &trailer_field ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
// TODO: SHA1 harcoded twice (WIP)
|
||||
ret = snprintf( p, n, " (SHA1, MGF1-SHA1, %d, %d)",
|
||||
salt_len, trailer_field );
|
||||
SAFE_SNPRINTF();
|
||||
}
|
||||
|
||||
/* Key size */
|
||||
if( ( ret = x509_key_size_helper( key_size_str, BEFORE_COLON,
|
||||
pk_get_name( &crt->pk ) ) ) != 0 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue