1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Fix dependencies

This commit is contained in:
Manuel Pégourié-Gonnard
2014-01-24 14:37:29 +01:00
parent b7de86d834
commit ce7c6fd433
5 changed files with 31 additions and 12 deletions

View File

@@ -132,6 +132,7 @@ int x509_get_alg( unsigned char **p, const unsigned char *end,
return( 0 );
}
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
/*
* HashAlgorithm ::= AlgorithmIdentifier
*
@@ -324,6 +325,7 @@ int x509_get_rsassa_pss_params( const x509_buf *params,
return( 0 );
}
#endif /* POLARSSL_RSASSA_PSS_CERTIFICATES */
/*
* AttributeTypeAndValue ::= SEQUENCE {

View File

@@ -596,7 +596,7 @@ static int x509_crt_parse_der_core( x509_crt *crt, const unsigned char *buf,
if( ( ret = x509_get_version( &p, end, &crt->version ) ) != 0 ||
( ret = x509_get_serial( &p, end, &crt->serial ) ) != 0 ||
( ret = x509_get_alg( &p, end, &crt->sig_oid1,
&crt->sig_params ) ) != 0 )
&sig_params ) ) != 0 )
{
x509_crt_free( crt );
return( ret );
@@ -617,22 +617,26 @@ static int x509_crt_parse_der_core( x509_crt *crt, const unsigned char *buf,
return( ret );
}
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
if( crt->sig_pk == POLARSSL_PK_RSASSA_PSS )
{
int salt_len, trailer_field;
md_type_t mgf_md;
/* Make sure params are valid */
ret = x509_get_rsassa_pss_params( &crt->sig_params,
ret = x509_get_rsassa_pss_params( &sig_params,
&crt->sig_md, &mgf_md, &salt_len, &trailer_field );
if( ret != 0 )
return( ret );
memcpy( &crt->sig_params, &sig_params, sizeof( x509_buf ) );
}
else
#endif
{
/* Make sure parameters were absent or NULL */
if( ( crt->sig_params.tag != ASN1_NULL && crt->sig_params.tag != 0 ) ||
crt->sig_params.len != 0 )
/* Make sure parameters are absent or NULL */
if( ( sig_params.tag != ASN1_NULL && sig_params.tag != 0 ) ||
sig_params.len != 0 )
return( POLARSSL_ERR_X509_INVALID_ALG );
}
@@ -763,9 +767,13 @@ static int x509_crt_parse_der_core( x509_crt *crt, const unsigned char *buf,
}
if( crt->sig_oid1.len != crt->sig_oid2.len ||
memcmp( crt->sig_oid1.p, crt->sig_oid2.p, crt->sig_oid1.len ) != 0 ||
memcmp( crt->sig_oid1.p, crt->sig_oid2.p, crt->sig_oid1.len ) != 0
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
||
crt->sig_params.len != sig_params.len ||
memcmp( crt->sig_params.p, sig_params.p, sig_params.len ) != 0 )
memcmp( crt->sig_params.p, sig_params.p, sig_params.len ) != 0
#endif
)
{
x509_crt_free( crt );
return( POLARSSL_ERR_X509_SIG_MISMATCH );
@@ -1185,6 +1193,7 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
ret = snprintf( p, n, "%s", desc );
SAFE_SNPRINTF();
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
if( crt->sig_pk == POLARSSL_PK_RSASSA_PSS )
{
md_type_t md_alg, mgf_md;
@@ -1204,6 +1213,7 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
salt_len, trailer_field );
SAFE_SNPRINTF();
}
#endif /* POLARSSL_RSASSA_PSS_CERTIFICATES */
if( ( ret = x509_key_size_helper( key_size_str, BEFORE_COLON,
pk_get_name( &crt->pk ) ) ) != 0 )