check reviewer --reviewer=emilia
Pass entire CTLOG_STORE to SCT_print, rather than just the SCT's CTLOG SCT_print now looks up the correct CT log for you. Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
		@@ -96,8 +96,16 @@ static void timestamp_print(uint64_t timestamp, BIO *out)
 | 
				
			|||||||
    ASN1_GENERALIZEDTIME_free(gen);
 | 
					    ASN1_GENERALIZEDTIME_free(gen);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG *log)
 | 
					void SCT_print(const SCT *sct, BIO *out, int indent,
 | 
				
			||||||
 | 
					               const CTLOG_STORE *log_store)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    const CTLOG *log = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (log_store != NULL) {
 | 
				
			||||||
 | 
					        log = CTLOG_STORE_get0_log_by_id(log_store, sct->log_id,
 | 
				
			||||||
 | 
					                                         sct->log_id_len);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    BIO_printf(out, "%*sSigned Certificate Timestamp:", indent, "");
 | 
					    BIO_printf(out, "%*sSigned Certificate Timestamp:", indent, "");
 | 
				
			||||||
    BIO_printf(out, "\n%*sVersion   : ", indent + 4, "");
 | 
					    BIO_printf(out, "\n%*sVersion   : ", indent + 4, "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -139,14 +147,8 @@ void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < sk_SCT_num(sct_list); ++i) {
 | 
					    for (i = 0; i < sk_SCT_num(sct_list); ++i) {
 | 
				
			||||||
        SCT *sct = sk_SCT_value(sct_list, i);
 | 
					        SCT *sct = sk_SCT_value(sct_list, i);
 | 
				
			||||||
        const CTLOG *log = NULL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (log_store != NULL) {
 | 
					        SCT_print(sct, out, indent, log_store);
 | 
				
			||||||
            log = CTLOG_STORE_get0_log_by_id(log_store, sct->log_id,
 | 
					 | 
				
			||||||
                                             sct->log_id_len);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        SCT_print(sct, out, indent, log);
 | 
					 | 
				
			||||||
        if (i < sk_SCT_num(sct_list) - 1)
 | 
					        if (i < sk_SCT_num(sct_list) - 1)
 | 
				
			||||||
            BIO_printf(out, "%s", separator);
 | 
					            BIO_printf(out, "%s", separator);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -302,11 +302,10 @@ __owur int SCT_set_source(SCT *sct, sct_source_t source);
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Pretty-prints an |sct| to |out|.
 | 
					 * Pretty-prints an |sct| to |out|.
 | 
				
			||||||
 * It will be indented by the number of spaces specified by |indent|.
 | 
					 * It will be indented by the number of spaces specified by |indent|.
 | 
				
			||||||
 * If |log| is not NULL:
 | 
					 * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
 | 
				
			||||||
 * - it should be the CT log that the SCT came from.
 | 
					 * from, so that the log name can be printed.
 | 
				
			||||||
 * - its name will be printed.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG *log);
 | 
					void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Pretty-prints an |sct_list| to |out|.
 | 
					 * Pretty-prints an |sct_list| to |out|.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user