mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 16:25:43 +01:00
Use sig_opts in x509_sig_alg_gets()
This commit is contained in:
parent
f75f2f7c46
commit
9113603b6b
@ -295,7 +295,8 @@ int x509_get_ext( unsigned char **p, const unsigned char *end,
|
||||
x509_buf *ext, int tag );
|
||||
int x509_load_file( const char *path, unsigned char **buf, size_t *n );
|
||||
int x509_sig_alg_gets( char *buf, size_t size, const x509_buf *sig_oid,
|
||||
pk_type_t pk_alg, const x509_buf *sig_params );
|
||||
pk_type_t pk_alg, md_type_t md_alg,
|
||||
const void *sig_opts );
|
||||
int x509_key_size_helper( char *buf, size_t size, const char *name );
|
||||
int x509_string_to_names( asn1_named_data **head, const char *name );
|
||||
int x509_set_extension( asn1_named_data **head, const char *oid, size_t oid_len,
|
||||
|
@ -836,10 +836,11 @@ int x509_serial_gets( char *buf, size_t size, const x509_buf *serial )
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper for writing signature alrogithms
|
||||
* Helper for writing signature algorithms
|
||||
*/
|
||||
int x509_sig_alg_gets( char *buf, size_t size, const x509_buf *sig_oid,
|
||||
pk_type_t pk_alg, const x509_buf *sig_params )
|
||||
pk_type_t pk_alg, md_type_t md_alg,
|
||||
const void *sig_opts )
|
||||
{
|
||||
int ret;
|
||||
char *p = buf;
|
||||
@ -856,26 +857,24 @@ int x509_sig_alg_gets( char *buf, size_t size, const x509_buf *sig_oid,
|
||||
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
|
||||
if( pk_alg == POLARSSL_PK_RSASSA_PSS )
|
||||
{
|
||||
md_type_t md_alg, mgf_md;
|
||||
const pk_rsassa_pss_options *pss_opts;
|
||||
const md_info_t *md_info, *mgf_md_info;
|
||||
int salt_len;
|
||||
|
||||
if( ( ret = x509_get_rsassa_pss_params( sig_params,
|
||||
&md_alg, &mgf_md, &salt_len ) ) != 0 )
|
||||
return( ret );
|
||||
pss_opts = (const pk_rsassa_pss_options *) sig_opts;
|
||||
|
||||
md_info = md_info_from_type( md_alg );
|
||||
mgf_md_info = md_info_from_type( mgf_md );
|
||||
mgf_md_info = md_info_from_type( pss_opts->mgf1_hash_id );
|
||||
|
||||
ret = snprintf( p, n, " (%s, MGF1-%s, 0x%02X)",
|
||||
md_info ? md_info->name : "???",
|
||||
mgf_md_info ? mgf_md_info->name : "???",
|
||||
salt_len );
|
||||
pss_opts->expected_salt_len );
|
||||
SAFE_SNPRINTF();
|
||||
}
|
||||
#else
|
||||
((void) pk_alg);
|
||||
((void) sig_params);
|
||||
((void) md_alg);
|
||||
((void) sig_opts);
|
||||
#endif /* POLARSSL_RSASSA_PSS_CERTIFICATES */
|
||||
|
||||
return( (int) size - n );
|
||||
|
@ -634,9 +634,9 @@ int x509_crl_info( char *buf, size_t size, const char *prefix,
|
||||
char *p;
|
||||
const x509_crl_entry *entry;
|
||||
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
|
||||
const x509_buf *sig_params = &crl->sig_params;
|
||||
const void *sig_opts = crl->sig_opts;
|
||||
#else
|
||||
const x509_buf *sig_params = NULL;
|
||||
const void *sig_opts = NULL;
|
||||
#endif
|
||||
|
||||
p = buf;
|
||||
@ -693,7 +693,8 @@ int x509_crl_info( char *buf, size_t size, const char *prefix,
|
||||
ret = snprintf( p, n, "\n%ssigned using : ", prefix );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
ret = x509_sig_alg_gets( p, n, &crl->sig_oid1, crl->sig_pk, sig_params );
|
||||
ret = x509_sig_alg_gets( p, n, &crl->sig_oid1, crl->sig_pk, crl->sig_md,
|
||||
sig_opts );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
ret = snprintf( p, n, "\n" );
|
||||
|
@ -1261,9 +1261,9 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
|
||||
char *p;
|
||||
char key_size_str[BEFORE_COLON];
|
||||
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
|
||||
const x509_buf *sig_params = &crt->sig_params;
|
||||
const void *sig_opts = crt->sig_opts;
|
||||
#else
|
||||
const x509_buf *sig_params = NULL;
|
||||
const void *sig_opts = NULL;
|
||||
#endif
|
||||
|
||||
p = buf;
|
||||
@ -1306,7 +1306,8 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
|
||||
ret = snprintf( p, n, "\n%ssigned using : ", prefix );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
ret = x509_sig_alg_gets( p, n, &crt->sig_oid1, crt->sig_pk, sig_params );
|
||||
ret = x509_sig_alg_gets( p, n, &crt->sig_oid1, crt->sig_pk,
|
||||
crt->sig_md, sig_opts );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
/* Key size */
|
||||
|
@ -369,9 +369,9 @@ int x509_csr_info( char *buf, size_t size, const char *prefix,
|
||||
char *p;
|
||||
char key_size_str[BEFORE_COLON];
|
||||
#if defined(POLARSSL_RSASSA_PSS_CERTIFICATES)
|
||||
const x509_buf *sig_params = &csr->sig_params;
|
||||
const void *sig_opts = csr->sig_opts;
|
||||
#else
|
||||
const x509_buf *sig_params = NULL;
|
||||
const void *sig_opts = NULL;
|
||||
#endif
|
||||
|
||||
p = buf;
|
||||
@ -389,7 +389,8 @@ int x509_csr_info( char *buf, size_t size, const char *prefix,
|
||||
ret = snprintf( p, n, "\n%ssigned using : ", prefix );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
ret = x509_sig_alg_gets( p, n, &csr->sig_oid, csr->sig_pk, sig_params );
|
||||
ret = x509_sig_alg_gets( p, n, &csr->sig_oid, csr->sig_pk, csr->sig_md,
|
||||
sig_opts );
|
||||
SAFE_SNPRINTF();
|
||||
|
||||
if( ( ret = x509_key_size_helper( key_size_str, BEFORE_COLON,
|
||||
|
Loading…
Reference in New Issue
Block a user