asn1: Return any parameters of algorithmIdentifier structures

Previously, only parameters of type OID, SEQUENCE and OCTET STRING were
returned (so e.g. random integers could be put in parameters and we
wouldn't know about it).

Log output is basically the same as with asn1_parser_t before, except
that parameters are always dumped (if any), that wasn't the case before
because ASN1_RAW (instead of ASN1_OBJ) was used.
This commit is contained in:
Tobias Brunner
2021-10-14 18:59:07 +02:00
parent dceed8e099
commit f061dedcb7
2 changed files with 20 additions and 42 deletions
+4 -3
View File
@@ -64,9 +64,10 @@ START_TEST(test_asn1_parse_algorithmIdentifier)
testdata_t test[] = {
{ OID_ECDSA_WITH_SHA1, TRUE, chunk_empty },
{ OID_SHA1_WITH_RSA, TRUE, chunk_from_chars(0x05, 0x00) },
{ OID_SHA1_WITH_RSA, FALSE, chunk_from_chars(0x05, 0x00) },
{ OID_3DES_EDE_CBC, FALSE, chunk_from_chars(0x04, 0x01, 0xaa) },
{ OID_PBKDF2, FALSE, chunk_from_chars(0x30, 0x01, 0xaa) }
{ OID_PBKDF2, FALSE, chunk_from_chars(0x30, 0x01, 0xaa) },
{ OID_ECGDSA_PUBKEY, FALSE, chunk_from_chars(0x02, 0x01, 0x01, 0x30, 0x01, 0xaa) },
};
chunk_t algid, parameters;
@@ -88,7 +89,7 @@ START_TEST(test_asn1_parse_algorithmIdentifier)
{
ck_assert(parameters.len == 0 && parameters.ptr == NULL);
}
else
else
{
ck_assert(chunk_equals(parameters, test[i].parameters));
}