asn1: Pretty-print enum values
This commit is contained in:
@@ -241,7 +241,7 @@ In recent times the following features have been added:
|
|||||||
"tbsCertificate": {
|
"tbsCertificate": {
|
||||||
"_type": "TBSCertificate",
|
"_type": "TBSCertificate",
|
||||||
"_save": "30820376A00302010202146A0597BA71D7E6D3AC0EDC9EDC95A15B998DE40A300D06092A864886F70D01010B05003055310B3009060355040613024348311E301C060355040A131553544D6963726F656C656374726F6E696373204E56312630240603550403131D53544D2054504D20454B20496E7465726D656469617465204341203035301E170D3138313231343030303030305A170D3238313231343030303030305A300030820122300D06092A864886F70D01010105000382010F003082010A0282010100CC14EB27A78CEB0EA486FA2DF7835F5FA8E905B097012B5BDE50380C355B1A2A721BBC3D08DD21796CDB239FA95310651B1B56FD2CFE53C87352EBD996E33256160404CE9302A08066801E786A2F86E181F949966F492A85B58EAA4A6A8CB3697551BB236E87CC7BF8EC1347871C91E15437E8F266BF1EA5EB271FDCF374D8B47DF8BCE89E1FAD61C2A088CB4036B359CB72A294973FEDCCF0C340AFFD14B64F041165581ACA34147C1C75617047058F7ED7D603E032508094FA73E8B9153DA3BF255D2CBBC5DF301BA8F74D198BEBCE86040FC1D2927C7657414490D802F482F3EBF2DE35EE149A1A6DE8D16891FBFBA02A18AFE59F9D6F149744E5F0D559B10203010001A38201A9308201A5301F0603551D230418301680141ADB994AB58BE57A0CC9B900E7851E1A43C0866030420603551D20043B303930370604551D2000302F302D06082B060105050702011621687474703A2F2F7777772E73742E636F6D2F54504D2F7265706F7369746F72792F30590603551D110101FF044F304DA44B304931163014060567810502010C0B69643A353335343444323031173015060567810502020C0C53543333485450484148433031163014060567810502030C0B69643A303034393030303830670603551D090460305E301706056781050210310E300C0C03322E300201000202008A304306056781050212313A30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100300E0603551D0F0101FF040403020520300C0603551D130101FF0402300030100603551D250409300706056781050801304A06082B06010505070101043E303C303A06082B06010505073002862E687474703A2F2F7365637572652E676C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274",
|
"_save": "30820376A00302010202146A0597BA71D7E6D3AC0EDC9EDC95A15B998DE40A300D06092A864886F70D01010B05003055310B3009060355040613024348311E301C060355040A131553544D6963726F656C656374726F6E696373204E56312630240603550403131D53544D2054504D20454B20496E7465726D656469617465204341203035301E170D3138313231343030303030305A170D3238313231343030303030305A300030820122300D06092A864886F70D01010105000382010F003082010A0282010100CC14EB27A78CEB0EA486FA2DF7835F5FA8E905B097012B5BDE50380C355B1A2A721BBC3D08DD21796CDB239FA95310651B1B56FD2CFE53C87352EBD996E33256160404CE9302A08066801E786A2F86E181F949966F492A85B58EAA4A6A8CB3697551BB236E87CC7BF8EC1347871C91E15437E8F266BF1EA5EB271FDCF374D8B47DF8BCE89E1FAD61C2A088CB4036B359CB72A294973FEDCCF0C340AFFD14B64F041165581ACA34147C1C75617047058F7ED7D603E032508094FA73E8B9153DA3BF255D2CBBC5DF301BA8F74D198BEBCE86040FC1D2927C7657414490D802F482F3EBF2DE35EE149A1A6DE8D16891FBFBA02A18AFE59F9D6F149744E5F0D559B10203010001A38201A9308201A5301F0603551D230418301680141ADB994AB58BE57A0CC9B900E7851E1A43C0866030420603551D20043B303930370604551D2000302F302D06082B060105050702011621687474703A2F2F7777772E73742E636F6D2F54504D2F7265706F7369746F72792F30590603551D110101FF044F304DA44B304931163014060567810502010C0B69643A353335343444323031173015060567810502020C0C53543333485450484148433031163014060567810502030C0B69643A303034393030303830670603551D090460305E301706056781050210310E300C0C03322E300201000202008A304306056781050212313A30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100300E0603551D0F0101FF040403020520300C0603551D130101FF0402300030100603551D250409300706056781050801304A06082B06010505070101043E303C303A06082B06010505073002862E687474703A2F2F7365637572652E676C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274",
|
||||||
"version": "2",
|
"version": "rfc3280_version_3",
|
||||||
"serialNumber": "6A0597BA71D7E6D3AC0EDC9EDC95A15B998DE40A",
|
"serialNumber": "6A0597BA71D7E6D3AC0EDC9EDC95A15B998DE40A",
|
||||||
"signature": {
|
"signature": {
|
||||||
"_type": "AlgorithmIdentifier",
|
"_type": "AlgorithmIdentifier",
|
||||||
@@ -381,7 +381,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": false,
|
"critical": false,
|
||||||
"extnValue": "301680141ADB994AB58BE57A0CC9B900E7851E1A43C08660",
|
"extnValue": "301680141ADB994AB58BE57A0CC9B900E7851E1A43C08660",
|
||||||
"_extnValue_choice": "ext-AuthorityKeyIdentifier",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": {
|
"_extnValue": {
|
||||||
"_type": "AuthorityKeyIdentifier",
|
"_type": "AuthorityKeyIdentifier",
|
||||||
"keyIdentifier": "1ADB994AB58BE57A0CC9B900E7851E1A43C08660",
|
"keyIdentifier": "1ADB994AB58BE57A0CC9B900E7851E1A43C08660",
|
||||||
@@ -404,7 +404,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": false,
|
"critical": false,
|
||||||
"extnValue": "303930370604551D2000302F302D06082B060105050702011621687474703A2F2F7777772E73742E636F6D2F54504D2F7265706F7369746F72792F",
|
"extnValue": "303930370604551D2000302F302D06082B060105050702011621687474703A2F2F7777772E73742E636F6D2F54504D2F7265706F7369746F72792F",
|
||||||
"_extnValue_choice": "ext-CertificatePolicies",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
{
|
{
|
||||||
"_type": "PolicyInformation",
|
"_type": "PolicyInformation",
|
||||||
@@ -460,7 +460,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": true,
|
"critical": true,
|
||||||
"extnValue": "304DA44B304931163014060567810502010C0B69643A353335343444323031173015060567810502020C0C53543333485450484148433031163014060567810502030C0B69643A3030343930303038",
|
"extnValue": "304DA44B304931163014060567810502010C0B69643A353335343444323031173015060567810502020C0C53543333485450484148433031163014060567810502030C0B69643A3030343930303038",
|
||||||
"_extnValue_choice": "ext-SubjectAltName",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
{
|
{
|
||||||
"_choice": "directoryName",
|
"_choice": "directoryName",
|
||||||
@@ -550,7 +550,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": false,
|
"critical": false,
|
||||||
"extnValue": "305E301706056781050210310E300C0C03322E300201000202008A304306056781050212313A30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100",
|
"extnValue": "305E301706056781050210310E300C0C03322E300201000202008A304306056781050212313A30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100",
|
||||||
"_extnValue_choice": "ext-SubjectDirectoryAttributes",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
{
|
{
|
||||||
"_type": "AttributeSet",
|
"_type": "AttributeSet",
|
||||||
@@ -569,7 +569,7 @@ In recent times the following features have been added:
|
|||||||
"values": [
|
"values": [
|
||||||
"300C0C03322E300201000202008A"
|
"300C0C03322E300201000202008A"
|
||||||
],
|
],
|
||||||
"_values_choice": "at-TPMSpecification",
|
"_values_choice": "",
|
||||||
"_values": [
|
"_values": [
|
||||||
{
|
{
|
||||||
"_type": "TPMSpecification",
|
"_type": "TPMSpecification",
|
||||||
@@ -596,20 +596,20 @@ In recent times the following features have been added:
|
|||||||
"values": [
|
"values": [
|
||||||
"30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100"
|
"30380201000101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D320A0102010100"
|
||||||
],
|
],
|
||||||
"_values_choice": "at-TPMSecurityAssertions",
|
"_values_choice": "",
|
||||||
"_values": [
|
"_values": [
|
||||||
{
|
{
|
||||||
"_type": "TPMSecurityAssertions",
|
"_type": "TPMSecurityAssertions",
|
||||||
"version": "0",
|
"version": 0,
|
||||||
"fieldUpgradable": true,
|
"fieldUpgradable": true,
|
||||||
"ekGenerationType": "655617",
|
"ekGenerationType": "ekgt_injected",
|
||||||
"ekGenerationLocation": "655616",
|
"ekGenerationLocation": "tpmManufacturer",
|
||||||
"ekCertificateGenerationLocation": "655616",
|
"ekCertificateGenerationLocation": "tpmManufacturer",
|
||||||
"ccInfo": {
|
"ccInfo": {
|
||||||
"_type": "CommonCriteriaMeasures",
|
"_type": "CommonCriteriaMeasures",
|
||||||
"version": "3.1",
|
"version": "3.1",
|
||||||
"assurancelevel": "4",
|
"assurancelevel": "ealevel4",
|
||||||
"evaluationStatus": "2",
|
"evaluationStatus": "evaluationCompleted",
|
||||||
"plus": true,
|
"plus": true,
|
||||||
"strengthOfFunction": null,
|
"strengthOfFunction": null,
|
||||||
"profileOid": null,
|
"profileOid": null,
|
||||||
@@ -620,7 +620,7 @@ In recent times the following features have been added:
|
|||||||
"fipsLevel": {
|
"fipsLevel": {
|
||||||
"_type": "FIPSLevel",
|
"_type": "FIPSLevel",
|
||||||
"version": "140-2",
|
"version": "140-2",
|
||||||
"level": "2",
|
"level": "sllevel2",
|
||||||
"plus": false
|
"plus": false
|
||||||
},
|
},
|
||||||
"iso9000Certified": false,
|
"iso9000Certified": false,
|
||||||
@@ -645,7 +645,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": true,
|
"critical": true,
|
||||||
"extnValue": "03020520",
|
"extnValue": "03020520",
|
||||||
"_extnValue_choice": "ext-KeyUsage",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
"keyEncipherment"
|
"keyEncipherment"
|
||||||
]
|
]
|
||||||
@@ -665,7 +665,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": true,
|
"critical": true,
|
||||||
"extnValue": "3000",
|
"extnValue": "3000",
|
||||||
"_extnValue_choice": "ext-BasicConstraints",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": {
|
"_extnValue": {
|
||||||
"_type": "BasicConstraints",
|
"_type": "BasicConstraints",
|
||||||
"cA": false,
|
"cA": false,
|
||||||
@@ -687,7 +687,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": false,
|
"critical": false,
|
||||||
"extnValue": "300706056781050801",
|
"extnValue": "300706056781050801",
|
||||||
"_extnValue_choice": "ext-ExtKeyUsage",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
{
|
{
|
||||||
"_type": "OBJECT IDENTIFIER",
|
"_type": "OBJECT IDENTIFIER",
|
||||||
@@ -723,7 +723,7 @@ In recent times the following features have been added:
|
|||||||
},
|
},
|
||||||
"critical": false,
|
"critical": false,
|
||||||
"extnValue": "303C303A06082B06010505073002862E687474703A2F2F7365637572652E676C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274",
|
"extnValue": "303C303A06082B06010505073002862E687474703A2F2F7365637572652E676C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274",
|
||||||
"_extnValue_choice": "ext-AuthorityInfoAccess",
|
"_extnValue_choice": "",
|
||||||
"_extnValue": [
|
"_extnValue": [
|
||||||
{
|
{
|
||||||
"_type": "AccessDescription",
|
"_type": "AccessDescription",
|
||||||
|
@@ -840,6 +840,17 @@ TypeAssignment : Identifier EEQUAL Type
|
|||||||
s->stype = Stype;
|
s->stype = Stype;
|
||||||
s->type = $3;
|
s->type = $3;
|
||||||
fix_labels(s);
|
fix_labels(s);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hack: make sure that non-anonymous enumeration types get
|
||||||
|
* a symbol tacked on so we can generate a template for
|
||||||
|
* their members for value printing.
|
||||||
|
*/
|
||||||
|
if (s->type->type == TTag && $3->symbol == NULL &&
|
||||||
|
$3->subtype != NULL && $3->subtype->type == TInteger &&
|
||||||
|
$3->subtype->symbol == NULL) {
|
||||||
|
$3->subtype->symbol = s;
|
||||||
|
}
|
||||||
if (original_order)
|
if (original_order)
|
||||||
generate_type(s);
|
generate_type(s);
|
||||||
else
|
else
|
||||||
|
@@ -2212,132 +2212,133 @@ test_ios(void)
|
|||||||
"00030100603551D250409300706056781050801304A06082B060105050701010"
|
"00030100603551D250409300706056781050801304A06082B060105050701010"
|
||||||
"43E303C303A06082B06010505073002862E687474703A2F2F7365637572652E6"
|
"43E303C303A06082B06010505073002862E687474703A2F2F7365637572652E6"
|
||||||
"76C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274\""
|
"76C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274\""
|
||||||
",\"version\":\"2\",\"serialNumber\":\"6A0597BA71D7E6D3AC0EDC9EDC95A15B9"
|
",\"version\":\"rfc3280_version_3\",\"serialNumber\":\"6A0597BA71D7E6D3A"
|
||||||
"98DE40A\",\"signature\":{\"_type\":\"AlgorithmIdentifier\",\"algorithm\":"
|
"C0EDC9EDC95A15B998DE40A\",\"signature\":{\"_type\":\"AlgorithmIdentifi"
|
||||||
"{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.2.840.113549.1.1.11\",\"comp"
|
"er\",\"algorithm\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.2.840.1135"
|
||||||
"onents\":[1,2,840,113549,1,1,11],\"name\":\"id-pkcs1-sha256WithRSAEn"
|
"49.1.1.11\",\"components\":[1,2,840,113549,1,1,11],\"name\":\"id-pkcs1"
|
||||||
"cryption\"},\"parameters\":\"0500\"},\"issuer\":{\"_choice\":\"rdnSequence"
|
"-sha256WithRSAEncryption\"},\"parameters\":\"0500\"},\"issuer\":{\"_choi"
|
||||||
"\",\"value\":[[{\"_type\":\"AttributeTypeAndValue\",\"type\":{\"_type\":\"OB"
|
"ce\":\"rdnSequence\",\"value\":[[{\"_type\":\"AttributeTypeAndValue\",\"ty"
|
||||||
"JECT IDENTIFIER\",\"oid\":\"2.5.4.6\",\"components\":[2,5,4,6],\"name\":\""
|
"pe\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.4.6\",\"components\":[2"
|
||||||
"id-at-countryName\"},\"value\":{\"_choice\":\"printableString\",\"value\""
|
",5,4,6],\"name\":\"id-at-countryName\"},\"value\":{\"_choice\":\"printabl"
|
||||||
":\"CH\"}}],[{\"_type\":\"AttributeTypeAndValue\",\"type\":{\"_type\":\"OBJE"
|
"eString\",\"value\":\"CH\"}}],[{\"_type\":\"AttributeTypeAndValue\",\"type"
|
||||||
"CT IDENTIFIER\",\"oid\":\"2.5.4.10\",\"components\":[2,5,4,10],\"name\":\""
|
"\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.4.10\",\"components\":[2,"
|
||||||
"id-at-organizationName\"},\"value\":{\"_choice\":\"printableString\",\"v"
|
"5,4,10],\"name\":\"id-at-organizationName\"},\"value\":{\"_choice\":\"pri"
|
||||||
"alue\":\"STMicroelectronics NV\"}}],[{\"_type\":\"AttributeTypeAndValu"
|
"ntableString\",\"value\":\"STMicroelectronics NV\"}}],[{\"_type\":\"Attr"
|
||||||
"e\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.4.3\",\"componen"
|
"ibuteTypeAndValue\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2."
|
||||||
"ts\":[2,5,4,3],\"name\":\"id-at-commonName\"},\"value\":{\"_choice\":\"pri"
|
"5.4.3\",\"components\":[2,5,4,3],\"name\":\"id-at-commonName\"},\"value\""
|
||||||
"ntableString\",\"value\":\"STM TPM EK Intermediate CA 05\"}}]]},\"vali"
|
":{\"_choice\":\"printableString\",\"value\":\"STM TPM EK Intermediate C"
|
||||||
"dity\":{\"_type\":\"Validity\",\"notBefore\":{\"_choice\":\"utcTime\",\"valu"
|
"A 05\"}}]]},\"validity\":{\"_type\":\"Validity\",\"notBefore\":{\"_choice\""
|
||||||
"e\":\"2018-12-14T00:00:00Z\"},\"notAfter\":{\"_choice\":\"utcTime\",\"valu"
|
":\"utcTime\",\"value\":\"2018-12-14T00:00:00Z\"},\"notAfter\":{\"_choice\""
|
||||||
"e\":\"2028-12-14T00:00:00Z\"}},\"subject\":{\"_choice\":\"rdnSequence\",\""
|
":\"utcTime\",\"value\":\"2028-12-14T00:00:00Z\"}},\"subject\":{\"_choice\""
|
||||||
"value\":[]},\"subjectPublicKeyInfo\":{\"_type\":\"SubjectPublicKeyInfo"
|
":\"rdnSequence\",\"value\":[]},\"subjectPublicKeyInfo\":{\"_type\":\"Subj"
|
||||||
"\",\"algorithm\":{\"_type\":\"AlgorithmIdentifier\",\"algorithm\":{\"_type"
|
"ectPublicKeyInfo\",\"algorithm\":{\"_type\":\"AlgorithmIdentifier\",\"al"
|
||||||
"\":\"OBJECT IDENTIFIER\",\"oid\":\"1.2.840.113549.1.1.1\",\"components\":"
|
"gorithm\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.2.840.113549.1.1."
|
||||||
"[1,2,840,113549,1,1,1],\"name\":\"id-pkcs1-rsaEncryption\"},\"paramet"
|
"1\",\"components\":[1,2,840,113549,1,1,1],\"name\":\"id-pkcs1-rsaEncry"
|
||||||
"ers\":\"0500\"},\"subjectPublicKey\":\"2160:3082010A0282010100CC14EB27"
|
"ption\"},\"parameters\":\"0500\"},\"subjectPublicKey\":\"2160:3082010A02"
|
||||||
"A78CEB0EA486FA2DF7835F5FA8E905B097012B5BDE50380C355B1A2A721BBC3D"
|
"82010100CC14EB27A78CEB0EA486FA2DF7835F5FA8E905B097012B5BDE50380C"
|
||||||
"08DD21796CDB239FA95310651B1B56FD2CFE53C87352EBD996E33256160404CE"
|
"355B1A2A721BBC3D08DD21796CDB239FA95310651B1B56FD2CFE53C87352EBD9"
|
||||||
"9302A08066801E786A2F86E181F949966F492A85B58EAA4A6A8CB3697551BB23"
|
"96E33256160404CE9302A08066801E786A2F86E181F949966F492A85B58EAA4A"
|
||||||
"6E87CC7BF8EC1347871C91E15437E8F266BF1EA5EB271FDCF374D8B47DF8BCE8"
|
"6A8CB3697551BB236E87CC7BF8EC1347871C91E15437E8F266BF1EA5EB271FDC"
|
||||||
"9E1FAD61C2A088CB4036B359CB72A294973FEDCCF0C340AFFD14B64F04116558"
|
"F374D8B47DF8BCE89E1FAD61C2A088CB4036B359CB72A294973FEDCCF0C340AF"
|
||||||
"1ACA34147C1C75617047058F7ED7D603E032508094FA73E8B9153DA3BF255D2C"
|
"FD14B64F041165581ACA34147C1C75617047058F7ED7D603E032508094FA73E8"
|
||||||
"BBC5DF301BA8F74D198BEBCE86040FC1D2927C7657414490D802F482F3EBF2DE"
|
"B9153DA3BF255D2CBBC5DF301BA8F74D198BEBCE86040FC1D2927C7657414490"
|
||||||
"35EE149A1A6DE8D16891FBFBA02A18AFE59F9D6F149744E5F0D559B102030100"
|
"D802F482F3EBF2DE35EE149A1A6DE8D16891FBFBA02A18AFE59F9D6F149744E5"
|
||||||
"01\"},\"issuerUniqueID\":null,\"subjectUniqueID\":null,\"extensions\":["
|
"F0D559B10203010001\"},\"issuerUniqueID\":null,\"subjectUniqueID\":nul"
|
||||||
|
"l,\"extensions\":[{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT I"
|
||||||
|
"DENTIFIER\",\"oid\":\"2.5.29.35\",\"components\":[2,5,29,35],\"name\":\"id"
|
||||||
|
"-x509-ce-authorityKeyIdentifier\"},\"critical\":false,\"extnValue\":\""
|
||||||
|
"301680141ADB994AB58BE57A0CC9B900E7851E1A43C08660\",\"_extnValue_ch"
|
||||||
|
"oice\":\"\",\"_extnValue\":{\"_type\":\"AuthorityKeyIdentifier\",\"keyIden"
|
||||||
|
"tifier\":\"1ADB994AB58BE57A0CC9B900E7851E1A43C08660\",\"authorityCer"
|
||||||
|
"tIssuer\":null,\"authorityCertSerialNumber\":null}},{\"_type\":\"Exten"
|
||||||
|
"sion\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.32\",\"c"
|
||||||
|
"omponents\":[2,5,29,32],\"name\":\"id-x509-ce-certificatePolicies\"},"
|
||||||
|
"\"critical\":false,\"extnValue\":\"303930370604551D2000302F302D06082B"
|
||||||
|
"060105050702011621687474703A2F2F7777772E73742E636F6D2F54504D2F72"
|
||||||
|
"65706F7369746F72792F\",\"_extnValue_choice\":\"\",\"_extnValue\":[{\"_ty"
|
||||||
|
"pe\":\"PolicyInformation\",\"policyIdentifier\":{\"_type\":\"OBJECT IDEN"
|
||||||
|
"TIFIER\",\"oid\":\"2.5.29.32.0\",\"components\":[2,5,29,32,0],\"name\":\"i"
|
||||||
|
"d-x509-ce-certificatePolicies-anyPolicy\"},\"policyQualifiers\":[{\""
|
||||||
|
"_type\":\"PolicyQualifierInfo\",\"policyQualifierId\":{\"_type\":\"OBJEC"
|
||||||
|
"T IDENTIFIER\",\"oid\":\"1.3.6.1.5.5.7.2.1\",\"components\":[1,3,6,1,5,"
|
||||||
|
"5,7,2,1],\"name\":\"id-pkix-qt-cps\"},\"qualifier\":\"1621687474703A2F2"
|
||||||
|
"F7777772E73742E636F6D2F54504D2F7265706F7369746F72792F\"}]}]},{\"_t"
|
||||||
|
"ype\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2."
|
||||||
|
"5.29.17\",\"components\":[2,5,29,17],\"name\":\"id-x509-ce-subjectAltN"
|
||||||
|
"ame\"},\"critical\":true,\"extnValue\":\"304DA44B304931163014060567810"
|
||||||
|
"502010C0B69643A353335343444323031173015060567810502020C0C5354333"
|
||||||
|
"3485450484148433031163014060567810502030C0B69643A303034393030303"
|
||||||
|
"8\",\"_extnValue_choice\":\"\",\"_extnValue\":[{\"_choice\":\"directoryNam"
|
||||||
|
"e\",\"value\":{\"_choice\":\"rdnSequence\",\"value\":[[{\"_type\":\"Attribut"
|
||||||
|
"eTypeAndValue\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23.1"
|
||||||
|
"33.2.1\",\"components\":[2,23,133,2,1],\"name\":\"tcg-at-tpmManufactur"
|
||||||
|
"er\"},\"value\":{\"_choice\":\"utf8String\",\"value\":\"id:53544D20\"}}],[{"
|
||||||
|
"\"_type\":\"AttributeTypeAndValue\",\"type\":{\"_type\":\"OBJECT IDENTIFI"
|
||||||
|
"ER\",\"oid\":\"2.23.133.2.2\",\"components\":[2,23,133,2,2],\"name\":\"tcg"
|
||||||
|
"-at-tpmModel\"},\"value\":{\"_choice\":\"utf8String\",\"value\":\"ST33HTPH"
|
||||||
|
"AHC0\"}}],[{\"_type\":\"AttributeTypeAndValue\",\"type\":{\"_type\":\"OBJE"
|
||||||
|
"CT IDENTIFIER\",\"oid\":\"2.23.133.2.3\",\"components\":[2,23,133,2,3],"
|
||||||
|
"\"name\":\"tcg-at-tpmVersion\"},\"value\":{\"_choice\":\"utf8String\",\"val"
|
||||||
|
"ue\":\"id:00490008\"}}]]}}]},{\"_type\":\"Extension\",\"extnID\":{\"_type\""
|
||||||
|
":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.9\",\"components\":[2,5,29,9],\"n"
|
||||||
|
"ame\":\"id-x509-ce-subjectDirectoryAttributes\"},\"critical\":false,\""
|
||||||
|
"extnValue\":\"305E301706056781050210310E300C0C03322E30020100020200"
|
||||||
|
"8A304306056781050212313A30380201000101FFA0030A0101A1030A0100A203"
|
||||||
|
"0A0100A310300E1603332E310A01040A01020101FFA40F300D16053134302D32"
|
||||||
|
"0A0102010100\",\"_extnValue_choice\":\"\",\"_extnValue\":[{\"_type\":\"Att"
|
||||||
|
"ributeSet\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23.133.2"
|
||||||
|
".16\",\"components\":[2,23,133,2,16],\"name\":\"tcg-at-tpmSpecificatio"
|
||||||
|
"n\"},\"values\":[\"300C0C03322E300201000202008A\"],\"_values_choice\":\""
|
||||||
|
"\",\"_values\":[{\"_type\":\"TPMSpecification\",\"family\":\"2.0\",\"level\":"
|
||||||
|
"0,\"revision\":138}]},{\"_type\":\"AttributeSet\",\"type\":{\"_type\":\"OBJ"
|
||||||
|
"ECT IDENTIFIER\",\"oid\":\"2.23.133.2.18\",\"components\":[2,23,133,2,1"
|
||||||
|
"8],\"name\":\"tcg-at-tpmSecurityAssertions\"},\"values\":[\"30380201000"
|
||||||
|
"101FFA0030A0101A1030A0100A2030A0100A310300E1603332E310A01040A010"
|
||||||
|
"20101FFA40F300D16053134302D320A0102010100\"],\"_values_choice\":\"\","
|
||||||
|
"\"_values\":[{\"_type\":\"TPMSecurityAssertions\",\"version\":0,\"fieldUp"
|
||||||
|
"gradable\":true,\"ekGenerationType\":\"ekgt_injected\",\"ekGenerationL"
|
||||||
|
"ocation\":\"tpmManufacturer\",\"ekCertificateGenerationLocation\":\"tp"
|
||||||
|
"mManufacturer\",\"ccInfo\":{\"_type\":\"CommonCriteriaMeasures\",\"versi"
|
||||||
|
"on\":\"3.1\",\"assurancelevel\":\"ealevel4\",\"evaluationStatus\":\"evalua"
|
||||||
|
"tionCompleted\",\"plus\":true,\"strengthOfFunction\":null,\"profileOid"
|
||||||
|
"\":null,\"profileUri\":null,\"targetOid\":null,\"targetUri\":null},\"fip"
|
||||||
|
"sLevel\":{\"_type\":\"FIPSLevel\",\"version\":\"140-2\",\"level\":\"sllevel2"
|
||||||
|
"\",\"plus\":false},\"iso9000Certified\":false,\"iso9000Uri\":null}]}]},"
|
||||||
"{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\""
|
"{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\""
|
||||||
":\"2.5.29.35\",\"components\":[2,5,29,35],\"name\":\"id-x509-ce-authori"
|
":\"2.5.29.15\",\"components\":[2,5,29,15],\"name\":\"id-x509-ce-keyUsag"
|
||||||
"tyKeyIdentifier\"},\"critical\":false,\"extnValue\":\"301680141ADB994A"
|
"e\"},\"critical\":true,\"extnValue\":\"03020520\",\"_extnValue_choice\":\""
|
||||||
"B58BE57A0CC9B900E7851E1A43C08660\",\"_extnValue_choice\":\"\",\"_extnV"
|
"\",\"_extnValue\":[\"keyEncipherment\"]},{\"_type\":\"Extension\",\"extnID"
|
||||||
"alue\":{\"_type\":\"AuthorityKeyIdentifier\",\"keyIdentifier\":\"1ADB994"
|
"\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.19\",\"components\":[2"
|
||||||
"AB58BE57A0CC9B900E7851E1A43C08660\",\"authorityCertIssuer\":null,\"a"
|
",5,29,19],\"name\":\"id-x509-ce-basicConstraints\"},\"critical\":true,"
|
||||||
"uthorityCertSerialNumber\":null}},{\"_type\":\"Extension\",\"extnID\":{"
|
"\"extnValue\":\"3000\",\"_extnValue_choice\":\"\",\"_extnValue\":{\"_type\":"
|
||||||
"\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.32\",\"components\":[2,5,"
|
"\"BasicConstraints\",\"cA\":false,\"pathLenConstraint\":null}},{\"_type"
|
||||||
"29,32],\"name\":\"id-x509-ce-certificatePolicies\"},\"critical\":false"
|
"\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.2"
|
||||||
",\"extnValue\":\"303930370604551D2000302F302D06082B0601050507020116"
|
"9.37\",\"components\":[2,5,29,37],\"name\":\"id-x509-ce-extKeyUsage\"},"
|
||||||
"21687474703A2F2F7777772E73742E636F6D2F54504D2F7265706F7369746F72"
|
"\"critical\":false,\"extnValue\":\"300706056781050801\",\"_extnValue_ch"
|
||||||
"792F\",\"_extnValue_choice\":\"\",\"_extnValue\":[{\"_type\":\"PolicyInfor"
|
"oice\":\"\",\"_extnValue\":[{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23."
|
||||||
"mation\",\"policyIdentifier\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2"
|
"133.8.1\",\"components\":[2,23,133,8,1],\"name\":\"tcg-kp-EKCertificat"
|
||||||
".5.29.32.0\",\"components\":[2,5,29,32,0],\"name\":\"id-x509-ce-certif"
|
"e\"}]},{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\""
|
||||||
"icatePolicies-anyPolicy\"},\"policyQualifiers\":[{\"_type\":\"PolicyQu"
|
",\"oid\":\"1.3.6.1.5.5.7.1.1\",\"components\":[1,3,6,1,5,5,7,1,1],\"nam"
|
||||||
"alifierInfo\",\"policyQualifierId\":{\"_type\":\"OBJECT IDENTIFIER\",\"o"
|
"e\":\"id-pkix-pe-authorityInfoAccess\"},\"critical\":false,\"extnValue"
|
||||||
"id\":\"1.3.6.1.5.5.7.2.1\",\"components\":[1,3,6,1,5,5,7,2,1],\"name\":"
|
"\":\"303C303A06082B06010505073002862E687474703A2F2F7365637572652E6"
|
||||||
"\"id-pkix-qt-cps\"},\"qualifier\":\"1621687474703A2F2F7777772E73742E6"
|
"76C6F62616C7369676E2E636F6D2F73746D74706D656B696E7430352E637274\""
|
||||||
"36F6D2F54504D2F7265706F7369746F72792F\"}]}]},{\"_type\":\"Extension\""
|
",\"_extnValue_choice\":\"\",\"_extnValue\":[{\"_type\":\"AccessDescriptio"
|
||||||
",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.17\",\"compon"
|
"n\",\"accessMethod\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.3.6.1.5."
|
||||||
"ents\":[2,5,29,17],\"name\":\"id-x509-ce-subjectAltName\"},\"critical\""
|
"5.7.48.2\",\"components\":[1,3,6,1,5,5,7,48,2],\"name\":\"id-pkix-ad-c"
|
||||||
":true,\"extnValue\":\"304DA44B304931163014060567810502010C0B69643A3"
|
"aIssuers\"},\"accessLocation\":{\"_choice\":\"uniformResourceIdentifie"
|
||||||
"53335343444323031173015060567810502020C0C53543333485450484148433"
|
"r\",\"value\":\"http://secure.globalsign.com/stmtpmekint05.crt\"}}]}]"
|
||||||
"031163014060567810502030C0B69643A3030343930303038\",\"_extnValue_c"
|
"},\"signatureAlgorithm\":{\"_type\":\"AlgorithmIdentifier\",\"algorithm"
|
||||||
"hoice\":\"\",\"_extnValue\":[{\"_choice\":\"directoryName\",\"value\":{\"_ch"
|
"\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.2.840.113549.1.1.11\",\"co"
|
||||||
"oice\":\"rdnSequence\",\"value\":[[{\"_type\":\"AttributeTypeAndValue\",\""
|
"mponents\":[1,2,840,113549,1,1,11],\"name\":\"id-pkcs1-sha256WithRSA"
|
||||||
"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23.133.2.1\",\"compone"
|
"Encryption\"},\"parameters\":\"0500\"},\"signatureValue\":\"2048:3D4C381"
|
||||||
"nts\":[2,23,133,2,1],\"name\":\"tcg-at-tpmManufacturer\"},\"value\":{\"_"
|
"E5B4F1BCBE09C63D52F1F04570CAEA142FD9CD942043B11F8E3BDCF50007AE16"
|
||||||
"choice\":\"utf8String\",\"value\":\"id:53544D20\"}}],[{\"_type\":\"Attribu"
|
"CF8869013041E92CDD3280BA4B51FBBD40582ED750219E261A695095674855AA"
|
||||||
"teTypeAndValue\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23."
|
"CEB520ADAFF9E7E908480A39CDCF900462D9171960FFE55D3AC49E8C981341BB"
|
||||||
"133.2.2\",\"components\":[2,23,133,2,2],\"name\":\"tcg-at-tpmModel\"},\""
|
"D2EFBCC252A4C18A4F3B7C84CCE42CE70A208C84D2630A7ABFBE72D6271E75B9"
|
||||||
"value\":{\"_choice\":\"utf8String\",\"value\":\"ST33HTPHAHC0\"}}],[{\"_typ"
|
"FF1C971D20EB3DBD763F1E04D834EAA692D2E4001BBF4730A3E3FDA9711AE386"
|
||||||
"e\":\"AttributeTypeAndValue\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\",\""
|
"524D91C63BE0E516D00D5C6141FCCF6C539F3518E180049865BE16B69CAE1F8C"
|
||||||
"oid\":\"2.23.133.2.3\",\"components\":[2,23,133,2,3],\"name\":\"tcg-at-t"
|
"B7FDC474B38F7EE56CBE7D8A89D9BA99B65D5265AEF32AA62426B10E6D75BB86"
|
||||||
"pmVersion\"},\"value\":{\"_choice\":\"utf8String\",\"value\":\"id:00490008"
|
"77EC44F755BBC2806FD2B4E04BDF5D44259DBEAA42B6F563DF7AA7506\"}"
|
||||||
"\"}}]]}}]},{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDENTIF"
|
|
||||||
"IER\",\"oid\":\"2.5.29.9\",\"components\":[2,5,29,9],\"name\":\"id-x509-ce"
|
|
||||||
"-subjectDirectoryAttributes\"},\"critical\":false,\"extnValue\":\"305E"
|
|
||||||
"301706056781050210310E300C0C03322E300201000202008A30430605678105"
|
|
||||||
"0212313A30380201000101FFA0030A0101A1030A0100A2030A0100A310300E16"
|
|
||||||
"03332E310A01040A01020101FFA40F300D16053134302D320A0102010100\",\"_"
|
|
||||||
"extnValue_choice\":\"\",\"_extnValue\":[{\"_type\":\"AttributeSet\",\"type"
|
|
||||||
"\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23.133.2.16\",\"components"
|
|
||||||
"\":[2,23,133,2,16],\"name\":\"tcg-at-tpmSpecification\"},\"values\":[\"3"
|
|
||||||
"00C0C03322E300201000202008A\"],\"_values_choice\":\"\",\"_values\":[{\"_"
|
|
||||||
"type\":\"TPMSpecification\",\"family\":\"2.0\",\"level\":0,\"revision\":138"
|
|
||||||
"}]},{\"_type\":\"AttributeSet\",\"type\":{\"_type\":\"OBJECT IDENTIFIER\","
|
|
||||||
"\"oid\":\"2.23.133.2.18\",\"components\":[2,23,133,2,18],\"name\":\"tcg-a"
|
|
||||||
"t-tpmSecurityAssertions\"},\"values\":[\"30380201000101FFA0030A0101A"
|
|
||||||
"1030A0100A2030A0100A310300E1603332E310A01040A01020101FFA40F300D1"
|
|
||||||
"6053134302D320A0102010100\"],\"_values_choice\":\"\",\"_values\":[{\"_ty"
|
|
||||||
"pe\":\"TPMSecurityAssertions\",\"version\":\"0\",\"fieldUpgradable\":true"
|
|
||||||
",\"ekGenerationType\":\"1\",\"ekGenerationLocation\":\"0\",\"ekCertificat"
|
|
||||||
"eGenerationLocation\":\"0\",\"ccInfo\":{\"_type\":\"CommonCriteriaMeasur"
|
|
||||||
"es\",\"version\":\"3.1\",\"assurancelevel\":\"4\",\"evaluationStatus\":\"2\","
|
|
||||||
"\"plus\":true,\"strengthOfFunction\":null,\"profileOid\":null,\"profile"
|
|
||||||
"Uri\":null,\"targetOid\":null,\"targetUri\":null},\"fipsLevel\":{\"_type"
|
|
||||||
"\":\"FIPSLevel\",\"version\":\"140-2\",\"level\":\"2\",\"plus\":false},\"iso90"
|
|
||||||
"00Certified\":false,\"iso9000Uri\":null}]}]},{\"_type\":\"Extension\",\""
|
|
||||||
"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.15\",\"componen"
|
|
||||||
"ts\":[2,5,29,15],\"name\":\"id-x509-ce-keyUsage\"},\"critical\":true,\"e"
|
|
||||||
"xtnValue\":\"03020520\",\"_extnValue_choice\":\"\",\"_extnValue\":[\"keyEn"
|
|
||||||
"cipherment\"]},{\"_type\":\"Extension\",\"extnID\":{\"_type\":\"OBJECT IDE"
|
|
||||||
"NTIFIER\",\"oid\":\"2.5.29.19\",\"components\":[2,5,29,19],\"name\":\"id-x"
|
|
||||||
"509-ce-basicConstraints\"},\"critical\":true,\"extnValue\":\"3000\",\"_e"
|
|
||||||
"xtnValue_choice\":\"\",\"_extnValue\":{\"_type\":\"BasicConstraints\",\"cA"
|
|
||||||
"\":false,\"pathLenConstraint\":null}},{\"_type\":\"Extension\",\"extnID\""
|
|
||||||
":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.5.29.37\",\"components\":[2,"
|
|
||||||
"5,29,37],\"name\":\"id-x509-ce-extKeyUsage\"},\"critical\":false,\"extn"
|
|
||||||
"Value\":\"300706056781050801\",\"_extnValue_choice\":\"\",\"_extnValue\":"
|
|
||||||
"[{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"2.23.133.8.1\",\"components\":"
|
|
||||||
"[2,23,133,8,1],\"name\":\"tcg-kp-EKCertificate\"}]},{\"_type\":\"Extens"
|
|
||||||
"ion\",\"extnID\":{\"_type\":\"OBJECT IDENTIFIER\",\"oid\":\"1.3.6.1.5.5.7."
|
|
||||||
"1.1\",\"components\":[1,3,6,1,5,5,7,1,1],\"name\":\"id-pkix-pe-authori"
|
|
||||||
"tyInfoAccess\"},\"critical\":false,\"extnValue\":\"303C303A06082B06010"
|
|
||||||
"505073002862E687474703A2F2F7365637572652E676C6F62616C7369676E2E6"
|
|
||||||
"36F6D2F73746D74706D656B696E7430352E637274\",\"_extnValue_choice\":\""
|
|
||||||
"\",\"_extnValue\":[{\"_type\":\"AccessDescription\",\"accessMethod\":{\"_t"
|
|
||||||
"ype\":\"OBJECT IDENTIFIER\",\"oid\":\"1.3.6.1.5.5.7.48.2\",\"components\""
|
|
||||||
":[1,3,6,1,5,5,7,48,2],\"name\":\"id-pkix-ad-caIssuers\"},\"accessLoca"
|
|
||||||
"tion\":{\"_choice\":\"uniformResourceIdentifier\",\"value\":\"http://sec"
|
|
||||||
"ure.globalsign.com/stmtpmekint05.crt\"}}]}]},\"signatureAlgorithm\""
|
|
||||||
":{\"_type\":\"AlgorithmIdentifier\",\"algorithm\":{\"_type\":\"OBJECT IDE"
|
|
||||||
"NTIFIER\",\"oid\":\"1.2.840.113549.1.1.11\",\"components\":[1,2,840,113"
|
|
||||||
"549,1,1,11],\"name\":\"id-pkcs1-sha256WithRSAEncryption\"},\"paramete"
|
|
||||||
"rs\":\"0500\"},\"signatureValue\":\"2048:3D4C381E5B4F1BCBE09C63D52F1F0"
|
|
||||||
"4570CAEA142FD9CD942043B11F8E3BDCF50007AE16CF8869013041E92CDD3280"
|
|
||||||
"BA4B51FBBD40582ED750219E261A695095674855AACEB520ADAFF9E7E908480A"
|
|
||||||
"39CDCF900462D9171960FFE55D3AC49E8C981341BBD2EFBCC252A4C18A4F3B7C"
|
|
||||||
"84CCE42CE70A208C84D2630A7ABFBE72D6271E75B9FF1C971D20EB3DBD763F1E"
|
|
||||||
"04D834EAA692D2E4001BBF4730A3E3FDA9711AE386524D91C63BE0E516D00D5C"
|
|
||||||
"6141FCCF6C539F3518E180049865BE16B69CAE1F8CB7FDC474B38F7EE56CBE7D"
|
|
||||||
"8A89D9BA99B65D5265AEF32AA62426B10E6D75BB8677EC44F755BBC2806FD2B4"
|
|
||||||
"E04BDF5D44259DBEAA42B6F563DF7AA7506\"}"
|
|
||||||
};
|
};
|
||||||
heim_octet_string os;
|
heim_octet_string os;
|
||||||
Certificate c0, c1;
|
Certificate c0, c1;
|
||||||
|
@@ -432,7 +432,7 @@ add_line(struct templatehead *t, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add an entry to a template, with the pointer field bein a symbol name of a
|
* Add an entry to a template, with the pointer field being a symbol name of a
|
||||||
* template (i.e., an array, which decays to a pointer as usual in C).
|
* template (i.e., an array, which decays to a pointer as usual in C).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@@ -457,6 +457,9 @@ add_line_pointer(struct templatehead *t,
|
|||||||
q->ptr = strdup(ptr);
|
q->ptr = strdup(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add an entry to a template where the pointer firled is a string literal.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
add_line_string(struct templatehead *t,
|
add_line_string(struct templatehead *t,
|
||||||
const char *str,
|
const char *str,
|
||||||
@@ -479,6 +482,10 @@ add_line_string(struct templatehead *t,
|
|||||||
q->ptr = strdup(str);
|
q->ptr = strdup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add an entry to a template, with the pointer field being a reference to
|
||||||
|
* named object of a type other than a template or other array type.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
add_line_pointer_reference(struct templatehead *t,
|
add_line_pointer_reference(struct templatehead *t,
|
||||||
const char *ptr,
|
const char *ptr,
|
||||||
@@ -904,6 +911,7 @@ template_members(struct templatehead *temp,
|
|||||||
break;
|
break;
|
||||||
case TEnumerated:
|
case TEnumerated:
|
||||||
case TInteger: {
|
case TInteger: {
|
||||||
|
char *varname = NULL;
|
||||||
char *itype = NULL;
|
char *itype = NULL;
|
||||||
|
|
||||||
if (t->members)
|
if (t->members)
|
||||||
@@ -922,7 +930,49 @@ template_members(struct templatehead *temp,
|
|||||||
errx(1, "%s: unsupported range %lld -> %lld",
|
errx(1, "%s: unsupported range %lld -> %lld",
|
||||||
name, (long long)t->range->min, (long long)t->range->max);
|
name, (long long)t->range->min, (long long)t->range->max);
|
||||||
|
|
||||||
add_line(temp, "{ A1_PARSE_T(A1T_%s), %s, NULL }", itype, poffset);
|
/*
|
||||||
|
* If `t->members' then we should generate a template for those
|
||||||
|
* members.
|
||||||
|
*
|
||||||
|
* We don't know the name of this field, and the type may not have a
|
||||||
|
* name. If it has no name, we should generate a name for it, and if
|
||||||
|
* it does have a name, use it, to name a template for its members.
|
||||||
|
*
|
||||||
|
* Then we could use that in _asn1_print() to pretty-print values of
|
||||||
|
* enumerations.
|
||||||
|
*/
|
||||||
|
if (t->members && t->symbol) {
|
||||||
|
struct tlist *tl;
|
||||||
|
Member *m;
|
||||||
|
size_t nmemb = 0;
|
||||||
|
|
||||||
|
if (asprintf(&varname, "%s_enum_names", t->symbol->gen_name) == -1 ||
|
||||||
|
varname == NULL)
|
||||||
|
err(1, "Out of memory");
|
||||||
|
|
||||||
|
tl = tlist_new(varname);
|
||||||
|
/*
|
||||||
|
* XXX We're going to assume that t->members is sorted in
|
||||||
|
* numerically ascending order in the module source. We should
|
||||||
|
* really sort it here.
|
||||||
|
*/
|
||||||
|
HEIM_TAILQ_FOREACH(m, t->members, members) {
|
||||||
|
if (m->val > UINT32_MAX)
|
||||||
|
continue; /* Wouldn't fit in the offset field */
|
||||||
|
add_line(&tl->template,
|
||||||
|
"{ A1_OP_NAME, %d, \"%s\" }", m->val, m->gen_name);
|
||||||
|
nmemb++;
|
||||||
|
}
|
||||||
|
tlist_header(tl, "{ 0, 0, ((void *)%lu) }", nmemb);
|
||||||
|
/* XXX Accidentally O(N^2)? */
|
||||||
|
if (!tlist_find_dup(tl)) {
|
||||||
|
tlist_print(tl);
|
||||||
|
tlist_add(tl);
|
||||||
|
}
|
||||||
|
add_line(temp, "{ A1_PARSE_T(A1T_%s), %s, asn1_%s }", itype, poffset, varname);
|
||||||
|
} else {
|
||||||
|
add_line(temp, "{ A1_PARSE_T(A1T_%s), %s, NULL }", itype, poffset);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TGeneralString:
|
case TGeneralString:
|
||||||
|
@@ -230,7 +230,11 @@ typeid_int_cmp(const void *intp,
|
|||||||
|
|
||||||
if ((tint[1].tt & A1_OP_MASK) != A1_OP_PARSE)
|
if ((tint[1].tt & A1_OP_MASK) != A1_OP_PARSE)
|
||||||
return -1;
|
return -1;
|
||||||
if (A1_PARSE_TYPE(tint[1].tt) != A1T_INTEGER)
|
if (A1_PARSE_TYPE(tint[1].tt) != A1T_INTEGER &&
|
||||||
|
A1_PARSE_TYPE(tint[1].tt) != A1T_UNSIGNED &&
|
||||||
|
A1_PARSE_TYPE(tint[1].tt) != A1T_INTEGER64 &&
|
||||||
|
A1_PARSE_TYPE(tint[1].tt) != A1T_UNSIGNED64 &&
|
||||||
|
A1_PARSE_TYPE(tint[1].tt) != A1T_IMEMBER)
|
||||||
return -1;
|
return -1;
|
||||||
switch (tint[0].offset) {
|
switch (tint[0].offset) {
|
||||||
case 8: return i - *(const int64_t *)intp;
|
case 8: return i - *(const int64_t *)intp;
|
||||||
@@ -510,8 +514,12 @@ _asn1_decode_open_type(const struct asn1_template *t,
|
|||||||
|
|
||||||
if ((tint->tt & A1_OP_MASK) != A1_OP_PARSE)
|
if ((tint->tt & A1_OP_MASK) != A1_OP_PARSE)
|
||||||
return 0; /* Do nothing, silently */
|
return 0; /* Do nothing, silently */
|
||||||
if (A1_PARSE_TYPE(tint->tt) != A1T_INTEGER)
|
if (A1_PARSE_TYPE(tint->tt) != A1T_INTEGER &&
|
||||||
return 0; /* Do nothing, silently (probably a large int) */
|
A1_PARSE_TYPE(tint->tt) != A1T_UNSIGNED &&
|
||||||
|
A1_PARSE_TYPE(tint->tt) != A1T_INTEGER64 &&
|
||||||
|
A1_PARSE_TYPE(tint->tt) != A1T_UNSIGNED64 &&
|
||||||
|
A1_PARSE_TYPE(tint->tt) != A1T_IMEMBER)
|
||||||
|
return 0; /* Do nothing, silently (maybe a large int) */
|
||||||
typeid_is_int = 1;
|
typeid_is_int = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2564,9 +2572,42 @@ _asn1_print(const struct asn1_template *t,
|
|||||||
ABORT_ON_ERROR();
|
ABORT_ON_ERROR();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == A1T_IMEMBER && t->ptr) {
|
||||||
|
/* Enumeration. Use the symbolic name of this value */
|
||||||
|
const struct asn1_template *tenum = t->ptr;
|
||||||
|
size_t left = 0;
|
||||||
|
size_t right = A1_HEADER_LEN(tenum);
|
||||||
|
size_t mid;
|
||||||
|
uint32_t v = *(unsigned int *)el;
|
||||||
|
int c = -1;
|
||||||
|
|
||||||
|
while (left <= right) {
|
||||||
|
mid = (left + right) >> 1;
|
||||||
|
|
||||||
|
if ((tenum[mid].tt & A1_OP_MASK) != A1_OP_NAME)
|
||||||
|
break;
|
||||||
|
c = v - tenum[mid].offset;
|
||||||
|
if (c < 0) {
|
||||||
|
if (mid)
|
||||||
|
right = mid - 1;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
} else if (c > 0) {
|
||||||
|
left = mid + 1;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c == 0) {
|
||||||
|
r = rk_strpoolprintf(r, "\"%s\"", (const char *)tenum[mid].ptr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
s = (asn1_template_prim[type].print)(el, flags);
|
s = (asn1_template_prim[type].print)(el, flags);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case A1T_OID:
|
case A1T_OID:
|
||||||
|
case A1T_IMEMBER:
|
||||||
case A1T_BOOLEAN:
|
case A1T_BOOLEAN:
|
||||||
case A1T_INTEGER:
|
case A1T_INTEGER:
|
||||||
case A1T_INTEGER64:
|
case A1T_INTEGER64:
|
||||||
|
Reference in New Issue
Block a user