Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ SpcIndirectDataContent *pkcs7_get_indirect_data_content(PKCS7 *p7)

/*
* Decode SpcIndirectDataContent from an ASN1_TYPE object.
* The ASN1_TYPE is expected to contain a V_ASN1_SEQUENCE value.
*
* RFC 5652 section 5.2.1 defines PKCS#7 content as EXPLICIT ANY,
* while CMS defines eContent as EXPLICIT OCTET STRING. Therefore,
* Authenticode content may appear directly as a SEQUENCE or be
* carried inside a CMS OCTET STRING.
*
* [in] content: ASN1_TYPE containing DER-encoded SpcIndirectDataContent
* [returns] newly allocated SpcIndirectDataContent, or NULL on error
Expand All @@ -413,10 +417,16 @@ SpcIndirectDataContent *asn1_type_get_indirect_data_content(ASN1_TYPE *content)
const unsigned char *data;
int len;

if (!content || content->type != V_ASN1_SEQUENCE)
if (!content)
return NULL;

if (content->type == V_ASN1_SEQUENCE)
value = content->value.sequence;
else if (content->type == V_ASN1_OCTET_STRING)
value = content->value.octet_string;
else
return NULL;

value = content->value.sequence;
if (!value)
return NULL;

Expand Down
Loading