Use sig_opts in x509_sig_alg_gets()
diff --git a/library/x509.c b/library/x509.c
index ffa7980..57dfd64 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -836,10 +836,11 @@
}
/*
- * 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 @@
#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 );
diff --git a/library/x509_crl.c b/library/x509_crl.c
index 2d6b50d..f532c0c 100644
--- a/library/x509_crl.c
+++ b/library/x509_crl.c
@@ -634,9 +634,9 @@
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 @@
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" );
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 7e5de1d..617b733 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1261,9 +1261,9 @@
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 @@
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 */
diff --git a/library/x509_csr.c b/library/x509_csr.c
index 4dd623a..b71bc0b 100644
--- a/library/x509_csr.c
+++ b/library/x509_csr.c
@@ -369,9 +369,9 @@
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 @@
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,