Skip to content

Commit

Permalink
Parse non-v1 SCTs less awkwardly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Stradling committed Feb 25, 2014
1 parent 63aff30 commit 19f65dd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions crypto/x509v3/v3_scts.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ static int i2r_scts(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct,

BIO_printf(out, "%*sSigned Certificate Timestamp:", indent,
"");
BIO_printf(out, "\n%*sVersion : ", indent + 4, "");

if (*data == 0) /* SCT v1 */
{
BIO_printf(out, "v1(0)");

/* Fixed-length header:
* struct {
* (1 byte) Version sct_version;
Expand All @@ -155,9 +158,6 @@ static int i2r_scts(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct,
return 0;
sctlen -= 43;

BIO_printf(out, "\n%*sVersion : v1(0)", indent + 4,
"");

BIO_printf(out, "\n%*sLog ID : ", indent + 4, "");
BIO_hex_string(out, indent + 16, 16, data + 1, 32);

Expand Down Expand Up @@ -195,9 +195,16 @@ static int i2r_scts(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct,
return 0;
BIO_printf(out, "\n%*s ", indent + 4, "");
BIO_hex_string(out, indent + 16, 16, data, fieldlen);
if (listlen > 0) BIO_printf(out, "\n");
data += fieldlen;
}
else /* Unknown version */
{
BIO_printf(out, "unknown\n%*s", indent + 16, "");
BIO_hex_string(out, indent + 16, 16, data, sctlen);
data += sctlen;
}

if (listlen > 0) BIO_printf(out, "\n");
}

return 1;
Expand Down

0 comments on commit 19f65dd

Please sign in to comment.