diff --git a/src/xmldsig/xmldsigEXIDatatypes.c b/src/xmldsig/xmldsigEXIDatatypes.c index 7ee50d0..06d983e 100644 --- a/src/xmldsig/xmldsigEXIDatatypes.c +++ b/src/xmldsig/xmldsigEXIDatatypes.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -68,60 +68,150 @@ void init_xmldsigEXIDocument(struct xmldsigEXIDocument* exiDoc) { exiDoc->Object_isUsed = 0u; } + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES void init_xmldsigEXIFragment(struct xmldsigEXIFragment* exiFrag) { - exiFrag->RSAKeyValue_isUsed = 0u; - exiFrag->PGPKeyPacket_isUsed = 0u; - exiFrag->PGPKeyPacket_isUsed = 0u; - exiFrag->X509Data_isUsed = 0u; - exiFrag->PgenCounter_isUsed = 0u; - exiFrag->X509Certificate_isUsed = 0u; - exiFrag->Seed_isUsed = 0u; - exiFrag->Modulus_isUsed = 0u; - exiFrag->X509SKI_isUsed = 0u; - exiFrag->SPKISexp_isUsed = 0u; - exiFrag->CanonicalizationMethod_isUsed = 0u; - exiFrag->X509SerialNumber_isUsed = 0u; - exiFrag->SignatureProperties_isUsed = 0u; - exiFrag->Reference_isUsed = 0u; - exiFrag->KeyName_isUsed = 0u; - exiFrag->P_isUsed = 0u; - exiFrag->SignatureValue_isUsed = 0u; - exiFrag->SignedInfo_isUsed = 0u; - exiFrag->KeyInfo_isUsed = 0u; - exiFrag->DigestMethod_isUsed = 0u; - exiFrag->SPKIData_isUsed = 0u; - exiFrag->Object_isUsed = 0u; - exiFrag->Exponent_isUsed = 0u; - exiFrag->X509IssuerName_isUsed = 0u; - exiFrag->X509SubjectName_isUsed = 0u; - exiFrag->PGPData_isUsed = 0u; - exiFrag->HMACOutputLength_isUsed = 0u; exiFrag->DigestValue_isUsed = 0u; - exiFrag->MgmtData_isUsed = 0u; + exiFrag->X509Data_isUsed = 0u; exiFrag->KeyValue_isUsed = 0u; - exiFrag->SignatureProperty_isUsed = 0u; - exiFrag->DSAKeyValue_isUsed = 0u; - exiFrag->X509IssuerSerial_isUsed = 0u; - exiFrag->Y_isUsed = 0u; - exiFrag->J_isUsed = 0u; - exiFrag->Signature_isUsed = 0u; - exiFrag->Transform_isUsed = 0u; - exiFrag->PGPKeyID_isUsed = 0u; + exiFrag->DigestMethod_isUsed = 0u; + exiFrag->SPKISexp_isUsed = 0u; exiFrag->Transforms_isUsed = 0u; - exiFrag->G_isUsed = 0u; - exiFrag->X509CRL_isUsed = 0u; - exiFrag->Q_isUsed = 0u; - exiFrag->XPath_isUsed = 0u; - exiFrag->SignatureMethod_isUsed = 0u; - exiFrag->RetrievalMethod_isUsed = 0u; + exiFrag->KeyName_isUsed = 0u; + exiFrag->X509IssuerName_isUsed = 0u; + exiFrag->MgmtData_isUsed = 0u; + exiFrag->Reference_isUsed = 0u; + exiFrag->SignatureProperties_isUsed = 0u; + exiFrag->PGPKeyID_isUsed = 0u; + exiFrag->PGPData_isUsed = 0u; + exiFrag->DSAKeyValue_isUsed = 0u; + exiFrag->SignatureValue_isUsed = 0u; + exiFrag->KeyInfo_isUsed = 0u; + exiFrag->SignatureProperty_isUsed = 0u; + exiFrag->PGPKeyPacket_isUsed = 0u; + exiFrag->PGPKeyPacket_isUsed = 0u; + exiFrag->HMACOutputLength_isUsed = 0u; + exiFrag->Exponent_isUsed = 0u; exiFrag->Manifest_isUsed = 0u; + exiFrag->P_isUsed = 0u; + exiFrag->CanonicalizationMethod_isUsed = 0u; + exiFrag->Q_isUsed = 0u; + exiFrag->Seed_isUsed = 0u; + exiFrag->X509SubjectName_isUsed = 0u; + exiFrag->X509Certificate_isUsed = 0u; + exiFrag->RSAKeyValue_isUsed = 0u; + exiFrag->X509IssuerSerial_isUsed = 0u; + exiFrag->SPKIData_isUsed = 0u; + exiFrag->G_isUsed = 0u; + exiFrag->J_isUsed = 0u; + exiFrag->SignedInfo_isUsed = 0u; + exiFrag->X509SKI_isUsed = 0u; + exiFrag->Transform_isUsed = 0u; + exiFrag->XPath_isUsed = 0u; + exiFrag->Object_isUsed = 0u; + exiFrag->X509SerialNumber_isUsed = 0u; + exiFrag->RetrievalMethod_isUsed = 0u; + exiFrag->Modulus_isUsed = 0u; + exiFrag->X509CRL_isUsed = 0u; + exiFrag->Signature_isUsed = 0u; + exiFrag->Y_isUsed = 0u; + exiFrag->SignatureMethod_isUsed = 0u; + exiFrag->PgenCounter_isUsed = 0u; } #endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ +void init_xmldsigCanonicalizationMethodType(struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { + xmldsigCanonicalizationMethodType->ANY_isUsed = 0u; +} + +void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType) { + xmldsigManifestType->Id_isUsed = 0u; + xmldsigManifestType->Reference.arrayLen = 0u; +} + +void init_xmldsigObjectType(struct xmldsigObjectType* xmldsigObjectType) { + xmldsigObjectType->Id_isUsed = 0u; + xmldsigObjectType->MimeType_isUsed = 0u; + xmldsigObjectType->Encoding_isUsed = 0u; + xmldsigObjectType->ANY_isUsed = 0u; +} + +void init_xmldsigTransformType(struct xmldsigTransformType* xmldsigTransformType) { + xmldsigTransformType->ANY_isUsed = 0u; + xmldsigTransformType->XPath.arrayLen = 0u; +} + +void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { + xmldsigSignatureMethodType->HMACOutputLength_isUsed = 0u; + xmldsigSignatureMethodType->ANY_isUsed = 0u; +} + +void init_xmldsigDigestMethodType(struct xmldsigDigestMethodType* xmldsigDigestMethodType) { + xmldsigDigestMethodType->ANY_isUsed = 0u; +} + +void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { + xmldsigRetrievalMethodType->URI_isUsed = 0u; + xmldsigRetrievalMethodType->Type_isUsed = 0u; + xmldsigRetrievalMethodType->Transforms_isUsed = 0u; +} + +void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType) { + xmldsigSignatureValueType->Id_isUsed = 0u; +} + +void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { + (void)xmldsigX509IssuerSerialType; /* avoid unused warning */ +} + +void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType) { + xmldsigSignedInfoType->Id_isUsed = 0u; + xmldsigSignedInfoType->Reference.arrayLen = 0u; +} + +void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) { + xmldsigSignaturePropertiesType->Id_isUsed = 0u; + xmldsigSignaturePropertiesType->SignatureProperty.arrayLen = 0u; +} + +void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { + xmldsigSignaturePropertyType->Id_isUsed = 0u; + xmldsigSignaturePropertyType->ANY_isUsed = 0u; +} + void init_xmldsigKeyValueType(struct xmldsigKeyValueType* xmldsigKeyValueType) { xmldsigKeyValueType->DSAKeyValue_isUsed = 0u; xmldsigKeyValueType->RSAKeyValue_isUsed = 0u; + xmldsigKeyValueType->ANY_isUsed = 0u; +} + +void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { + (void)xmldsigRSAKeyValueType; /* avoid unused warning */ +} + +void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType) { + xmldsigPGPDataType->PGPKeyID_isUsed = 0u; + xmldsigPGPDataType->PGPKeyPacket_isUsed = 0u; + xmldsigPGPDataType->ANY_isUsed = 0u; +} + +void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType) { + xmldsigTransformsType->Transform.arrayLen = 0u; +} + +void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType) { + xmldsigX509DataType->X509IssuerSerial.arrayLen = 0u; + xmldsigX509DataType->X509SKI.arrayLen = 0u; + xmldsigX509DataType->X509SubjectName.arrayLen = 0u; + xmldsigX509DataType->X509Certificate.arrayLen = 0u; + xmldsigX509DataType->X509CRL.arrayLen = 0u; + xmldsigX509DataType->ANY_isUsed = 0u; +} + +void init_xmldsigSignatureType(struct xmldsigSignatureType* xmldsigSignatureType) { + xmldsigSignatureType->Id_isUsed = 0u; + xmldsigSignatureType->KeyInfo_isUsed = 0u; + xmldsigSignatureType->Object.arrayLen = 0u; } void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType) { @@ -133,40 +223,6 @@ void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyVal xmldsigDSAKeyValueType->PgenCounter_isUsed = 0u; } -void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { -} - -void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) { - xmldsigSignaturePropertiesType->Id_isUsed = 0u; - xmldsigSignaturePropertiesType->SignatureProperty.arrayLen = 0u; -} - -void init_xmldsigCanonicalizationMethodType(struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { -} - -void init_xmldsigObjectType(struct xmldsigObjectType* xmldsigObjectType) { - xmldsigObjectType->Id_isUsed = 0u; - xmldsigObjectType->MimeType_isUsed = 0u; - xmldsigObjectType->Encoding_isUsed = 0u; -} - -void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType) { - xmldsigTransformsType->Transform.arrayLen = 0u; -} - -void init_xmldsigTransformType(struct xmldsigTransformType* xmldsigTransformType) { - xmldsigTransformType->XPath.arrayLen = 0u; -} - -void init_xmldsigDigestMethodType(struct xmldsigDigestMethodType* xmldsigDigestMethodType) { -} - -void init_xmldsigSignatureType(struct xmldsigSignatureType* xmldsigSignatureType) { - xmldsigSignatureType->Id_isUsed = 0u; - xmldsigSignatureType->KeyInfo_isUsed = 0u; - xmldsigSignatureType->Object.arrayLen = 0u; -} - void init_xmldsigReferenceType(struct xmldsigReferenceType* xmldsigReferenceType) { xmldsigReferenceType->Id_isUsed = 0u; xmldsigReferenceType->URI_isUsed = 0u; @@ -176,33 +232,7 @@ void init_xmldsigReferenceType(struct xmldsigReferenceType* xmldsigReferenceType void init_xmldsigSPKIDataType(struct xmldsigSPKIDataType* xmldsigSPKIDataType) { xmldsigSPKIDataType->SPKISexp.arrayLen = 0u; -} - -void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType) { - xmldsigPGPDataType->PGPKeyID_isUsed = 0u; - xmldsigPGPDataType->PGPKeyPacket_isUsed = 0u; -} - -void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { -} - -void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { - xmldsigSignatureMethodType->HMACOutputLength_isUsed = 0u; -} - -void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { - xmldsigRetrievalMethodType->URI_isUsed = 0u; - xmldsigRetrievalMethodType->Type_isUsed = 0u; - xmldsigRetrievalMethodType->Transforms_isUsed = 0u; -} - -void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { - xmldsigSignaturePropertyType->Id_isUsed = 0u; -} - -void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType) { - xmldsigSignedInfoType->Id_isUsed = 0u; - xmldsigSignedInfoType->Reference.arrayLen = 0u; + xmldsigSPKIDataType->ANY_isUsed = 0u; } void init_xmldsigKeyInfoType(struct xmldsigKeyInfoType* xmldsigKeyInfoType) { @@ -214,23 +244,7 @@ void init_xmldsigKeyInfoType(struct xmldsigKeyInfoType* xmldsigKeyInfoType) { xmldsigKeyInfoType->PGPData.arrayLen = 0u; xmldsigKeyInfoType->SPKIData.arrayLen = 0u; xmldsigKeyInfoType->MgmtData.arrayLen = 0u; -} - -void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType) { - xmldsigManifestType->Id_isUsed = 0u; - xmldsigManifestType->Reference.arrayLen = 0u; -} - -void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType) { - xmldsigSignatureValueType->Id_isUsed = 0u; -} - -void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType) { - xmldsigX509DataType->X509IssuerSerial.arrayLen = 0u; - xmldsigX509DataType->X509SKI.arrayLen = 0u; - xmldsigX509DataType->X509SubjectName.arrayLen = 0u; - xmldsigX509DataType->X509Certificate.arrayLen = 0u; - xmldsigX509DataType->X509CRL.arrayLen = 0u; + xmldsigKeyInfoType->ANY_isUsed = 0u; } diff --git a/src/xmldsig/xmldsigEXIDatatypes.h b/src/xmldsig/xmldsigEXIDatatypes.h index 93f41fe..ff902fe 100644 --- a/src/xmldsig/xmldsigEXIDatatypes.h +++ b/src/xmldsig/xmldsigEXIDatatypes.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -60,10 +60,28 @@ extern "C" { #define UNION_NO 2 #define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +#define xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR +#define xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigCanonicalizationMethodType { + /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ + struct { + exi_string_character_t characters[xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Algorithm ; + /* element: WC[##any] */ + struct { + exi_string_character_t characters[xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any])){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigObjectType_Id_CHARACTERS_SIZE 50 -#define xmldsigObjectType_MimeType_CHARACTERS_SIZE 50 -#define xmldsigObjectType_Encoding_CHARACTERS_SIZE 50 +#define xmldsigObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR struct xmldsigObjectType { /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ struct { @@ -83,11 +101,18 @@ struct xmldsigObjectType { uint16_t charactersLen; } Encoding ; unsigned int Encoding_isUsed:1; + /* element: WC[##any] */ + struct { + exi_string_character_t characters[xmldsigObjectType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; }; /* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigTransformType_Algorithm_CHARACTERS_SIZE 65 -#define xmldsigTransformType_XPath_CHARACTERS_SIZE 50 +#define xmldsigTransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR +#define xmldsigTransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigTransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigTransformType_XPath_ARRAY_SIZE 1 struct xmldsigTransformType { /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ @@ -95,6 +120,12 @@ struct xmldsigTransformType { exi_string_character_t characters[xmldsigTransformType_Algorithm_CHARACTERS_SIZE]; uint16_t charactersLen; } Algorithm ; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigTransformType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; /* element: "http://www.w3.org/2000/09/xmldsig#":XPath, http://www.w3.org/2001/XMLSchema,string */ struct { struct { @@ -105,19 +136,116 @@ struct xmldsigTransformType { } XPath; }; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +#define xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR +#define xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigSignatureMethodType { + /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ + struct { + exi_string_character_t characters[xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Algorithm ; + /* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */ + int64_t HMACOutputLength ; + unsigned int HMACOutputLength_isUsed:1; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE 65 +#define xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR +#define xmldsigDigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR struct xmldsigDigestMethodType { /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ struct { exi_string_character_t characters[xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE]; uint16_t charactersLen; } Algorithm ; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigDigestMethodType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ +#define xmldsigSignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigSignatureValueType_CONTENT_BYTES_SIZE 350 +struct xmldsigSignatureValueType { + /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ + struct { + exi_string_character_t characters[xmldsigSignatureValueType_Id_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Id ; + unsigned int Id_isUsed:1; + /* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */ + struct { + uint8_t bytes[xmldsigSignatureValueType_CONTENT_BYTES_SIZE]; + uint16_t bytesLen; + } CONTENT ; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ +#define xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigX509IssuerSerialType { + /* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */ + struct { + exi_string_character_t characters[xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE]; + uint16_t charactersLen; + } X509IssuerName ; + /* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */ + int64_t X509SerialNumber ; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +#define xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigSignaturePropertyType { + /* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */ + struct { + exi_string_character_t characters[xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Target ; + /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ + struct { + exi_string_character_t characters[xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Id ; + unsigned int Id_isUsed:1; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ +#define xmldsigRSAKeyValueType_Modulus_BYTES_SIZE 350 +#define xmldsigRSAKeyValueType_Exponent_BYTES_SIZE 350 +struct xmldsigRSAKeyValueType { + /* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */ + struct { + uint8_t bytes[xmldsigRSAKeyValueType_Modulus_BYTES_SIZE]; + uint16_t bytesLen; + } Modulus ; + /* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */ + struct { + uint8_t bytes[xmldsigRSAKeyValueType_Exponent_BYTES_SIZE]; + uint16_t bytesLen; + } Exponent ; }; /* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))', derivedBy='RESTRICTION'. */ #define xmldsigPGPDataType_PGPKeyID_BYTES_SIZE 350 #define xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE 350 +#define xmldsigPGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR struct xmldsigPGPDataType { /* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */ struct { @@ -131,6 +259,79 @@ struct xmldsigPGPDataType { uint16_t bytesLen; } PGPKeyPacket ; unsigned int PGPKeyPacket_isUsed:1; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigPGPDataType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +#define xmldsigTransformsType_Transform_ARRAY_SIZE 1 +struct xmldsigTransformsType { + /* element: "http://www.w3.org/2000/09/xmldsig#":Transform, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ + struct { + struct xmldsigTransformType array[xmldsigTransformsType_Transform_ARRAY_SIZE]; + uint16_t arrayLen; + } Transform; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +#define xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE 1 +#define xmldsigX509DataType_X509SKI_BYTES_SIZE 350 +#define xmldsigX509DataType_X509SKI_ARRAY_SIZE 1 +#define xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigX509DataType_X509SubjectName_ARRAY_SIZE 1 +#define xmldsigX509DataType_X509Certificate_BYTES_SIZE 350 +#define xmldsigX509DataType_X509Certificate_ARRAY_SIZE 1 +#define xmldsigX509DataType_X509CRL_BYTES_SIZE 350 +#define xmldsigX509DataType_X509CRL_ARRAY_SIZE 1 +#define xmldsigX509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigX509DataType { + /* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial, Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ + struct { + struct xmldsigX509IssuerSerialType array[xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE]; + uint16_t arrayLen; + } X509IssuerSerial; + /* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */ + struct { + struct { + uint8_t bytes[xmldsigX509DataType_X509SKI_BYTES_SIZE]; + uint16_t bytesLen; + } array[xmldsigX509DataType_X509SKI_ARRAY_SIZE]; + uint16_t arrayLen; + } X509SKI; + /* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */ + struct { + struct { + exi_string_character_t characters[xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE]; + uint16_t charactersLen; + } array[xmldsigX509DataType_X509SubjectName_ARRAY_SIZE]; + uint16_t arrayLen; + } X509SubjectName; + /* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */ + struct { + struct { + uint8_t bytes[xmldsigX509DataType_X509Certificate_BYTES_SIZE]; + uint16_t bytesLen; + } array[xmldsigX509DataType_X509Certificate_ARRAY_SIZE]; + uint16_t arrayLen; + } X509Certificate; + /* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */ + struct { + struct { + uint8_t bytes[xmldsigX509DataType_X509CRL_BYTES_SIZE]; + uint16_t bytesLen; + } array[xmldsigX509DataType_X509CRL_ARRAY_SIZE]; + uint16_t arrayLen; + } X509CRL; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigX509DataType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; }; /* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ @@ -185,217 +386,10 @@ struct xmldsigDSAKeyValueType { unsigned int PgenCounter_isUsed:1; }; -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ -#define xmldsigSignatureValueType_Id_CHARACTERS_SIZE 50 -#define xmldsigSignatureValueType_CONTENT_BYTES_SIZE 350 -struct xmldsigSignatureValueType { - /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ - struct { - exi_string_character_t characters[xmldsigSignatureValueType_Id_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Id ; - unsigned int Id_isUsed:1; - /* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */ - struct { - uint8_t bytes[xmldsigSignatureValueType_CONTENT_BYTES_SIZE]; - uint16_t bytesLen; - } CONTENT ; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ -#define xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 -struct xmldsigX509IssuerSerialType { - /* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */ - struct { - exi_string_character_t characters[xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE]; - uint16_t charactersLen; - } X509IssuerName ; - /* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */ - int64_t X509SerialNumber ; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ -#define xmldsigRSAKeyValueType_Modulus_BYTES_SIZE 350 -#define xmldsigRSAKeyValueType_Exponent_BYTES_SIZE 350 -struct xmldsigRSAKeyValueType { - /* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */ - struct { - uint8_t bytes[xmldsigRSAKeyValueType_Modulus_BYTES_SIZE]; - uint16_t bytesLen; - } Modulus ; - /* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */ - struct { - uint8_t bytes[xmldsigRSAKeyValueType_Exponent_BYTES_SIZE]; - uint16_t bytesLen; - } Exponent ; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE 1 -#define xmldsigX509DataType_X509SKI_BYTES_SIZE 350 -#define xmldsigX509DataType_X509SKI_ARRAY_SIZE 1 -#define xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE 50 -#define xmldsigX509DataType_X509SubjectName_ARRAY_SIZE 1 -#define xmldsigX509DataType_X509Certificate_BYTES_SIZE 350 -#define xmldsigX509DataType_X509Certificate_ARRAY_SIZE 1 -#define xmldsigX509DataType_X509CRL_BYTES_SIZE 350 -#define xmldsigX509DataType_X509CRL_ARRAY_SIZE 1 -struct xmldsigX509DataType { - /* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial, Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ - struct { - struct xmldsigX509IssuerSerialType array[xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE]; - uint16_t arrayLen; - } X509IssuerSerial; - /* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */ - struct { - struct { - uint8_t bytes[xmldsigX509DataType_X509SKI_BYTES_SIZE]; - uint16_t bytesLen; - } array[xmldsigX509DataType_X509SKI_ARRAY_SIZE]; - uint16_t arrayLen; - } X509SKI; - /* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */ - struct { - struct { - exi_string_character_t characters[xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE]; - uint16_t charactersLen; - } array[xmldsigX509DataType_X509SubjectName_ARRAY_SIZE]; - uint16_t arrayLen; - } X509SubjectName; - /* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */ - struct { - struct { - uint8_t bytes[xmldsigX509DataType_X509Certificate_BYTES_SIZE]; - uint16_t bytesLen; - } array[xmldsigX509DataType_X509Certificate_ARRAY_SIZE]; - uint16_t arrayLen; - } X509Certificate; - /* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */ - struct { - struct { - uint8_t bytes[xmldsigX509DataType_X509CRL_BYTES_SIZE]; - uint16_t bytesLen; - } array[xmldsigX509DataType_X509CRL_ARRAY_SIZE]; - uint16_t arrayLen; - } X509CRL; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE 65 -struct xmldsigSignatureMethodType { - /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ - struct { - exi_string_character_t characters[xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Algorithm ; - /* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */ - int64_t HMACOutputLength ; - unsigned int HMACOutputLength_isUsed:1; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigSPKIDataType_SPKISexp_BYTES_SIZE 350 -#define xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE 1 -struct xmldsigSPKIDataType { - /* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */ - struct { - struct { - uint8_t bytes[xmldsigSPKIDataType_SPKISexp_BYTES_SIZE]; - uint16_t bytesLen; - } array[xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE]; - uint16_t arrayLen; - } SPKISexp; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE 50 -#define xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE 50 -struct xmldsigSignaturePropertyType { - /* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */ - struct { - exi_string_character_t characters[xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Target ; - /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ - struct { - exi_string_character_t characters[xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Id ; - unsigned int Id_isUsed:1; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 -struct xmldsigCanonicalizationMethodType { - /* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */ - struct { - exi_string_character_t characters[xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Algorithm ; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigTransformsType_Transform_ARRAY_SIZE 1 -struct xmldsigTransformsType { - /* element: "http://www.w3.org/2000/09/xmldsig#":Transform, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ - struct { - struct xmldsigTransformType array[xmldsigTransformsType_Transform_ARRAY_SIZE]; - uint16_t arrayLen; - } Transform; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ -struct xmldsigKeyValueType { - /* element: "http://www.w3.org/2000/09/xmldsig#":DSAKeyValue, Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ - struct xmldsigDSAKeyValueType DSAKeyValue ; - unsigned int DSAKeyValue_isUsed:1; - /* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ - struct xmldsigRSAKeyValueType RSAKeyValue ; - unsigned int RSAKeyValue_isUsed:1; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ -#define xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE 50 -#define xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE 50 -struct xmldsigRetrievalMethodType { - /* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */ - struct { - exi_string_character_t characters[xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE]; - uint16_t charactersLen; - } URI ; - unsigned int URI_isUsed:1; - /* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */ - struct { - exi_string_character_t characters[xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Type ; - unsigned int Type_isUsed:1; - /* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ - struct xmldsigTransformsType Transforms ; - unsigned int Transforms_isUsed:1; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE 50 -#define xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1 -struct xmldsigSignaturePropertiesType { - /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ - struct { - exi_string_character_t characters[xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE]; - uint16_t charactersLen; - } Id ; - unsigned int Id_isUsed:1; - /* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ - struct { - struct xmldsigSignaturePropertyType array[xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE]; - uint16_t arrayLen; - } SignatureProperty; -}; - /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)', derivedBy='RESTRICTION'. */ -#define xmldsigReferenceType_Id_CHARACTERS_SIZE 50 -#define xmldsigReferenceType_URI_CHARACTERS_SIZE 50 -#define xmldsigReferenceType_Type_CHARACTERS_SIZE 50 +#define xmldsigReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigReferenceType_DigestValue_BYTES_SIZE 350 struct xmldsigReferenceType { /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ @@ -428,8 +422,67 @@ struct xmldsigReferenceType { } DigestValue ; }; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +#define xmldsigSPKIDataType_SPKISexp_BYTES_SIZE 350 +#define xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE 1 +#define xmldsigSPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigSPKIDataType { + /* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */ + struct { + struct { + uint8_t bytes[xmldsigSPKIDataType_SPKISexp_BYTES_SIZE]; + uint16_t bytesLen; + } array[xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE]; + uint16_t arrayLen; + } SPKISexp; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigSPKIDataType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +#define xmldsigManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigManifestType_Reference_ARRAY_SIZE 1 +struct xmldsigManifestType { + /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ + struct { + exi_string_character_t characters[xmldsigManifestType_Id_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Id ; + unsigned int Id_isUsed:1; + /* element: "http://www.w3.org/2000/09/xmldsig#":Reference, Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)', derivedBy='RESTRICTION'. */ + struct { + struct xmldsigReferenceType array[xmldsigManifestType_Reference_ARRAY_SIZE]; + uint16_t arrayLen; + } Reference; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ +#define xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigRetrievalMethodType { + /* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */ + struct { + exi_string_character_t characters[xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE]; + uint16_t charactersLen; + } URI ; + unsigned int URI_isUsed:1; + /* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */ + struct { + exi_string_character_t characters[xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Type ; + unsigned int Type_isUsed:1; + /* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ + struct xmldsigTransformsType Transforms ; + unsigned int Transforms_isUsed:1; +}; + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigSignedInfoType_Id_CHARACTERS_SIZE 50 +#define xmldsigSignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigSignedInfoType_Reference_ARRAY_SIZE 1 struct xmldsigSignedInfoType { /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ @@ -449,17 +502,52 @@ struct xmldsigSignedInfoType { } Reference; }; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +#define xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1 +struct xmldsigSignaturePropertiesType { + /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ + struct { + exi_string_character_t characters[xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE]; + uint16_t charactersLen; + } Id ; + unsigned int Id_isUsed:1; + /* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ + struct { + struct xmldsigSignaturePropertyType array[xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE]; + uint16_t arrayLen; + } SignatureProperty; +}; + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ +#define xmldsigKeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR +struct xmldsigKeyValueType { + /* element: "http://www.w3.org/2000/09/xmldsig#":DSAKeyValue, Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ + struct xmldsigDSAKeyValueType DSAKeyValue ; + unsigned int DSAKeyValue_isUsed:1; + /* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ + struct xmldsigRSAKeyValueType RSAKeyValue ; + unsigned int RSAKeyValue_isUsed:1; + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ + struct { + exi_string_character_t characters[xmldsigKeyValueType_ANY_CHARACTERS_SIZE]; + uint16_t charactersLen; + } ANY ; + unsigned int ANY_isUsed:1; +}; + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyInfoType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":KeyName|"http://www.w3.org/2000/09/xmldsig#":KeyValue|"http://www.w3.org/2000/09/xmldsig#":RetrievalMethod|"http://www.w3.org/2000/09/xmldsig#":X509Data|"http://www.w3.org/2000/09/xmldsig#":PGPData|"http://www.w3.org/2000/09/xmldsig#":SPKIData|"http://www.w3.org/2000/09/xmldsig#":MgmtData|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -#define xmldsigKeyInfoType_Id_CHARACTERS_SIZE 50 -#define xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE 50 +#define xmldsigKeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigKeyInfoType_KeyName_ARRAY_SIZE 1 #define xmldsigKeyInfoType_KeyValue_ARRAY_SIZE 1 #define xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE 1 #define xmldsigKeyInfoType_X509Data_ARRAY_SIZE 1 #define xmldsigKeyInfoType_PGPData_ARRAY_SIZE 1 #define xmldsigKeyInfoType_SPKIData_ARRAY_SIZE 1 -#define xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE 50 +#define xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigKeyInfoType_MgmtData_ARRAY_SIZE 1 +#define xmldsigKeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR struct xmldsigKeyInfoType { /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ struct { @@ -508,27 +596,16 @@ struct xmldsigKeyInfoType { } array[xmldsigKeyInfoType_MgmtData_ARRAY_SIZE]; uint16_t arrayLen; } MgmtData; -}; - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigManifestType_Id_CHARACTERS_SIZE 50 -#define xmldsigManifestType_Reference_ARRAY_SIZE 1 -struct xmldsigManifestType { - /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ + /* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */ struct { - exi_string_character_t characters[xmldsigManifestType_Id_CHARACTERS_SIZE]; + exi_string_character_t characters[xmldsigKeyInfoType_ANY_CHARACTERS_SIZE]; uint16_t charactersLen; - } Id ; - unsigned int Id_isUsed:1; - /* element: "http://www.w3.org/2000/09/xmldsig#":Reference, Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)', derivedBy='RESTRICTION'. */ - struct { - struct xmldsigReferenceType array[xmldsigManifestType_Reference_ARRAY_SIZE]; - uint16_t arrayLen; - } Reference; + } ANY ; + unsigned int ANY_isUsed:1; }; /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -#define xmldsigSignatureType_Id_CHARACTERS_SIZE 50 +#define xmldsigSignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR #define xmldsigSignatureType_Object_ARRAY_SIZE 1 struct xmldsigSignatureType { /* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */ @@ -553,30 +630,30 @@ struct xmldsigSignatureType { -#define EXIDocument_MgmtData_CHARACTERS_SIZE 50 -#define EXIDocument_KeyName_CHARACTERS_SIZE 50 +#define EXIDocument_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define EXIDocument_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR #define EXIDocument_DigestValue_BYTES_SIZE 350 -#define EXIFragment_PGPKeyPacket_BYTES_SIZE 350 -#define EXIFragment_PgenCounter_BYTES_SIZE 350 -#define EXIFragment_X509Certificate_BYTES_SIZE 350 -#define EXIFragment_Seed_BYTES_SIZE 350 -#define EXIFragment_Modulus_BYTES_SIZE 350 -#define EXIFragment_X509SKI_BYTES_SIZE 350 -#define EXIFragment_SPKISexp_BYTES_SIZE 350 -#define EXIFragment_KeyName_CHARACTERS_SIZE 50 -#define EXIFragment_P_BYTES_SIZE 350 -#define EXIFragment_Exponent_BYTES_SIZE 350 -#define EXIFragment_X509IssuerName_CHARACTERS_SIZE 50 -#define EXIFragment_X509SubjectName_CHARACTERS_SIZE 50 #define EXIFragment_DigestValue_BYTES_SIZE 350 -#define EXIFragment_MgmtData_CHARACTERS_SIZE 50 -#define EXIFragment_Y_BYTES_SIZE 350 -#define EXIFragment_J_BYTES_SIZE 350 +#define EXIFragment_SPKISexp_BYTES_SIZE 350 +#define EXIFragment_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define EXIFragment_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define EXIFragment_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR #define EXIFragment_PGPKeyID_BYTES_SIZE 350 -#define EXIFragment_G_BYTES_SIZE 350 -#define EXIFragment_X509CRL_BYTES_SIZE 350 +#define EXIFragment_PGPKeyPacket_BYTES_SIZE 350 +#define EXIFragment_Exponent_BYTES_SIZE 350 +#define EXIFragment_P_BYTES_SIZE 350 #define EXIFragment_Q_BYTES_SIZE 350 -#define EXIFragment_XPath_CHARACTERS_SIZE 50 +#define EXIFragment_Seed_BYTES_SIZE 350 +#define EXIFragment_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define EXIFragment_X509Certificate_BYTES_SIZE 350 +#define EXIFragment_G_BYTES_SIZE 350 +#define EXIFragment_J_BYTES_SIZE 350 +#define EXIFragment_X509SKI_BYTES_SIZE 350 +#define EXIFragment_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR +#define EXIFragment_Modulus_BYTES_SIZE 350 +#define EXIFragment_X509CRL_BYTES_SIZE 350 +#define EXIFragment_Y_BYTES_SIZE 350 +#define EXIFragment_PgenCounter_BYTES_SIZE 350 /* Global elements of EXI Document */ @@ -648,203 +725,205 @@ struct xmldsigEXIDocument { int _warning_; }; - + + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES /* Possible elements of EXI Fragment */ struct xmldsigEXIFragment { #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES union { #endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ - struct xmldsigRSAKeyValueType RSAKeyValue ; struct { - uint8_t bytes[EXIFragment_PGPKeyPacket_BYTES_SIZE]; + uint8_t bytes[EXIFragment_DigestValue_BYTES_SIZE]; uint16_t bytesLen; - } PGPKeyPacket ; + } DigestValue ; struct xmldsigX509DataType X509Data ; - struct { - uint8_t bytes[EXIFragment_PgenCounter_BYTES_SIZE]; - uint16_t bytesLen; - } PgenCounter ; - struct { - uint8_t bytes[EXIFragment_X509Certificate_BYTES_SIZE]; - uint16_t bytesLen; - } X509Certificate ; - struct { - uint8_t bytes[EXIFragment_Seed_BYTES_SIZE]; - uint16_t bytesLen; - } Seed ; - struct { - uint8_t bytes[EXIFragment_Modulus_BYTES_SIZE]; - uint16_t bytesLen; - } Modulus ; - struct { - uint8_t bytes[EXIFragment_X509SKI_BYTES_SIZE]; - uint16_t bytesLen; - } X509SKI ; + struct xmldsigKeyValueType KeyValue ; + struct xmldsigDigestMethodType DigestMethod ; struct { uint8_t bytes[EXIFragment_SPKISexp_BYTES_SIZE]; uint16_t bytesLen; } SPKISexp ; - struct xmldsigCanonicalizationMethodType CanonicalizationMethod ; - int64_t X509SerialNumber ; - struct xmldsigSignaturePropertiesType SignatureProperties ; - struct xmldsigReferenceType Reference ; + struct xmldsigTransformsType Transforms ; struct { exi_string_character_t characters[EXIFragment_KeyName_CHARACTERS_SIZE]; uint16_t charactersLen; } KeyName ; - struct { - uint8_t bytes[EXIFragment_P_BYTES_SIZE]; - uint16_t bytesLen; - } P ; - struct xmldsigSignatureValueType SignatureValue ; - struct xmldsigSignedInfoType SignedInfo ; - struct xmldsigKeyInfoType KeyInfo ; - struct xmldsigDigestMethodType DigestMethod ; - struct xmldsigSPKIDataType SPKIData ; - struct xmldsigObjectType Object ; - struct { - uint8_t bytes[EXIFragment_Exponent_BYTES_SIZE]; - uint16_t bytesLen; - } Exponent ; struct { exi_string_character_t characters[EXIFragment_X509IssuerName_CHARACTERS_SIZE]; uint16_t charactersLen; } X509IssuerName ; - struct { - exi_string_character_t characters[EXIFragment_X509SubjectName_CHARACTERS_SIZE]; - uint16_t charactersLen; - } X509SubjectName ; - struct xmldsigPGPDataType PGPData ; - int64_t HMACOutputLength ; - struct { - uint8_t bytes[EXIFragment_DigestValue_BYTES_SIZE]; - uint16_t bytesLen; - } DigestValue ; struct { exi_string_character_t characters[EXIFragment_MgmtData_CHARACTERS_SIZE]; uint16_t charactersLen; } MgmtData ; - struct xmldsigKeyValueType KeyValue ; - struct xmldsigSignaturePropertyType SignatureProperty ; - struct xmldsigDSAKeyValueType DSAKeyValue ; - struct xmldsigX509IssuerSerialType X509IssuerSerial ; - struct { - uint8_t bytes[EXIFragment_Y_BYTES_SIZE]; - uint16_t bytesLen; - } Y ; - struct { - uint8_t bytes[EXIFragment_J_BYTES_SIZE]; - uint16_t bytesLen; - } J ; - struct xmldsigSignatureType Signature ; - struct xmldsigTransformType Transform ; + struct xmldsigReferenceType Reference ; + struct xmldsigSignaturePropertiesType SignatureProperties ; struct { uint8_t bytes[EXIFragment_PGPKeyID_BYTES_SIZE]; uint16_t bytesLen; } PGPKeyID ; - struct xmldsigTransformsType Transforms ; + struct xmldsigPGPDataType PGPData ; + struct xmldsigDSAKeyValueType DSAKeyValue ; + struct xmldsigSignatureValueType SignatureValue ; + struct xmldsigKeyInfoType KeyInfo ; + struct xmldsigSignaturePropertyType SignatureProperty ; struct { - uint8_t bytes[EXIFragment_G_BYTES_SIZE]; + uint8_t bytes[EXIFragment_PGPKeyPacket_BYTES_SIZE]; uint16_t bytesLen; - } G ; + } PGPKeyPacket ; + int64_t HMACOutputLength ; struct { - uint8_t bytes[EXIFragment_X509CRL_BYTES_SIZE]; + uint8_t bytes[EXIFragment_Exponent_BYTES_SIZE]; uint16_t bytesLen; - } X509CRL ; + } Exponent ; + struct xmldsigManifestType Manifest ; + struct { + uint8_t bytes[EXIFragment_P_BYTES_SIZE]; + uint16_t bytesLen; + } P ; + struct xmldsigCanonicalizationMethodType CanonicalizationMethod ; struct { uint8_t bytes[EXIFragment_Q_BYTES_SIZE]; uint16_t bytesLen; } Q ; + struct { + uint8_t bytes[EXIFragment_Seed_BYTES_SIZE]; + uint16_t bytesLen; + } Seed ; + struct { + exi_string_character_t characters[EXIFragment_X509SubjectName_CHARACTERS_SIZE]; + uint16_t charactersLen; + } X509SubjectName ; + struct { + uint8_t bytes[EXIFragment_X509Certificate_BYTES_SIZE]; + uint16_t bytesLen; + } X509Certificate ; + struct xmldsigRSAKeyValueType RSAKeyValue ; + struct xmldsigX509IssuerSerialType X509IssuerSerial ; + struct xmldsigSPKIDataType SPKIData ; + struct { + uint8_t bytes[EXIFragment_G_BYTES_SIZE]; + uint16_t bytesLen; + } G ; + struct { + uint8_t bytes[EXIFragment_J_BYTES_SIZE]; + uint16_t bytesLen; + } J ; + struct xmldsigSignedInfoType SignedInfo ; + struct { + uint8_t bytes[EXIFragment_X509SKI_BYTES_SIZE]; + uint16_t bytesLen; + } X509SKI ; + struct xmldsigTransformType Transform ; struct { exi_string_character_t characters[EXIFragment_XPath_CHARACTERS_SIZE]; uint16_t charactersLen; } XPath ; - struct xmldsigSignatureMethodType SignatureMethod ; + struct xmldsigObjectType Object ; + int64_t X509SerialNumber ; struct xmldsigRetrievalMethodType RetrievalMethod ; - struct xmldsigManifestType Manifest ; + struct { + uint8_t bytes[EXIFragment_Modulus_BYTES_SIZE]; + uint16_t bytesLen; + } Modulus ; + struct { + uint8_t bytes[EXIFragment_X509CRL_BYTES_SIZE]; + uint16_t bytesLen; + } X509CRL ; + struct xmldsigSignatureType Signature ; + struct { + uint8_t bytes[EXIFragment_Y_BYTES_SIZE]; + uint16_t bytesLen; + } Y ; + struct xmldsigSignatureMethodType SignatureMethod ; + struct { + uint8_t bytes[EXIFragment_PgenCounter_BYTES_SIZE]; + uint16_t bytesLen; + } PgenCounter ; #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES }; #endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ - unsigned int RSAKeyValue_isUsed:1; - unsigned int PGPKeyPacket_isUsed:1; - unsigned int X509Data_isUsed:1; - unsigned int PgenCounter_isUsed:1; - unsigned int X509Certificate_isUsed:1; - unsigned int Seed_isUsed:1; - unsigned int Modulus_isUsed:1; - unsigned int X509SKI_isUsed:1; - unsigned int SPKISexp_isUsed:1; - unsigned int CanonicalizationMethod_isUsed:1; - unsigned int X509SerialNumber_isUsed:1; - unsigned int SignatureProperties_isUsed:1; - unsigned int Reference_isUsed:1; - unsigned int KeyName_isUsed:1; - unsigned int P_isUsed:1; - unsigned int SignatureValue_isUsed:1; - unsigned int SignedInfo_isUsed:1; - unsigned int KeyInfo_isUsed:1; - unsigned int DigestMethod_isUsed:1; - unsigned int SPKIData_isUsed:1; - unsigned int Object_isUsed:1; - unsigned int Exponent_isUsed:1; - unsigned int X509IssuerName_isUsed:1; - unsigned int X509SubjectName_isUsed:1; - unsigned int PGPData_isUsed:1; - unsigned int HMACOutputLength_isUsed:1; unsigned int DigestValue_isUsed:1; - unsigned int MgmtData_isUsed:1; + unsigned int X509Data_isUsed:1; unsigned int KeyValue_isUsed:1; - unsigned int SignatureProperty_isUsed:1; - unsigned int DSAKeyValue_isUsed:1; - unsigned int X509IssuerSerial_isUsed:1; - unsigned int Y_isUsed:1; - unsigned int J_isUsed:1; - unsigned int Signature_isUsed:1; - unsigned int Transform_isUsed:1; - unsigned int PGPKeyID_isUsed:1; + unsigned int DigestMethod_isUsed:1; + unsigned int SPKISexp_isUsed:1; unsigned int Transforms_isUsed:1; - unsigned int G_isUsed:1; - unsigned int X509CRL_isUsed:1; - unsigned int Q_isUsed:1; - unsigned int XPath_isUsed:1; - unsigned int SignatureMethod_isUsed:1; - unsigned int RetrievalMethod_isUsed:1; + unsigned int KeyName_isUsed:1; + unsigned int X509IssuerName_isUsed:1; + unsigned int MgmtData_isUsed:1; + unsigned int Reference_isUsed:1; + unsigned int SignatureProperties_isUsed:1; + unsigned int PGPKeyID_isUsed:1; + unsigned int PGPData_isUsed:1; + unsigned int DSAKeyValue_isUsed:1; + unsigned int SignatureValue_isUsed:1; + unsigned int KeyInfo_isUsed:1; + unsigned int SignatureProperty_isUsed:1; + unsigned int PGPKeyPacket_isUsed:1; + unsigned int HMACOutputLength_isUsed:1; + unsigned int Exponent_isUsed:1; unsigned int Manifest_isUsed:1; + unsigned int P_isUsed:1; + unsigned int CanonicalizationMethod_isUsed:1; + unsigned int Q_isUsed:1; + unsigned int Seed_isUsed:1; + unsigned int X509SubjectName_isUsed:1; + unsigned int X509Certificate_isUsed:1; + unsigned int RSAKeyValue_isUsed:1; + unsigned int X509IssuerSerial_isUsed:1; + unsigned int SPKIData_isUsed:1; + unsigned int G_isUsed:1; + unsigned int J_isUsed:1; + unsigned int SignedInfo_isUsed:1; + unsigned int X509SKI_isUsed:1; + unsigned int Transform_isUsed:1; + unsigned int XPath_isUsed:1; + unsigned int Object_isUsed:1; + unsigned int X509SerialNumber_isUsed:1; + unsigned int RetrievalMethod_isUsed:1; + unsigned int Modulus_isUsed:1; + unsigned int X509CRL_isUsed:1; + unsigned int Signature_isUsed:1; + unsigned int Y_isUsed:1; + unsigned int SignatureMethod_isUsed:1; + unsigned int PgenCounter_isUsed:1; int _warning_; }; #endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ + /* Initialization methods for structs */ void init_xmldsigEXIDocument(struct xmldsigEXIDocument* exiDoc); #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES void init_xmldsigEXIFragment(struct xmldsigEXIFragment* exiFrag); #endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ -void init_xmldsigKeyValueType(struct xmldsigKeyValueType* xmldsigKeyValueType); -void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); -void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); -void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); void init_xmldsigCanonicalizationMethodType(struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType); +void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType); void init_xmldsigObjectType(struct xmldsigObjectType* xmldsigObjectType); -void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType); void init_xmldsigTransformType(struct xmldsigTransformType* xmldsigTransformType); +void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); void init_xmldsigDigestMethodType(struct xmldsigDigestMethodType* xmldsigDigestMethodType); +void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); +void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType); +void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); +void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType); +void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); +void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); +void init_xmldsigKeyValueType(struct xmldsigKeyValueType* xmldsigKeyValueType); +void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); +void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType); +void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType); +void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType); void init_xmldsigSignatureType(struct xmldsigSignatureType* xmldsigSignatureType); +void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); void init_xmldsigReferenceType(struct xmldsigReferenceType* xmldsigReferenceType); void init_xmldsigSPKIDataType(struct xmldsigSPKIDataType* xmldsigSPKIDataType); -void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType); -void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); -void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); -void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); -void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); -void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType); void init_xmldsigKeyInfoType(struct xmldsigKeyInfoType* xmldsigKeyInfoType); -void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType); -void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType); -void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType); #endif /* DEPLOY_XMLDSIG_CODEC */ diff --git a/src/xmldsig/xmldsigEXIDatatypesDecoder.c b/src/xmldsig/xmldsigEXIDatatypesDecoder.c index a66ee00..fd61f25 100644 --- a/src/xmldsig/xmldsigEXIDatatypesDecoder.c +++ b/src/xmldsig/xmldsigEXIDatatypesDecoder.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -48,78 +48,427 @@ static uint32_t eventCode; static int errn; static uint32_t uint32; - /* Forward Declarations */ -static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType); -static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); -static int decode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); -static int decode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); static int decode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType); +static int decode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType); static int decode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType); -static int decode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType); static int decode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType); +static int decode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); static int decode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType); +static int decode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); +static int decode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType); +static int decode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); +static int decode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType); +static int decode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); +static int decode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); +static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType); +static int decode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); +static int decode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType); +static int decode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType); +static int decode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType); static int decode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignatureType* xmldsigSignatureType); +static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigReferenceType* xmldsigReferenceType); static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDataType* xmldsigSPKIDataType); -static int decode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType); -static int decode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); -static int decode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); -static int decode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); -static int decode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); -static int decode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType); static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoType* xmldsigKeyInfoType); -static int decode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType); -static int decode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType); -static int decode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType); /* Deviant data decoding (skip functions) */ -static int decodeDeviationsCH(bitstream_t* stream) { - int i=0; - uint16_t uint16; - errn = 0; + + + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { + int grammarID = 0; + int done = 0; - errn = decodeUnsignedInteger16(stream, &uint16); - if (errn == 0) { - for(i=0; iAlgorithm.charactersLen); + if (errn == 0) { + if (xmldsigCanonicalizationMethodType->Algorithm.charactersLen >= 2) { + xmldsigCanonicalizationMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigCanonicalizationMethodType->Algorithm.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigCanonicalizationMethodType->Algorithm.charactersLen, xmldsigCanonicalizationMethodType->Algorithm.characters, xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 1; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 1: + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigCanonicalizationMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigCanonicalizationMethodType->ANY.charactersLen >= 2) { + xmldsigCanonicalizationMethodType->ANY.charactersLen = (uint16_t)(xmldsigCanonicalizationMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigCanonicalizationMethodType->ANY.charactersLen, xmldsigCanonicalizationMethodType->ANY.characters, xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigCanonicalizationMethodType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigCanonicalizationMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigCanonicalizationMethodType->ANY.charactersLen >= 2) { + xmldsigCanonicalizationMethodType->ANY.charactersLen = (uint16_t)(xmldsigCanonicalizationMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigCanonicalizationMethodType->ANY.charactersLen, xmldsigCanonicalizationMethodType->ANY.characters, xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigCanonicalizationMethodType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; } } return errn; } - - /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ -static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType) { - int grammarID = 0; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType) { + int grammarID = 4; int done = 0; - init_xmldsigKeyValueType(xmldsigKeyValueType); + init_xmldsigManifestType(xmldsigManifestType); while(!done) { switch(grammarID) { - case 0: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + case 4: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigManifestType->Id.charactersLen); + if (errn == 0) { + if (xmldsigManifestType->Id.charactersLen >= 2) { + xmldsigManifestType->Id.charactersLen = (uint16_t)(xmldsigManifestType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigManifestType->Id.charactersLen, xmldsigManifestType->Id.characters, xmldsigManifestType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigManifestType->Id_isUsed = 1u; + grammarID = 5; + break; + case 1: + if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { + errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 6; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 5: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { + errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 6; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 6: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { + errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 6; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any])){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int decode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType) { + int grammarID = 7; + int done = 0; + + init_xmldsigObjectType(xmldsigObjectType); + + while(!done) { + switch(grammarID) { + case 7: + /* FirstStartTag[ATTRIBUTE[STRING](Encoding), ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); if (errn == 0) { switch(eventCode) { case 0: - errn = decode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue); - xmldsigKeyValueType->DSAKeyValue_isUsed = 1u; - grammarID = 1; + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Encoding.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->Encoding.charactersLen >= 2) { + xmldsigObjectType->Encoding.charactersLen = (uint16_t)(xmldsigObjectType->Encoding.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->Encoding.charactersLen, xmldsigObjectType->Encoding.characters, xmldsigObjectType_Encoding_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->Encoding_isUsed = 1u; + grammarID = 8; break; case 1: - errn = decode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue); - xmldsigKeyValueType->RSAKeyValue_isUsed = 1u; + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Id.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->Id.charactersLen >= 2) { + xmldsigObjectType->Id.charactersLen = (uint16_t)(xmldsigObjectType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->Id.charactersLen, xmldsigObjectType->Id.characters, xmldsigObjectType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->Id_isUsed = 1u; + grammarID = 9; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->MimeType.charactersLen >= 2) { + xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters, xmldsigObjectType_MimeType_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->MimeType_isUsed = 1u; + grammarID = 1; + break; + case 3: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 4: + done = 1; + grammarID = 3; + break; + case 5: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->ANY.charactersLen >= 2) { + xmldsigObjectType->ANY.charactersLen = (uint16_t)(xmldsigObjectType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->ANY.charactersLen, xmldsigObjectType->ANY.characters, xmldsigObjectType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 8: + /* StartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Id.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->Id.charactersLen >= 2) { + xmldsigObjectType->Id.charactersLen = (uint16_t)(xmldsigObjectType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->Id.charactersLen, xmldsigObjectType->Id.characters, xmldsigObjectType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->Id_isUsed = 1u; + grammarID = 9; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->MimeType.charactersLen >= 2) { + xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters, xmldsigObjectType_MimeType_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->MimeType_isUsed = 1u; grammarID = 1; break; case 2: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 1; + grammarID = 2; break; case 3: - errn = decodeDeviationsCH(stream); + done = 1; + grammarID = 3; + break; + case 4: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->ANY.charactersLen >= 2) { + xmldsigObjectType->ANY.charactersLen = (uint16_t)(xmldsigObjectType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->ANY.charactersLen, xmldsigObjectType->ANY.characters, xmldsigObjectType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 9: + /* StartTag[ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->MimeType.charactersLen >= 2) { + xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters, xmldsigObjectType_MimeType_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->MimeType_isUsed = 1u; + grammarID = 1; + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 2: + done = 1; + grammarID = 3; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->ANY.charactersLen >= 2) { + xmldsigObjectType->ANY.charactersLen = (uint16_t)(xmldsigObjectType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->ANY.charactersLen, xmldsigObjectType->ANY.characters, xmldsigObjectType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->ANY_isUsed = 1u; grammarID = 2; break; default: @@ -129,6 +478,1346 @@ static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu } break; case 1: + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->ANY.charactersLen >= 2) { + xmldsigObjectType->ANY.charactersLen = (uint16_t)(xmldsigObjectType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->ANY.charactersLen, xmldsigObjectType->ANY.characters, xmldsigObjectType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigObjectType->ANY.charactersLen >= 2) { + xmldsigObjectType->ANY.charactersLen = (uint16_t)(xmldsigObjectType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigObjectType->ANY.charactersLen, xmldsigObjectType->ANY.characters, xmldsigObjectType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigObjectType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int decode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType) { + int grammarID = 10; + int done = 0; + + init_xmldsigTransformType(xmldsigTransformType); + + while(!done) { + switch(grammarID) { + case 10: + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->Algorithm.charactersLen); + if (errn == 0) { + if (xmldsigTransformType->Algorithm.charactersLen >= 2) { + xmldsigTransformType->Algorithm.charactersLen = (uint16_t)(xmldsigTransformType->Algorithm.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigTransformType->Algorithm.charactersLen, xmldsigTransformType->Algorithm.characters, xmldsigTransformType_Algorithm_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 11; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 11: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigTransformType->XPath.arrayLen < xmldsigTransformType_XPath_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen); + if (errn == 0) { + if (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen >= 2) { + xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen = (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].characters, xmldsigTransformType_XPath_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigTransformType->XPath.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 12; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 12; + break; + case 2: + done = 1; + grammarID = 3; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigTransformType->ANY.charactersLen >= 2) { + xmldsigTransformType->ANY.charactersLen = (uint16_t)(xmldsigTransformType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigTransformType->ANY.charactersLen, xmldsigTransformType->ANY.characters, xmldsigTransformType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigTransformType->ANY_isUsed = 1u; + grammarID = 12; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 12: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigTransformType->XPath.arrayLen < xmldsigTransformType_XPath_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen); + if (errn == 0) { + if (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen >= 2) { + xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen = (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].characters, xmldsigTransformType_XPath_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigTransformType->XPath.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 12; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 12; + break; + case 2: + done = 1; + grammarID = 3; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigTransformType->ANY.charactersLen >= 2) { + xmldsigTransformType->ANY.charactersLen = (uint16_t)(xmldsigTransformType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigTransformType->ANY.charactersLen, xmldsigTransformType->ANY.characters, xmldsigTransformType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigTransformType->ANY_isUsed = 1u; + grammarID = 12; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { + int grammarID = 13; + int done = 0; + + init_xmldsigSignatureMethodType(xmldsigSignatureMethodType); + + while(!done) { + switch(grammarID) { + case 13: + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureMethodType->Algorithm.charactersLen); + if (errn == 0) { + if (xmldsigSignatureMethodType->Algorithm.charactersLen >= 2) { + xmldsigSignatureMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigSignatureMethodType->Algorithm.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureMethodType->Algorithm.charactersLen, xmldsigSignatureMethodType->Algorithm.characters, xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 14; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 14: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* FirstStartTag[CHARACTERS[INTEGER]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeInteger64(stream, &xmldsigSignatureMethodType->HMACOutputLength); + xmldsigSignatureMethodType->HMACOutputLength_isUsed = 1u; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 2; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 2: + done = 1; + grammarID = 3; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignatureMethodType->ANY.charactersLen >= 2) { + xmldsigSignatureMethodType->ANY.charactersLen = (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureMethodType->ANY.charactersLen, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignatureMethodType->ANY_isUsed = 1u; + grammarID = 15; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignatureMethodType->ANY.charactersLen >= 2) { + xmldsigSignatureMethodType->ANY.charactersLen = (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureMethodType->ANY.charactersLen, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignatureMethodType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 15: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* FirstStartTag[CHARACTERS[INTEGER]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeInteger64(stream, &xmldsigSignatureMethodType->HMACOutputLength); + xmldsigSignatureMethodType->HMACOutputLength_isUsed = 1u; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 2; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 2: + done = 1; + grammarID = 3; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignatureMethodType->ANY.charactersLen >= 2) { + xmldsigSignatureMethodType->ANY.charactersLen = (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureMethodType->ANY.charactersLen, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignatureMethodType->ANY_isUsed = 1u; + grammarID = 15; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType) { + int grammarID = 0; + int done = 0; + + init_xmldsigDigestMethodType(xmldsigDigestMethodType); + + while(!done) { + switch(grammarID) { + case 0: + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigDigestMethodType->Algorithm.charactersLen); + if (errn == 0) { + if (xmldsigDigestMethodType->Algorithm.charactersLen >= 2) { + xmldsigDigestMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigDigestMethodType->Algorithm.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigDigestMethodType->Algorithm.charactersLen, xmldsigDigestMethodType->Algorithm.characters, xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 1; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 1: + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigDigestMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigDigestMethodType->ANY.charactersLen >= 2) { + xmldsigDigestMethodType->ANY.charactersLen = (uint16_t)(xmldsigDigestMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigDigestMethodType->ANY.charactersLen, xmldsigDigestMethodType->ANY.characters, xmldsigDigestMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigDigestMethodType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigDigestMethodType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigDigestMethodType->ANY.charactersLen >= 2) { + xmldsigDigestMethodType->ANY.charactersLen = (uint16_t)(xmldsigDigestMethodType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigDigestMethodType->ANY.charactersLen, xmldsigDigestMethodType->ANY.characters, xmldsigDigestMethodType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigDigestMethodType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { + int grammarID = 16; + int done = 0; + + init_xmldsigRetrievalMethodType(xmldsigRetrievalMethodType); + + while(!done) { + switch(grammarID) { + case 16: + /* FirstStartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->Type.charactersLen); + if (errn == 0) { + if (xmldsigRetrievalMethodType->Type.charactersLen >= 2) { + xmldsigRetrievalMethodType->Type.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->Type.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigRetrievalMethodType->Type.charactersLen, xmldsigRetrievalMethodType->Type.characters, xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigRetrievalMethodType->Type_isUsed = 1u; + grammarID = 17; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->URI.charactersLen); + if (errn == 0) { + if (xmldsigRetrievalMethodType->URI.charactersLen >= 2) { + xmldsigRetrievalMethodType->URI.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigRetrievalMethodType->URI.charactersLen, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigRetrievalMethodType->URI_isUsed = 1u; + grammarID = 18; + break; + case 2: + errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); + xmldsigRetrievalMethodType->Transforms_isUsed = 1u; + grammarID = 19; + break; + case 3: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 17: + /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->URI.charactersLen); + if (errn == 0) { + if (xmldsigRetrievalMethodType->URI.charactersLen >= 2) { + xmldsigRetrievalMethodType->URI.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigRetrievalMethodType->URI.charactersLen, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigRetrievalMethodType->URI_isUsed = 1u; + grammarID = 18; + break; + case 1: + errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); + xmldsigRetrievalMethodType->Transforms_isUsed = 1u; + grammarID = 19; + break; + case 2: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 18: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); + xmldsigRetrievalMethodType->Transforms_isUsed = 1u; + grammarID = 19; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 19: + /* Element[END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ +static int decode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType) { + int grammarID = 20; + int done = 0; + + init_xmldsigSignatureValueType(xmldsigSignatureValueType); + + while(!done) { + switch(grammarID) { + case 20: + /* FirstStartTag[ATTRIBUTE[STRING](Id), CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->Id.charactersLen); + if (errn == 0) { + if (xmldsigSignatureValueType->Id.charactersLen >= 2) { + xmldsigSignatureValueType->Id.charactersLen = (uint16_t)(xmldsigSignatureValueType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureValueType->Id.charactersLen, xmldsigSignatureValueType->Id.characters, xmldsigSignatureValueType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignatureValueType->Id_isUsed = 1u; + grammarID = 21; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->CONTENT.bytesLen); + if (errn == 0) { + errn = (xmldsigSignatureValueType->CONTENT.bytesLen) <= xmldsigSignatureValueType_CONTENT_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytesLen, xmldsigSignatureValueType->CONTENT.bytes); + } + grammarID = 19; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 21: + /* StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->CONTENT.bytesLen); + if (errn == 0) { + errn = (xmldsigSignatureValueType->CONTENT.bytesLen) <= xmldsigSignatureValueType_CONTENT_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytesLen, xmldsigSignatureValueType->CONTENT.bytes); + } + grammarID = 19; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 19: + /* Element[END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ +static int decode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { + int grammarID = 22; + int done = 0; + + init_xmldsigX509IssuerSerialType(xmldsigX509IssuerSerialType); + + while(!done) { + switch(grammarID) { + case 22: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509IssuerSerialType->X509IssuerName.charactersLen); + if (errn == 0) { + if (xmldsigX509IssuerSerialType->X509IssuerName.charactersLen >= 2) { + xmldsigX509IssuerSerialType->X509IssuerName.charactersLen = (uint16_t)(xmldsigX509IssuerSerialType->X509IssuerName.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigX509IssuerSerialType->X509IssuerName.charactersLen, xmldsigX509IssuerSerialType->X509IssuerName.characters, xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 23; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 23: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeInteger64(stream, &xmldsigX509IssuerSerialType->X509SerialNumber); + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 19; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 19: + /* Element[END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType) { + int grammarID = 24; + int done = 0; + + init_xmldsigSignedInfoType(xmldsigSignedInfoType); + + while(!done) { + switch(grammarID) { + case 24: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignedInfoType->Id.charactersLen); + if (errn == 0) { + if (xmldsigSignedInfoType->Id.charactersLen >= 2) { + xmldsigSignedInfoType->Id.charactersLen = (uint16_t)(xmldsigSignedInfoType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignedInfoType->Id.charactersLen, xmldsigSignedInfoType->Id.characters, xmldsigSignedInfoType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignedInfoType->Id_isUsed = 1u; + grammarID = 25; + break; + case 1: + errn = decode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod); + grammarID = 26; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 25: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod); + grammarID = 26; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 26: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigSignatureMethodType(stream, &xmldsigSignedInfoType->SignatureMethod); + grammarID = 27; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 27: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigSignedInfoType->Reference.arrayLen < xmldsigSignedInfoType_Reference_ARRAY_SIZE) { + errn = decode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array[xmldsigSignedInfoType->Reference.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 6; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 6: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigSignedInfoType->Reference.arrayLen < xmldsigSignedInfoType_Reference_ARRAY_SIZE) { + errn = decode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array[xmldsigSignedInfoType->Reference.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 6; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) { + int grammarID = 28; + int done = 0; + + init_xmldsigSignaturePropertiesType(xmldsigSignaturePropertiesType); + + while(!done) { + switch(grammarID) { + case 28: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertiesType->Id.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertiesType->Id.charactersLen >= 2) { + xmldsigSignaturePropertiesType->Id.charactersLen = (uint16_t)(xmldsigSignaturePropertiesType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertiesType->Id.charactersLen, xmldsigSignaturePropertiesType->Id.characters, xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignaturePropertiesType->Id_isUsed = 1u; + grammarID = 29; + break; + case 1: + if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { + errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 30; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 29: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { + errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 30; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 30: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { + errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 30; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int decode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { + int grammarID = 31; + int done = 0; + + init_xmldsigSignaturePropertyType(xmldsigSignaturePropertyType); + + while(!done) { + switch(grammarID) { + case 31: + /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Target)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Id.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->Id.charactersLen >= 2) { + xmldsigSignaturePropertyType->Id.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Id.charactersLen, xmldsigSignaturePropertyType->Id.characters, xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignaturePropertyType->Id_isUsed = 1u; + grammarID = 32; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Target.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->Target.charactersLen >= 2) { + xmldsigSignaturePropertyType->Target.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Target.charactersLen, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 33; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 32: + /* StartTag[ATTRIBUTE[STRING](Target)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Target.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->Target.charactersLen >= 2) { + xmldsigSignaturePropertyType->Target.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Target.charactersLen, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + grammarID = 33; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 33: + /* StartTag[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->ANY.charactersLen >= 2) { + xmldsigSignaturePropertyType->ANY.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->ANY.charactersLen, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignaturePropertyType->ANY_isUsed = 1u; + grammarID = 34; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + done = 1; + grammarID = 3; + break; + case 2: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->ANY.charactersLen >= 2) { + xmldsigSignaturePropertyType->ANY.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->ANY.charactersLen, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignaturePropertyType->ANY_isUsed = 1u; + grammarID = 2; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 34: + /* Element[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 2; + break; + case 1: + errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigSignaturePropertyType->ANY.charactersLen >= 2) { + xmldsigSignaturePropertyType->ANY.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignaturePropertyType->ANY.charactersLen, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignaturePropertyType->ANY_isUsed = 1u; + grammarID = 34; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ +static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType) { + int grammarID = 35; + int done = 0; + + init_xmldsigKeyValueType(xmldsigKeyValueType); + + while(!done) { + switch(grammarID) { + case 35: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue); + xmldsigKeyValueType->DSAKeyValue_isUsed = 1u; + grammarID = 36; + break; + case 1: + errn = decode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue); + xmldsigKeyValueType->RSAKeyValue_isUsed = 1u; + grammarID = 36; + break; + case 2: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 36; + break; + case 3: + errn = decodeUnsignedInteger16(stream, &xmldsigKeyValueType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyValueType->ANY.charactersLen >= 2) { + xmldsigKeyValueType->ANY.charactersLen = (uint16_t)(xmldsigKeyValueType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyValueType->ANY.charactersLen, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyValueType->ANY_isUsed = 1u; + grammarID = 37; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 36: /* Element[END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -138,7 +1827,18 @@ static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu grammarID = 3; break; case 1: - grammarID = 1; + errn = decodeUnsignedInteger16(stream, &xmldsigKeyValueType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyValueType->ANY.charactersLen >= 2) { + xmldsigKeyValueType->ANY.charactersLen = (uint16_t)(xmldsigKeyValueType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyValueType->ANY.charactersLen, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyValueType->ANY_isUsed = 1u; + grammarID = 36; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -146,7 +1846,7 @@ static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu } } break; - case 2: + case 37: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); if (errn == 0) { @@ -154,20 +1854,823 @@ static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu case 0: errn = decode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue); xmldsigKeyValueType->DSAKeyValue_isUsed = 1u; - grammarID = 1; + grammarID = 36; break; case 1: errn = decode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue); xmldsigKeyValueType->RSAKeyValue_isUsed = 1u; - grammarID = 1; + grammarID = 36; break; case 2: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 1; + grammarID = 36; break; case 3: - grammarID = 2; + errn = decodeUnsignedInteger16(stream, &xmldsigKeyValueType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyValueType->ANY.charactersLen >= 2) { + xmldsigKeyValueType->ANY.charactersLen = (uint16_t)(xmldsigKeyValueType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyValueType->ANY.charactersLen, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyValueType->ANY_isUsed = 1u; + grammarID = 37; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ +static int decode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { + int grammarID = 38; + int done = 0; + + init_xmldsigRSAKeyValueType(xmldsigRSAKeyValueType); + + while(!done) { + switch(grammarID) { + case 38: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigRSAKeyValueType->Modulus.bytesLen); + if (errn == 0) { + errn = (xmldsigRSAKeyValueType->Modulus.bytesLen) <= xmldsigRSAKeyValueType_Modulus_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigRSAKeyValueType->Modulus.bytesLen, xmldsigRSAKeyValueType->Modulus.bytes); + } + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 39; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 39: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigRSAKeyValueType->Exponent.bytesLen); + if (errn == 0) { + errn = (xmldsigRSAKeyValueType->Exponent.bytesLen) <= xmldsigRSAKeyValueType_Exponent_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigRSAKeyValueType->Exponent.bytesLen, xmldsigRSAKeyValueType->Exponent.bytes); + } + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 19; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 19: + /* Element[END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))', derivedBy='RESTRICTION'. */ +static int decode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType) { + int grammarID = 40; + int done = 0; + + init_xmldsigPGPDataType(xmldsigPGPDataType); + + while(!done) { + switch(grammarID) { + case 40: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyID.bytesLen); + if (errn == 0) { + errn = (xmldsigPGPDataType->PGPKeyID.bytesLen) <= xmldsigPGPDataType_PGPKeyID_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyID.bytesLen, xmldsigPGPDataType->PGPKeyID.bytes); + } + xmldsigPGPDataType->PGPKeyID_isUsed = 1u; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 41; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyPacket.bytesLen); + if (errn == 0) { + errn = (xmldsigPGPDataType->PGPKeyPacket.bytesLen) <= xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytesLen, xmldsigPGPDataType->PGPKeyPacket.bytes); + } + xmldsigPGPDataType->PGPKeyPacket_isUsed = 1u; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 42; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 41: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT_GENERIC, END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyPacket.bytesLen); + if (errn == 0) { + errn = (xmldsigPGPDataType->PGPKeyPacket.bytesLen) <= xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytesLen, xmldsigPGPDataType->PGPKeyPacket.bytes); + } + xmldsigPGPDataType->PGPKeyPacket_isUsed = 1u; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 42; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 1: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 42; + break; + case 2: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 42: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 42; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType) { + int grammarID = 43; + int done = 0; + + init_xmldsigTransformsType(xmldsigTransformsType); + + while(!done) { + switch(grammarID) { + case 43: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigTransformsType->Transform.arrayLen < xmldsigTransformsType_Transform_ARRAY_SIZE) { + errn = decode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array[xmldsigTransformsType->Transform.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 44; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 44: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigTransformsType->Transform.arrayLen < xmldsigTransformsType_Transform_ARRAY_SIZE) { + errn = decode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array[xmldsigTransformsType->Transform.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 44; + break; + case 1: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int decode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType) { + int grammarID = 45; + int done = 0; + + init_xmldsigX509DataType(xmldsigX509DataType); + + while(!done) { + switch(grammarID) { + case 45: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigX509DataType->X509IssuerSerial.arrayLen < xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE) { + errn = decode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array[xmldsigX509DataType->X509IssuerSerial.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 46; + break; + case 1: + if (xmldsigX509DataType->X509SKI.arrayLen < xmldsigX509DataType_X509SKI_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen) <= xmldsigX509DataType_X509SKI_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytes); + } + xmldsigX509DataType->X509SKI.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 2: + if (xmldsigX509DataType->X509SubjectName.arrayLen < xmldsigX509DataType_X509SubjectName_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen); + if (errn == 0) { + if (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen >= 2) { + xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen = (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].characters, xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigX509DataType->X509SubjectName.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 3: + if (xmldsigX509DataType->X509Certificate.arrayLen < xmldsigX509DataType_X509Certificate_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen) <= xmldsigX509DataType_X509Certificate_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytes); + } + xmldsigX509DataType->X509Certificate.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 4: + if (xmldsigX509DataType->X509CRL.arrayLen < xmldsigX509DataType_X509CRL_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen) <= xmldsigX509DataType_X509CRL_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytes); + } + xmldsigX509DataType->X509CRL.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 5: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 46; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 46: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC, END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigX509DataType->X509IssuerSerial.arrayLen < xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE) { + errn = decode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array[xmldsigX509DataType->X509IssuerSerial.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 46; + break; + case 1: + if (xmldsigX509DataType->X509SKI.arrayLen < xmldsigX509DataType_X509SKI_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen) <= xmldsigX509DataType_X509SKI_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytes); + } + xmldsigX509DataType->X509SKI.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 2: + if (xmldsigX509DataType->X509SubjectName.arrayLen < xmldsigX509DataType_X509SubjectName_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen); + if (errn == 0) { + if (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen >= 2) { + xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen = (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].characters, xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigX509DataType->X509SubjectName.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 3: + if (xmldsigX509DataType->X509Certificate.arrayLen < xmldsigX509DataType_X509Certificate_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen) <= xmldsigX509DataType_X509Certificate_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytes); + } + xmldsigX509DataType->X509Certificate.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 4: + if (xmldsigX509DataType->X509CRL.arrayLen < xmldsigX509DataType_X509CRL_ARRAY_SIZE) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(errn == 0) { + if(eventCode == 0) { + errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen); + if (errn == 0) { + errn = (xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen) <= xmldsigX509DataType_X509CRL_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; + } + if (errn == 0) { + errn = decodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytes); + } + xmldsigX509DataType->X509CRL.arrayLen++; + } else { + /* Second level event (e.g., xsi:type, xsi:nil, ...) */ + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + } + } + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + if(errn == 0) { + /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL) ? */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if(eventCode == 0) { + grammarID = 46; + } else { + errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ + } + } + break; + case 5: + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + /* TODO unsupported event : START_ELEMENT_GENERIC */ + grammarID = 46; + break; + case 6: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int decode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignatureType* xmldsigSignatureType) { + int grammarID = 47; + int done = 0; + + init_xmldsigSignatureType(xmldsigSignatureType); + + while(!done) { + switch(grammarID) { + case 47: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decodeUnsignedInteger16(stream, &xmldsigSignatureType->Id.charactersLen); + if (errn == 0) { + if (xmldsigSignatureType->Id.charactersLen >= 2) { + xmldsigSignatureType->Id.charactersLen = (uint16_t)(xmldsigSignatureType->Id.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigSignatureType->Id.charactersLen, xmldsigSignatureType->Id.characters, xmldsigSignatureType_Id_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigSignatureType->Id_isUsed = 1u; + grammarID = 48; + break; + case 1: + errn = decode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo); + grammarID = 49; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 48: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo); + grammarID = 49; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 49: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue)] */ + errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigSignatureValueType(stream, &xmldsigSignatureType->SignatureValue); + grammarID = 50; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 50: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + errn = decode_xmldsigKeyInfoType(stream, &xmldsigSignatureType->KeyInfo); + xmldsigSignatureType->KeyInfo_isUsed = 1u; + grammarID = 51; + break; + case 1: + if (xmldsigSignatureType->Object.arrayLen < xmldsigSignatureType_Object_ARRAY_SIZE) { + errn = decode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array[xmldsigSignatureType->Object.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 51; + break; + case 2: + done = 1; + grammarID = 3; + break; + default: + errn = EXI_ERROR_UNKOWN_EVENT_CODE; + break; + } + } + break; + case 51: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ + errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); + if (errn == 0) { + switch(eventCode) { + case 0: + if (xmldsigSignatureType->Object.arrayLen < xmldsigSignatureType_Object_ARRAY_SIZE) { + errn = decode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array[xmldsigSignatureType->Object.arrayLen++]); + } else { + errn = EXI_ERROR_OUT_OF_BOUNDS; + } + grammarID = 51; + break; + case 1: + done = 1; + grammarID = 3; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -188,14 +2691,14 @@ static int decode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu /* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType) { - int grammarID = 4; + int grammarID = 52; int done = 0; init_xmldsigDSAKeyValueType(xmldsigDSAKeyValueType); while(!done) { switch(grammarID) { - case 4: + case 52: /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -222,7 +2725,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 5; + grammarID = 53; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -250,7 +2753,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 6; + grammarID = 54; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -277,7 +2780,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 7; + grammarID = 55; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -289,7 +2792,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 5: + case 53: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -316,7 +2819,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 8; + grammarID = 56; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -328,7 +2831,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 8: + case 56: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -355,7 +2858,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 6; + grammarID = 54; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -382,7 +2885,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 7; + grammarID = 55; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -394,7 +2897,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 6: + case 54: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -420,7 +2923,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 7; + grammarID = 55; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -432,7 +2935,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 7: + case 55: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -459,7 +2962,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 9; + grammarID = 57; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -487,7 +2990,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 10; + grammarID = 58; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -503,7 +3006,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 9: + case 57: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -530,7 +3033,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 10; + grammarID = 58; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -546,7 +3049,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 10: + case 58: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -573,7 +3076,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 11; + grammarID = 19; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -585,7 +3088,7 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } } break; - case 11: + case 19: /* Element[END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -611,1075 +3114,70 @@ static int decode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ -static int decode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { - int grammarID = 12; - int done = 0; - - init_xmldsigRSAKeyValueType(xmldsigRSAKeyValueType); - - while(!done) { - switch(grammarID) { - case 12: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigRSAKeyValueType->Modulus.bytesLen); - if (errn == 0) { - errn = (xmldsigRSAKeyValueType->Modulus.bytesLen) <= xmldsigRSAKeyValueType_Modulus_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigRSAKeyValueType->Modulus.bytesLen, xmldsigRSAKeyValueType->Modulus.bytes); - } - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 13; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 13: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigRSAKeyValueType->Exponent.bytesLen); - if (errn == 0) { - errn = (xmldsigRSAKeyValueType->Exponent.bytesLen) <= xmldsigRSAKeyValueType_Exponent_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigRSAKeyValueType->Exponent.bytesLen, xmldsigRSAKeyValueType->Exponent.bytes); - } - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 11; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 11: - /* Element[END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) { - int grammarID = 14; - int done = 0; - - init_xmldsigSignaturePropertiesType(xmldsigSignaturePropertiesType); - - while(!done) { - switch(grammarID) { - case 14: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertiesType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigSignaturePropertiesType->Id.charactersLen - 2) <= xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignaturePropertiesType->Id.charactersLen >= 2) { - xmldsigSignaturePropertiesType->Id.charactersLen = (uint16_t)(xmldsigSignaturePropertiesType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignaturePropertiesType->Id.charactersLen, xmldsigSignaturePropertiesType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigSignaturePropertiesType->Id_isUsed = 1u; - grammarID = 15; - break; - case 1: - if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { - errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 16; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 15: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { - errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 16; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 16: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigSignaturePropertiesType->SignatureProperty.arrayLen < xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) { - errn = decode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array[xmldsigSignaturePropertiesType->SignatureProperty.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 16; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { - int grammarID = 17; - int done = 0; - - init_xmldsigCanonicalizationMethodType(xmldsigCanonicalizationMethodType); - - while(!done) { - switch(grammarID) { - case 17: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigCanonicalizationMethodType->Algorithm.charactersLen); - if (errn == 0) { - errn = (xmldsigCanonicalizationMethodType->Algorithm.charactersLen - 2) <= xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigCanonicalizationMethodType->Algorithm.charactersLen >= 2) { - xmldsigCanonicalizationMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigCanonicalizationMethodType->Algorithm.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigCanonicalizationMethodType->Algorithm.charactersLen, xmldsigCanonicalizationMethodType->Algorithm.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 18; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any])){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int decode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType) { - int grammarID = 20; - int done = 0; - - init_xmldsigObjectType(xmldsigObjectType); - - while(!done) { - switch(grammarID) { - case 20: - /* FirstStartTag[ATTRIBUTE[STRING](Encoding), ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Encoding.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->Encoding.charactersLen - 2) <= xmldsigObjectType_Encoding_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->Encoding.charactersLen >= 2) { - xmldsigObjectType->Encoding.charactersLen = (uint16_t)(xmldsigObjectType->Encoding.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->Encoding.charactersLen, xmldsigObjectType->Encoding.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->Encoding_isUsed = 1u; - grammarID = 21; - break; - case 1: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->Id.charactersLen - 2) <= xmldsigObjectType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->Id.charactersLen >= 2) { - xmldsigObjectType->Id.charactersLen = (uint16_t)(xmldsigObjectType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->Id.charactersLen, xmldsigObjectType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->Id_isUsed = 1u; - grammarID = 22; - break; - case 2: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->MimeType.charactersLen - 2) <= xmldsigObjectType_MimeType_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->MimeType.charactersLen >= 2) { - xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->MimeType_isUsed = 1u; - grammarID = 18; - break; - case 3: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 4: - done = 1; - grammarID = 3; - break; - case 5: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 21: - /* StartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->Id.charactersLen - 2) <= xmldsigObjectType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->Id.charactersLen >= 2) { - xmldsigObjectType->Id.charactersLen = (uint16_t)(xmldsigObjectType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->Id.charactersLen, xmldsigObjectType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->Id_isUsed = 1u; - grammarID = 22; - break; - case 1: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->MimeType.charactersLen - 2) <= xmldsigObjectType_MimeType_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->MimeType.charactersLen >= 2) { - xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->MimeType_isUsed = 1u; - grammarID = 18; - break; - case 2: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 3: - done = 1; - grammarID = 3; - break; - case 4: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 22: - /* StartTag[ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigObjectType->MimeType.charactersLen); - if (errn == 0) { - errn = (xmldsigObjectType->MimeType.charactersLen - 2) <= xmldsigObjectType_MimeType_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigObjectType->MimeType.charactersLen >= 2) { - xmldsigObjectType->MimeType.charactersLen = (uint16_t)(xmldsigObjectType->MimeType.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigObjectType->MimeType.charactersLen, xmldsigObjectType->MimeType.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigObjectType->MimeType_isUsed = 1u; - grammarID = 18; - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 2: - done = 1; - grammarID = 3; - break; - case 3: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType) { - int grammarID = 23; - int done = 0; - - init_xmldsigTransformsType(xmldsigTransformsType); - - while(!done) { - switch(grammarID) { - case 23: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigTransformsType->Transform.arrayLen < xmldsigTransformsType_Transform_ARRAY_SIZE) { - errn = decode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array[xmldsigTransformsType->Transform.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 24; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 24: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigTransformsType->Transform.arrayLen < xmldsigTransformsType_Transform_ARRAY_SIZE) { - errn = decode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array[xmldsigTransformsType->Transform.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 24; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int decode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType) { - int grammarID = 25; - int done = 0; - - init_xmldsigTransformType(xmldsigTransformType); - - while(!done) { - switch(grammarID) { - case 25: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->Algorithm.charactersLen); - if (errn == 0) { - errn = (xmldsigTransformType->Algorithm.charactersLen - 2) <= xmldsigTransformType_Algorithm_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigTransformType->Algorithm.charactersLen >= 2) { - xmldsigTransformType->Algorithm.charactersLen = (uint16_t)(xmldsigTransformType->Algorithm.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigTransformType->Algorithm.charactersLen, xmldsigTransformType->Algorithm.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 26; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 26: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigTransformType->XPath.arrayLen < xmldsigTransformType_XPath_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2) <= xmldsigTransformType_XPath_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen >= 2) { - xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen = (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigTransformType->XPath.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 27; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 27; - break; - case 2: - done = 1; - grammarID = 3; - break; - case 3: - grammarID = 27; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 27: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigTransformType->XPath.arrayLen < xmldsigTransformType_XPath_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2) <= xmldsigTransformType_XPath_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen >= 2) { - xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen = (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].charactersLen, xmldsigTransformType->XPath.array[xmldsigTransformType->XPath.arrayLen].characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigTransformType->XPath.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 27; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 27; - break; - case 2: - done = 1; - grammarID = 3; - break; - case 3: - grammarID = 27; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType) { - int grammarID = 17; - int done = 0; - - init_xmldsigDigestMethodType(xmldsigDigestMethodType); - - while(!done) { - switch(grammarID) { - case 17: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigDigestMethodType->Algorithm.charactersLen); - if (errn == 0) { - errn = (xmldsigDigestMethodType->Algorithm.charactersLen - 2) <= xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigDigestMethodType->Algorithm.charactersLen >= 2) { - xmldsigDigestMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigDigestMethodType->Algorithm.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigDigestMethodType->Algorithm.charactersLen, xmldsigDigestMethodType->Algorithm.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 18; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignatureType* xmldsigSignatureType) { - int grammarID = 28; - int done = 0; - - init_xmldsigSignatureType(xmldsigSignatureType); - - while(!done) { - switch(grammarID) { - case 28: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignatureType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigSignatureType->Id.charactersLen - 2) <= xmldsigSignatureType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignatureType->Id.charactersLen >= 2) { - xmldsigSignatureType->Id.charactersLen = (uint16_t)(xmldsigSignatureType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignatureType->Id.charactersLen, xmldsigSignatureType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigSignatureType->Id_isUsed = 1u; - grammarID = 29; - break; - case 1: - errn = decode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo); - grammarID = 30; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 29: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo); - grammarID = 30; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 30: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigSignatureValueType(stream, &xmldsigSignatureType->SignatureValue); - grammarID = 31; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 31: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigKeyInfoType(stream, &xmldsigSignatureType->KeyInfo); - xmldsigSignatureType->KeyInfo_isUsed = 1u; - grammarID = 32; - break; - case 1: - if (xmldsigSignatureType->Object.arrayLen < xmldsigSignatureType_Object_ARRAY_SIZE) { - errn = decode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array[xmldsigSignatureType->Object.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 32; - break; - case 2: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 32: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigSignatureType->Object.arrayLen < xmldsigSignatureType_Object_ARRAY_SIZE) { - errn = decode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array[xmldsigSignatureType->Object.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 32; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)', derivedBy='RESTRICTION'. */ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigReferenceType* xmldsigReferenceType) { - int grammarID = 33; + int grammarID = 59; int done = 0; init_xmldsigReferenceType(xmldsigReferenceType); while(!done) { switch(grammarID) { - case 33: + case 59: /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); if (errn == 0) { switch(eventCode) { case 0: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->Id.charactersLen - 2) <= xmldsigReferenceType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->Id.charactersLen >= 2) { xmldsigReferenceType->Id.charactersLen = (uint16_t)(xmldsigReferenceType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->Id.charactersLen, xmldsigReferenceType->Id.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->Id.charactersLen, xmldsigReferenceType->Id.characters, xmldsigReferenceType_Id_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->Id_isUsed = 1u; - grammarID = 34; + grammarID = 60; break; case 1: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->Type.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->Type.charactersLen - 2) <= xmldsigReferenceType_Type_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->Type.charactersLen >= 2) { xmldsigReferenceType->Type.charactersLen = (uint16_t)(xmldsigReferenceType->Type.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->Type.charactersLen, xmldsigReferenceType->Type.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->Type.charactersLen, xmldsigReferenceType->Type.characters, xmldsigReferenceType_Type_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->Type_isUsed = 1u; - grammarID = 35; + grammarID = 61; break; case 2: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->URI.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->URI.charactersLen - 2) <= xmldsigReferenceType_URI_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->URI.charactersLen >= 2) { xmldsigReferenceType->URI.charactersLen = (uint16_t)(xmldsigReferenceType->URI.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters, xmldsigReferenceType_URI_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->URI_isUsed = 1u; - grammarID = 36; + grammarID = 62; break; case 3: errn = decode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms); xmldsigReferenceType->Transforms_isUsed = 1u; - grammarID = 37; + grammarID = 63; break; case 4: errn = decode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod); - grammarID = 38; + grammarID = 64; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -1687,53 +3185,47 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 34: + case 60: /* StartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); if (errn == 0) { switch(eventCode) { case 0: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->Type.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->Type.charactersLen - 2) <= xmldsigReferenceType_Type_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->Type.charactersLen >= 2) { xmldsigReferenceType->Type.charactersLen = (uint16_t)(xmldsigReferenceType->Type.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->Type.charactersLen, xmldsigReferenceType->Type.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->Type.charactersLen, xmldsigReferenceType->Type.characters, xmldsigReferenceType_Type_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->Type_isUsed = 1u; - grammarID = 35; + grammarID = 61; break; case 1: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->URI.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->URI.charactersLen - 2) <= xmldsigReferenceType_URI_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->URI.charactersLen >= 2) { xmldsigReferenceType->URI.charactersLen = (uint16_t)(xmldsigReferenceType->URI.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters, xmldsigReferenceType_URI_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->URI_isUsed = 1u; - grammarID = 36; + grammarID = 62; break; case 2: errn = decode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms); xmldsigReferenceType->Transforms_isUsed = 1u; - grammarID = 37; + grammarID = 63; break; case 3: errn = decode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod); - grammarID = 38; + grammarID = 64; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -1741,36 +3233,33 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 35: + case 61: /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { switch(eventCode) { case 0: errn = decodeUnsignedInteger16(stream, &xmldsigReferenceType->URI.charactersLen); - if (errn == 0) { - errn = (xmldsigReferenceType->URI.charactersLen - 2) <= xmldsigReferenceType_URI_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigReferenceType->URI.charactersLen >= 2) { xmldsigReferenceType->URI.charactersLen = (uint16_t)(xmldsigReferenceType->URI.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters); + errn = decodeCharacters(stream, xmldsigReferenceType->URI.charactersLen, xmldsigReferenceType->URI.characters, xmldsigReferenceType_URI_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigReferenceType->URI_isUsed = 1u; - grammarID = 36; + grammarID = 62; break; case 1: errn = decode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms); xmldsigReferenceType->Transforms_isUsed = 1u; - grammarID = 37; + grammarID = 63; break; case 2: errn = decode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod); - grammarID = 38; + grammarID = 64; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -1778,7 +3267,7 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 36: + case 62: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -1786,11 +3275,11 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere case 0: errn = decode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms); xmldsigReferenceType->Transforms_isUsed = 1u; - grammarID = 37; + grammarID = 63; break; case 1: errn = decode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod); - grammarID = 38; + grammarID = 64; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -1798,14 +3287,14 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 37: + case 63: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { switch(eventCode) { case 0: errn = decode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod); - grammarID = 38; + grammarID = 64; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -1813,7 +3302,7 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 38: + case 64: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -1839,7 +3328,7 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 11; + grammarID = 19; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -1851,7 +3340,7 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere } } break; - case 11: + case 19: /* Element[END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -1879,14 +3368,14 @@ static int decode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDataType* xmldsigSPKIDataType) { - int grammarID = 39; + int grammarID = 65; int done = 0; init_xmldsigSPKIDataType(xmldsigSPKIDataType); while(!done) { switch(grammarID) { - case 39: + case 65: /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp)] */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if (errn == 0) { @@ -1917,7 +3406,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 40; + grammarID = 66; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -1929,7 +3418,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat } } break; - case 40: + case 66: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), START_ELEMENT_GENERIC, END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -1960,7 +3449,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 40; + grammarID = 66; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -1969,7 +3458,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat case 1: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 41; + grammarID = 67; break; case 2: done = 1; @@ -1981,7 +3470,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat } } break; - case 41: + case 67: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), END_ELEMENT] */ errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); if (errn == 0) { @@ -2012,7 +3501,7 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 40; + grammarID = 66; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -2039,884 +3528,33 @@ static int decode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))', derivedBy='RESTRICTION'. */ -static int decode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType) { - int grammarID = 42; - int done = 0; - - init_xmldsigPGPDataType(xmldsigPGPDataType); - - while(!done) { - switch(grammarID) { - case 42: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyID.bytesLen); - if (errn == 0) { - errn = (xmldsigPGPDataType->PGPKeyID.bytesLen) <= xmldsigPGPDataType_PGPKeyID_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyID.bytesLen, xmldsigPGPDataType->PGPKeyID.bytes); - } - xmldsigPGPDataType->PGPKeyID_isUsed = 1u; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 43; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyPacket.bytesLen); - if (errn == 0) { - errn = (xmldsigPGPDataType->PGPKeyPacket.bytesLen) <= xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytesLen, xmldsigPGPDataType->PGPKeyPacket.bytes); - } - xmldsigPGPDataType->PGPKeyPacket_isUsed = 1u; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 44; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 43: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT_GENERIC, END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigPGPDataType->PGPKeyPacket.bytesLen); - if (errn == 0) { - errn = (xmldsigPGPDataType->PGPKeyPacket.bytesLen) <= xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytesLen, xmldsigPGPDataType->PGPKeyPacket.bytes); - } - xmldsigPGPDataType->PGPKeyPacket_isUsed = 1u; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 44; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 44; - break; - case 2: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 44: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 44; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ -static int decode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { - int grammarID = 45; - int done = 0; - - init_xmldsigX509IssuerSerialType(xmldsigX509IssuerSerialType); - - while(!done) { - switch(grammarID) { - case 45: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509IssuerSerialType->X509IssuerName.charactersLen); - if (errn == 0) { - errn = (xmldsigX509IssuerSerialType->X509IssuerName.charactersLen - 2) <= xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigX509IssuerSerialType->X509IssuerName.charactersLen >= 2) { - xmldsigX509IssuerSerialType->X509IssuerName.charactersLen = (uint16_t)(xmldsigX509IssuerSerialType->X509IssuerName.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigX509IssuerSerialType->X509IssuerName.charactersLen, xmldsigX509IssuerSerialType->X509IssuerName.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 46; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 46: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeInteger64(stream, &xmldsigX509IssuerSerialType->X509SerialNumber); - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 11; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 11: - /* Element[END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { - int grammarID = 47; - int done = 0; - - init_xmldsigSignatureMethodType(xmldsigSignatureMethodType); - - while(!done) { - switch(grammarID) { - case 47: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignatureMethodType->Algorithm.charactersLen); - if (errn == 0) { - errn = (xmldsigSignatureMethodType->Algorithm.charactersLen - 2) <= xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignatureMethodType->Algorithm.charactersLen >= 2) { - xmldsigSignatureMethodType->Algorithm.charactersLen = (uint16_t)(xmldsigSignatureMethodType->Algorithm.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignatureMethodType->Algorithm.charactersLen, xmldsigSignatureMethodType->Algorithm.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 48; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 48: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* FirstStartTag[CHARACTERS[INTEGER]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeInteger64(stream, &xmldsigSignatureMethodType->HMACOutputLength); - xmldsigSignatureMethodType->HMACOutputLength_isUsed = 1u; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 19; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 2: - done = 1; - grammarID = 3; - break; - case 3: - grammarID = 49; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 49: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - /* FirstStartTag[CHARACTERS[INTEGER]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeInteger64(stream, &xmldsigSignatureMethodType->HMACOutputLength); - xmldsigSignatureMethodType->HMACOutputLength_isUsed = 1u; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 19; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 1: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 2: - done = 1; - grammarID = 3; - break; - case 3: - grammarID = 49; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { - int grammarID = 50; - int done = 0; - - init_xmldsigRetrievalMethodType(xmldsigRetrievalMethodType); - - while(!done) { - switch(grammarID) { - case 50: - /* FirstStartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->Type.charactersLen); - if (errn == 0) { - errn = (xmldsigRetrievalMethodType->Type.charactersLen - 2) <= xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigRetrievalMethodType->Type.charactersLen >= 2) { - xmldsigRetrievalMethodType->Type.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->Type.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigRetrievalMethodType->Type.charactersLen, xmldsigRetrievalMethodType->Type.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigRetrievalMethodType->Type_isUsed = 1u; - grammarID = 51; - break; - case 1: - errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->URI.charactersLen); - if (errn == 0) { - errn = (xmldsigRetrievalMethodType->URI.charactersLen - 2) <= xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigRetrievalMethodType->URI.charactersLen >= 2) { - xmldsigRetrievalMethodType->URI.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigRetrievalMethodType->URI.charactersLen, xmldsigRetrievalMethodType->URI.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigRetrievalMethodType->URI_isUsed = 1u; - grammarID = 52; - break; - case 2: - errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); - xmldsigRetrievalMethodType->Transforms_isUsed = 1u; - grammarID = 11; - break; - case 3: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 51: - /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigRetrievalMethodType->URI.charactersLen); - if (errn == 0) { - errn = (xmldsigRetrievalMethodType->URI.charactersLen - 2) <= xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigRetrievalMethodType->URI.charactersLen >= 2) { - xmldsigRetrievalMethodType->URI.charactersLen = (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigRetrievalMethodType->URI.charactersLen, xmldsigRetrievalMethodType->URI.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigRetrievalMethodType->URI_isUsed = 1u; - grammarID = 52; - break; - case 1: - errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); - xmldsigRetrievalMethodType->Transforms_isUsed = 1u; - grammarID = 11; - break; - case 2: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 52: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms); - xmldsigRetrievalMethodType->Transforms_isUsed = 1u; - grammarID = 11; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 11: - /* Element[END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int decode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { - int grammarID = 53; - int done = 0; - - init_xmldsigSignaturePropertyType(xmldsigSignaturePropertyType); - - while(!done) { - switch(grammarID) { - case 53: - /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Target)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigSignaturePropertyType->Id.charactersLen - 2) <= xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignaturePropertyType->Id.charactersLen >= 2) { - xmldsigSignaturePropertyType->Id.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Id.charactersLen, xmldsigSignaturePropertyType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigSignaturePropertyType->Id_isUsed = 1u; - grammarID = 54; - break; - case 1: - errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Target.charactersLen); - if (errn == 0) { - errn = (xmldsigSignaturePropertyType->Target.charactersLen - 2) <= xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignaturePropertyType->Target.charactersLen >= 2) { - xmldsigSignaturePropertyType->Target.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Target.charactersLen, xmldsigSignaturePropertyType->Target.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 55; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 54: - /* StartTag[ATTRIBUTE[STRING](Target)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignaturePropertyType->Target.charactersLen); - if (errn == 0) { - errn = (xmldsigSignaturePropertyType->Target.charactersLen - 2) <= xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignaturePropertyType->Target.charactersLen >= 2) { - xmldsigSignaturePropertyType->Target.charactersLen = (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignaturePropertyType->Target.charactersLen, xmldsigSignaturePropertyType->Target.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - grammarID = 55; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 55: - /* StartTag[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - grammarID = 56; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - done = 1; - grammarID = 3; - break; - case 2: - grammarID = 19; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 56: - /* Element[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 19; - break; - case 1: - grammarID = 56; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType) { - int grammarID = 57; - int done = 0; - - init_xmldsigSignedInfoType(xmldsigSignedInfoType); - - while(!done) { - switch(grammarID) { - case 57: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignedInfoType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigSignedInfoType->Id.charactersLen - 2) <= xmldsigSignedInfoType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignedInfoType->Id.charactersLen >= 2) { - xmldsigSignedInfoType->Id.charactersLen = (uint16_t)(xmldsigSignedInfoType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignedInfoType->Id.charactersLen, xmldsigSignedInfoType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigSignedInfoType->Id_isUsed = 1u; - grammarID = 58; - break; - case 1: - errn = decode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod); - grammarID = 59; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 58: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod); - grammarID = 59; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 59: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decode_xmldsigSignatureMethodType(stream, &xmldsigSignedInfoType->SignatureMethod); - grammarID = 60; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 60: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigSignedInfoType->Reference.arrayLen < xmldsigSignedInfoType_Reference_ARRAY_SIZE) { - errn = decode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array[xmldsigSignedInfoType->Reference.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 61; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 61: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigSignedInfoType->Reference.arrayLen < xmldsigSignedInfoType_Reference_ARRAY_SIZE) { - errn = decode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array[xmldsigSignedInfoType->Reference.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 61; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyInfoType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":KeyName|"http://www.w3.org/2000/09/xmldsig#":KeyValue|"http://www.w3.org/2000/09/xmldsig#":RetrievalMethod|"http://www.w3.org/2000/09/xmldsig#":X509Data|"http://www.w3.org/2000/09/xmldsig#":PGPData|"http://www.w3.org/2000/09/xmldsig#":SPKIData|"http://www.w3.org/2000/09/xmldsig#":MgmtData|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoType* xmldsigKeyInfoType) { - int grammarID = 62; + int grammarID = 68; int done = 0; init_xmldsigKeyInfoType(xmldsigKeyInfoType); while(!done) { switch(grammarID) { - case 62: + case 68: /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 4, &eventCode); if (errn == 0) { switch(eventCode) { case 0: errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->Id.charactersLen - 2) <= xmldsigKeyInfoType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->Id.charactersLen >= 2) { xmldsigKeyInfoType->Id.charactersLen = (uint16_t)(xmldsigKeyInfoType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->Id.charactersLen, xmldsigKeyInfoType->Id.characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->Id.charactersLen, xmldsigKeyInfoType->Id.characters, xmldsigKeyInfoType_Id_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } xmldsigKeyInfoType->Id_isUsed = 1u; - grammarID = 63; + grammarID = 69; break; case 1: if (xmldsigKeyInfoType->KeyName.arrayLen < xmldsigKeyInfoType_KeyName_ARRAY_SIZE) { @@ -2925,13 +3563,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters, xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -2950,7 +3585,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -2962,7 +3597,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 3: if (xmldsigKeyInfoType->RetrievalMethod.arrayLen < xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE) { @@ -2970,7 +3605,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 4: if (xmldsigKeyInfoType->X509Data.arrayLen < xmldsigKeyInfoType_X509Data_ARRAY_SIZE) { @@ -2978,7 +3613,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 5: if (xmldsigKeyInfoType->PGPData.arrayLen < xmldsigKeyInfoType_PGPData_ARRAY_SIZE) { @@ -2986,7 +3621,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 6: if (xmldsigKeyInfoType->SPKIData.arrayLen < xmldsigKeyInfoType_SPKIData_ARRAY_SIZE) { @@ -2994,7 +3629,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 7: if (xmldsigKeyInfoType->MgmtData.arrayLen < xmldsigKeyInfoType_MgmtData_ARRAY_SIZE) { @@ -3003,13 +3638,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters, xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3028,7 +3660,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3037,10 +3669,21 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT case 8: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 64; + grammarID = 70; break; case 9: - grammarID = 65; + errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyInfoType->ANY.charactersLen >= 2) { + xmldsigKeyInfoType->ANY.charactersLen = (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyInfoType->ANY.charactersLen, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyInfoType->ANY_isUsed = 1u; + grammarID = 71; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -3048,7 +3691,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } } break; - case 63: + case 69: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 4, &eventCode); if (errn == 0) { @@ -3060,13 +3703,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters, xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3085,7 +3725,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3097,7 +3737,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 2: if (xmldsigKeyInfoType->RetrievalMethod.arrayLen < xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE) { @@ -3105,7 +3745,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 3: if (xmldsigKeyInfoType->X509Data.arrayLen < xmldsigKeyInfoType_X509Data_ARRAY_SIZE) { @@ -3113,7 +3753,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 4: if (xmldsigKeyInfoType->PGPData.arrayLen < xmldsigKeyInfoType_PGPData_ARRAY_SIZE) { @@ -3121,7 +3761,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 5: if (xmldsigKeyInfoType->SPKIData.arrayLen < xmldsigKeyInfoType_SPKIData_ARRAY_SIZE) { @@ -3129,7 +3769,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 6: if (xmldsigKeyInfoType->MgmtData.arrayLen < xmldsigKeyInfoType_MgmtData_ARRAY_SIZE) { @@ -3138,13 +3778,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters, xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3163,7 +3800,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3172,10 +3809,21 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT case 7: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 64; + grammarID = 70; break; case 8: - grammarID = 65; + errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyInfoType->ANY.charactersLen >= 2) { + xmldsigKeyInfoType->ANY.charactersLen = (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyInfoType->ANY.charactersLen, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyInfoType->ANY_isUsed = 1u; + grammarID = 71; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -3183,7 +3831,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } } break; - case 64: + case 70: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 4, &eventCode); if (errn == 0) { @@ -3195,13 +3843,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters, xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3220,7 +3865,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3232,7 +3877,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 2: if (xmldsigKeyInfoType->RetrievalMethod.arrayLen < xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE) { @@ -3240,7 +3885,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 3: if (xmldsigKeyInfoType->X509Data.arrayLen < xmldsigKeyInfoType_X509Data_ARRAY_SIZE) { @@ -3248,7 +3893,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 4: if (xmldsigKeyInfoType->PGPData.arrayLen < xmldsigKeyInfoType_PGPData_ARRAY_SIZE) { @@ -3256,7 +3901,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 5: if (xmldsigKeyInfoType->SPKIData.arrayLen < xmldsigKeyInfoType_SPKIData_ARRAY_SIZE) { @@ -3264,7 +3909,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 6: if (xmldsigKeyInfoType->MgmtData.arrayLen < xmldsigKeyInfoType_MgmtData_ARRAY_SIZE) { @@ -3273,13 +3918,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters, xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3298,7 +3940,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3307,14 +3949,25 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT case 7: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 64; + grammarID = 70; break; case 8: done = 1; grammarID = 3; break; case 9: - grammarID = 64; + errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->ANY.charactersLen); + if (errn == 0) { + if (xmldsigKeyInfoType->ANY.charactersLen >= 2) { + xmldsigKeyInfoType->ANY.charactersLen = (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyInfoType->ANY.charactersLen, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType_ANY_CHARACTERS_SIZE); + } else { + /* string table hit */ + errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; + } + } + xmldsigKeyInfoType->ANY_isUsed = 1u; + grammarID = 70; break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; @@ -3322,7 +3975,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } } break; - case 65: + case 71: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ errn = decodeNBitUnsignedInteger(stream, 4, &eventCode); if (errn == 0) { @@ -3334,13 +3987,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].charactersLen, xmldsigKeyInfoType->KeyName.array[xmldsigKeyInfoType->KeyName.arrayLen].characters, xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3359,7 +4009,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3371,7 +4021,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 2: if (xmldsigKeyInfoType->RetrievalMethod.arrayLen < xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE) { @@ -3379,7 +4029,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 3: if (xmldsigKeyInfoType->X509Data.arrayLen < xmldsigKeyInfoType_X509Data_ARRAY_SIZE) { @@ -3387,7 +4037,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 4: if (xmldsigKeyInfoType->PGPData.arrayLen < xmldsigKeyInfoType_PGPData_ARRAY_SIZE) { @@ -3395,7 +4045,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 5: if (xmldsigKeyInfoType->SPKIData.arrayLen < xmldsigKeyInfoType_SPKIData_ARRAY_SIZE) { @@ -3403,7 +4053,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT } else { errn = EXI_ERROR_OUT_OF_BOUNDS; } - grammarID = 64; + grammarID = 70; break; case 6: if (xmldsigKeyInfoType->MgmtData.arrayLen < xmldsigKeyInfoType_MgmtData_ARRAY_SIZE) { @@ -3412,13 +4062,10 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2) <= xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen >= 2) { xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen = (uint16_t)(xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters); + errn = decodeCharacters(stream, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].charactersLen, xmldsigKeyInfoType->MgmtData.array[xmldsigKeyInfoType->MgmtData.arrayLen].characters, xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -3437,7 +4084,7 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData) ? */ errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); if(eventCode == 0) { - grammarID = 64; + grammarID = 70; } else { errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ } @@ -3446,543 +4093,22 @@ static int decode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT case 7: errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 64; + grammarID = 70; break; case 8: - grammarID = 65; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int decode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType) { - int grammarID = 66; - int done = 0; - - init_xmldsigManifestType(xmldsigManifestType); - - while(!done) { - switch(grammarID) { - case 66: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigManifestType->Id.charactersLen); + errn = decodeUnsignedInteger16(stream, &xmldsigKeyInfoType->ANY.charactersLen); if (errn == 0) { - errn = (xmldsigManifestType->Id.charactersLen - 2) <= xmldsigManifestType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigManifestType->Id.charactersLen >= 2) { - xmldsigManifestType->Id.charactersLen = (uint16_t)(xmldsigManifestType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigManifestType->Id.charactersLen, xmldsigManifestType->Id.characters); + if (xmldsigKeyInfoType->ANY.charactersLen >= 2) { + xmldsigKeyInfoType->ANY.charactersLen = (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen - 2); /* string table miss */ + errn = decodeCharacters(stream, xmldsigKeyInfoType->ANY.charactersLen, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType_ANY_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; } } - xmldsigManifestType->Id_isUsed = 1u; - grammarID = 67; - break; - case 1: - if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { - errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 61; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 67: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { - errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 61; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 61: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigManifestType->Reference.arrayLen < xmldsigManifestType_Reference_ARRAY_SIZE) { - errn = decode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array[xmldsigManifestType->Reference.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 61; - break; - case 1: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ -static int decode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType) { - int grammarID = 68; - int done = 0; - - init_xmldsigSignatureValueType(xmldsigSignatureValueType); - - while(!done) { - switch(grammarID) { - case 68: - /* FirstStartTag[ATTRIBUTE[STRING](Id), CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 2, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->Id.charactersLen); - if (errn == 0) { - errn = (xmldsigSignatureValueType->Id.charactersLen - 2) <= xmldsigSignatureValueType_Id_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigSignatureValueType->Id.charactersLen >= 2) { - xmldsigSignatureValueType->Id.charactersLen = (uint16_t)(xmldsigSignatureValueType->Id.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigSignatureValueType->Id.charactersLen, xmldsigSignatureValueType->Id.characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigSignatureValueType->Id_isUsed = 1u; - grammarID = 69; - break; - case 1: - errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->CONTENT.bytesLen); - if (errn == 0) { - errn = (xmldsigSignatureValueType->CONTENT.bytesLen) <= xmldsigSignatureValueType_CONTENT_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytesLen, xmldsigSignatureValueType->CONTENT.bytes); - } - grammarID = 11; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 69: - /* StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - errn = decodeUnsignedInteger16(stream, &xmldsigSignatureValueType->CONTENT.bytesLen); - if (errn == 0) { - errn = (xmldsigSignatureValueType->CONTENT.bytesLen) <= xmldsigSignatureValueType_CONTENT_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytesLen, xmldsigSignatureValueType->CONTENT.bytes); - } - grammarID = 11; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 11: - /* Element[END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - done = 1; - grammarID = 3; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int decode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType) { - int grammarID = 70; - int done = 0; - - init_xmldsigX509DataType(xmldsigX509DataType); - - while(!done) { - switch(grammarID) { - case 70: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigX509DataType->X509IssuerSerial.arrayLen < xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE) { - errn = decode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array[xmldsigX509DataType->X509IssuerSerial.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } + xmldsigKeyInfoType->ANY_isUsed = 1u; grammarID = 71; break; - case 1: - if (xmldsigX509DataType->X509SKI.arrayLen < xmldsigX509DataType_X509SKI_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen) <= xmldsigX509DataType_X509SKI_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytes); - } - xmldsigX509DataType->X509SKI.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 2: - if (xmldsigX509DataType->X509SubjectName.arrayLen < xmldsigX509DataType_X509SubjectName_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2) <= xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen >= 2) { - xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen = (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigX509DataType->X509SubjectName.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 3: - if (xmldsigX509DataType->X509Certificate.arrayLen < xmldsigX509DataType_X509Certificate_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen) <= xmldsigX509DataType_X509Certificate_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytes); - } - xmldsigX509DataType->X509Certificate.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 4: - if (xmldsigX509DataType->X509CRL.arrayLen < xmldsigX509DataType_X509CRL_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen) <= xmldsigX509DataType_X509CRL_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytes); - } - xmldsigX509DataType->X509CRL.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 5: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 71; - break; - default: - errn = EXI_ERROR_UNKOWN_EVENT_CODE; - break; - } - } - break; - case 71: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC, END_ELEMENT] */ - errn = decodeNBitUnsignedInteger(stream, 3, &eventCode); - if (errn == 0) { - switch(eventCode) { - case 0: - if (xmldsigX509DataType->X509IssuerSerial.arrayLen < xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE) { - errn = decode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array[xmldsigX509DataType->X509IssuerSerial.arrayLen++]); - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - grammarID = 71; - break; - case 1: - if (xmldsigX509DataType->X509SKI.arrayLen < xmldsigX509DataType_X509SKI_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen) <= xmldsigX509DataType_X509SKI_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytesLen, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType->X509SKI.arrayLen].bytes); - } - xmldsigX509DataType->X509SKI.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 2: - if (xmldsigX509DataType->X509SubjectName.arrayLen < xmldsigX509DataType_X509SubjectName_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2) <= xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } - if (errn == 0) { - if (xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen >= 2) { - xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen = (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].charactersLen, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType->X509SubjectName.arrayLen].characters); - } else { - /* string table hit */ - errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; - } - } - xmldsigX509DataType->X509SubjectName.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 3: - if (xmldsigX509DataType->X509Certificate.arrayLen < xmldsigX509DataType_X509Certificate_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen) <= xmldsigX509DataType_X509Certificate_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytesLen, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType->X509Certificate.arrayLen].bytes); - } - xmldsigX509DataType->X509Certificate.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 4: - if (xmldsigX509DataType->X509CRL.arrayLen < xmldsigX509DataType_X509CRL_ARRAY_SIZE) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(errn == 0) { - if(eventCode == 0) { - errn = decodeUnsignedInteger16(stream, &xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen); - if (errn == 0) { - errn = (xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen) <= xmldsigX509DataType_X509CRL_BYTES_SIZE ? 0 : EXI_ERROR_OUT_OF_BYTE_BUFFER; - } - if (errn == 0) { - errn = decodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytesLen, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType->X509CRL.arrayLen].bytes); - } - xmldsigX509DataType->X509CRL.arrayLen++; - } else { - /* Second level event (e.g., xsi:type, xsi:nil, ...) */ - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - } - } - } else { - errn = EXI_ERROR_OUT_OF_BOUNDS; - } - if(errn == 0) { - /* valid EE for simple element START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL) ? */ - errn = decodeNBitUnsignedInteger(stream, 1, &eventCode); - if(eventCode == 0) { - grammarID = 71; - } else { - errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */ - } - } - break; - case 5: - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - /* TODO unsupported event : START_ELEMENT_GENERIC */ - grammarID = 71; - break; - case 6: - done = 1; - grammarID = 3; - break; default: errn = EXI_ERROR_UNKOWN_EVENT_CODE; break; @@ -4059,13 +4185,10 @@ int decode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiDoc->KeyName.charactersLen); - if (errn == 0) { - errn = (exiDoc->KeyName.charactersLen - 2) <= EXIDocument_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiDoc->KeyName.charactersLen >= 2) { exiDoc->KeyName.charactersLen = (uint16_t)(exiDoc->KeyName.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiDoc->KeyName.charactersLen, exiDoc->KeyName.characters); + errn = decodeCharacters(stream, exiDoc->KeyName.charactersLen, exiDoc->KeyName.characters, EXIDocument_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4095,13 +4218,10 @@ int decode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiDoc->MgmtData.charactersLen); - if (errn == 0) { - errn = (exiDoc->MgmtData.charactersLen - 2) <= EXIDocument_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiDoc->MgmtData.charactersLen >= 2) { exiDoc->MgmtData.charactersLen = (uint16_t)(exiDoc->MgmtData.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiDoc->MgmtData.charactersLen, exiDoc->MgmtData.characters); + errn = decodeCharacters(stream, exiDoc->MgmtData.charactersLen, exiDoc->MgmtData.characters, EXIDocument_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4197,9 +4317,13 @@ int decode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* ex } + (void)exiDoc; /* avoid unused warning */ + (void)eventCode; /* avoid unused warning */ + (void)uint32; /* avoid unused warning */ + return errn; } - + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag) { errn = readEXIHeader(stream); @@ -4331,13 +4455,10 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiFrag->KeyName.charactersLen); - if (errn == 0) { - errn = (exiFrag->KeyName.charactersLen - 2) <= EXIFragment_KeyName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiFrag->KeyName.charactersLen >= 2) { exiFrag->KeyName.charactersLen = (uint16_t)(exiFrag->KeyName.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiFrag->KeyName.charactersLen, exiFrag->KeyName.characters); + errn = decodeCharacters(stream, exiFrag->KeyName.charactersLen, exiFrag->KeyName.characters, EXIFragment_KeyName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4367,13 +4488,10 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiFrag->MgmtData.charactersLen); - if (errn == 0) { - errn = (exiFrag->MgmtData.charactersLen - 2) <= EXIFragment_MgmtData_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiFrag->MgmtData.charactersLen >= 2) { exiFrag->MgmtData.charactersLen = (uint16_t)(exiFrag->MgmtData.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiFrag->MgmtData.charactersLen, exiFrag->MgmtData.characters); + errn = decodeCharacters(stream, exiFrag->MgmtData.charactersLen, exiFrag->MgmtData.characters, EXIFragment_MgmtData_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4652,13 +4770,10 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiFrag->X509IssuerName.charactersLen); - if (errn == 0) { - errn = (exiFrag->X509IssuerName.charactersLen - 2) <= EXIFragment_X509IssuerName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiFrag->X509IssuerName.charactersLen >= 2) { exiFrag->X509IssuerName.charactersLen = (uint16_t)(exiFrag->X509IssuerName.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiFrag->X509IssuerName.charactersLen, exiFrag->X509IssuerName.characters); + errn = decodeCharacters(stream, exiFrag->X509IssuerName.charactersLen, exiFrag->X509IssuerName.characters, EXIFragment_X509IssuerName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4717,13 +4832,10 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiFrag->X509SubjectName.charactersLen); - if (errn == 0) { - errn = (exiFrag->X509SubjectName.charactersLen - 2) <= EXIFragment_X509SubjectName_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiFrag->X509SubjectName.charactersLen >= 2) { exiFrag->X509SubjectName.charactersLen = (uint16_t)(exiFrag->X509SubjectName.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiFrag->X509SubjectName.charactersLen, exiFrag->X509SubjectName.characters); + errn = decodeCharacters(stream, exiFrag->X509SubjectName.charactersLen, exiFrag->X509SubjectName.characters, EXIFragment_X509SubjectName_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4743,13 +4855,10 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex if(errn == 0) { if(eventCode == 0) { errn = decodeUnsignedInteger16(stream, &exiFrag->XPath.charactersLen); - if (errn == 0) { - errn = (exiFrag->XPath.charactersLen - 2) <= EXIFragment_XPath_CHARACTERS_SIZE ? 0 : EXI_ERROR_STRINGVALUES_OUT_OF_BOUND; - } if (errn == 0) { if (exiFrag->XPath.charactersLen >= 2) { exiFrag->XPath.charactersLen = (uint16_t)(exiFrag->XPath.charactersLen - 2); /* string table miss */ - errn = decodeCharacters(stream, exiFrag->XPath.charactersLen, exiFrag->XPath.characters); + errn = decodeCharacters(stream, exiFrag->XPath.charactersLen, exiFrag->XPath.characters, EXIFragment_XPath_CHARACTERS_SIZE); } else { /* string table hit */ errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED; @@ -4797,10 +4906,13 @@ int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex } + (void)exiFrag; /* avoid unused warning */ + return errn; -} +} #endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ + #endif /* DEPLOY_XMLDSIG_CODEC */ #endif diff --git a/src/xmldsig/xmldsigEXIDatatypesDecoder.h b/src/xmldsig/xmldsigEXIDatatypesDecoder.h index 3843741..04b0440 100644 --- a/src/xmldsig/xmldsigEXIDatatypesDecoder.h +++ b/src/xmldsig/xmldsigEXIDatatypesDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -50,10 +50,10 @@ extern "C" { #include "xmldsigEXIDatatypes.h" int decode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* exiDoc); - + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag); -#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ +#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ #endif /* DEPLOY_XMLDSIG_CODEC */ diff --git a/src/xmldsig/xmldsigEXIDatatypesEncoder.c b/src/xmldsig/xmldsigEXIDatatypesEncoder.c index fef80c6..2e4f236 100644 --- a/src/xmldsig/xmldsigEXIDatatypesEncoder.c +++ b/src/xmldsig/xmldsigEXIDatatypesEncoder.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -46,97 +46,385 @@ static int errn; /* Forward Declarations */ -static int encode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType); -static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); -static int encode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); -static int encode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); static int encode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType); +static int encode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType); static int encode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType); -static int encode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType); static int encode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType); +static int encode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); static int encode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType); +static int encode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); +static int encode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType); +static int encode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); +static int encode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType); +static int encode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType); +static int encode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); +static int encode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType); +static int encode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType); +static int encode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType); +static int encode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType); +static int encode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType); static int encode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignatureType* xmldsigSignatureType); +static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType); static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigReferenceType* xmldsigReferenceType); static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDataType* xmldsigSPKIDataType); -static int encode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType); -static int encode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType); -static int encode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType); -static int encode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType); -static int encode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType); -static int encode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType); static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoType* xmldsigKeyInfoType); -static int encode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType); -static int encode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType); -static int encode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType); - /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ -static int encode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType) { + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { int grammarID = 0; int done = 0; + int wcDone = 0; while(!done) { switch(grammarID) { case 0: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigKeyValueType->DSAKeyValue_isUsed == 1u ) { + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigCanonicalizationMethodType->Algorithm.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigCanonicalizationMethodType->Algorithm.characters, xmldsigCanonicalizationMethodType->Algorithm.charactersLen); + } + } + grammarID = 1; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 1: + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigCanonicalizationMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigCanonicalizationMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigCanonicalizationMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigCanonicalizationMethodType->ANY.characters, xmldsigCanonicalizationMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigCanonicalizationMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigCanonicalizationMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigCanonicalizationMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigCanonicalizationMethodType->ANY.characters, xmldsigCanonicalizationMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType) { + int grammarID = 4; + int done = 0; + + unsigned int xmldsigManifestType_Reference_currArrayIndex = 0; + + while(!done) { + switch(grammarID) { + case 4: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + if ( xmldsigManifestType->Id_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigManifestType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigManifestType->Id.characters, xmldsigManifestType->Id.charactersLen); + } + } + grammarID = 5; + } else if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); + } + grammarID = 6; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 5: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); + } + grammarID = 6; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 6: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ + if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); + } + grammarID = 6; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any])){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int encode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType) { + int grammarID = 7; + int done = 0; + int wcDone = 0; + + + while(!done) { + switch(grammarID) { + case 7: + /* FirstStartTag[ATTRIBUTE[STRING](Encoding), ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigObjectType->Encoding_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 0); if(errn == 0) { - errn = encode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue ); + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Encoding.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->Encoding.characters, xmldsigObjectType->Encoding.charactersLen); + } } - grammarID = 1; - } else if ( xmldsigKeyValueType->RSAKeyValue_isUsed == 1u ) { + grammarID = 8; + } else if ( xmldsigObjectType->Id_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 1); if(errn == 0) { - errn = encode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue ); + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->Id.characters, xmldsigObjectType->Id.charactersLen); + } + } + grammarID = 9; + } else if ( xmldsigObjectType->MimeType_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); + } } grammarID = 1; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigObjectType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 4); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigObjectType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 5); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->ANY.characters, xmldsigObjectType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 8: + /* StartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigObjectType->Id_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->Id.characters, xmldsigObjectType->Id.charactersLen); + } + } + grammarID = 9; + } else if ( xmldsigObjectType->MimeType_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); + } + } grammarID = 1; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; grammarID = 2; + } else if ( xmldsigObjectType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigObjectType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 4); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->ANY.characters, xmldsigObjectType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 9: + /* StartTag[ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigObjectType->MimeType_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); + } + } + grammarID = 1; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigObjectType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigObjectType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->ANY.characters, xmldsigObjectType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; case 1: - /* Element[END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigObjectType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { done = 1; } grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 1; + } else if ( xmldsigObjectType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->ANY.characters, xmldsigObjectType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; case 2: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigKeyValueType->DSAKeyValue_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - errn = encode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue ); - } - grammarID = 1; - } else if ( xmldsigKeyValueType->RSAKeyValue_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - errn = encode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue ); - } - grammarID = 1; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 1; - } else if (1==0) { + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; grammarID = 2; + } else if ( xmldsigObjectType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigObjectType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigObjectType->ANY.characters, xmldsigObjectType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; } else { errn = EXI_ERROR_UNKOWN_EVENT; } @@ -152,226 +440,25 @@ static int encode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValu return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType) { - int grammarID = 4; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int encode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType) { + int grammarID = 10; int done = 0; + int wcDone = 0; + unsigned int xmldsigTransformType_XPath_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 4: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ - if ( xmldsigDSAKeyValueType->P_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->P.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->P.bytes, xmldsigDSAKeyValueType->P.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 5; - } else if ( xmldsigDSAKeyValueType->G_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->G.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->G.bytes, xmldsigDSAKeyValueType->G.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 6; - } else if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 2, 2); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 7; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 5: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q)] */ - if ( xmldsigDSAKeyValueType->Q_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Q.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Q.bytes, xmldsigDSAKeyValueType->Q.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 8; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 8: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ - if ( xmldsigDSAKeyValueType->G_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->G.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->G.bytes, xmldsigDSAKeyValueType->G.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 6; - } else if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 7; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 6: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 7; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 7: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ - if ( xmldsigDSAKeyValueType->J_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->J.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->J.bytes, xmldsigDSAKeyValueType->J.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 9; - } else if ( xmldsigDSAKeyValueType->Seed_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Seed.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Seed.bytes, xmldsigDSAKeyValueType->Seed.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 10; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 9: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ - if ( xmldsigDSAKeyValueType->Seed_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Seed.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->Seed.bytes, xmldsigDSAKeyValueType->Seed.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 10; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; case 10: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter)] */ - if ( xmldsigDSAKeyValueType->PgenCounter_isUsed == 1u ) { + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->PgenCounter.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigDSAKeyValueType->PgenCounter.bytes, xmldsigDSAKeyValueType->PgenCounter.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->Algorithm.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigTransformType->Algorithm.characters, xmldsigTransformType->Algorithm.charactersLen); } } grammarID = 11; @@ -380,6 +467,421 @@ static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK } break; case 11: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (xmldsigTransformType_XPath_currArrayIndex < xmldsigTransformType->XPath.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].characters, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen); + xmldsigTransformType_XPath_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 12; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 12; + } else if ( xmldsigTransformType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigTransformType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigTransformType->ANY.characters, xmldsigTransformType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 12; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 12: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (xmldsigTransformType_XPath_currArrayIndex < xmldsigTransformType->XPath.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].characters, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen); + xmldsigTransformType_XPath_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 12; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 12; + } else if ( xmldsigTransformType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigTransformType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigTransformType->ANY.characters, xmldsigTransformType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 12; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { + int grammarID = 13; + int done = 0; + int wcDone = 0; + + + while(!done) { + switch(grammarID) { + case 13: + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureMethodType->Algorithm.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignatureMethodType->Algorithm.characters, xmldsigSignatureMethodType->Algorithm.charactersLen); + } + } + grammarID = 14; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 14: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigSignatureMethodType->HMACOutputLength_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[INTEGER]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeInteger64(stream, xmldsigSignatureMethodType->HMACOutputLength); + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 2; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 15; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 15: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigSignatureMethodType->HMACOutputLength_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[INTEGER]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeInteger64(stream, xmldsigSignatureMethodType->HMACOutputLength); + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 2; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigSignatureMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignatureMethodType->ANY.characters, xmldsigSignatureMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 15; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType) { + int grammarID = 0; + int done = 0; + int wcDone = 0; + + + while(!done) { + switch(grammarID) { + case 0: + /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDigestMethodType->Algorithm.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigDigestMethodType->Algorithm.characters, xmldsigDigestMethodType->Algorithm.charactersLen); + } + } + grammarID = 1; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 1: + /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigDigestMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigDigestMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDigestMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigDigestMethodType->ANY.characters, xmldsigDigestMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 2: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 2; + } else if ( xmldsigDigestMethodType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigDigestMethodType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDigestMethodType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigDigestMethodType->ANY.characters, xmldsigDigestMethodType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { + int grammarID = 16; + int done = 0; + + + while(!done) { + switch(grammarID) { + case 16: + /* FirstStartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + if ( xmldsigRetrievalMethodType->Type_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->Type.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigRetrievalMethodType->Type.characters, xmldsigRetrievalMethodType->Type.charactersLen); + } + } + grammarID = 17; + } else if ( xmldsigRetrievalMethodType->URI_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType->URI.charactersLen); + } + } + grammarID = 18; + } else if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); + } + grammarID = 19; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 17: + /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + if ( xmldsigRetrievalMethodType->URI_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType->URI.charactersLen); + } + } + grammarID = 18; + } else if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); + } + grammarID = 19; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 18: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ + if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); + } + grammarID = 19; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 19: /* Element[END_ELEMENT] */ if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); @@ -402,57 +904,55 @@ static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAK return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ -static int encode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { - int grammarID = 12; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ +static int encode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType) { + int grammarID = 20; int done = 0; while(!done) { switch(grammarID) { - case 12: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); + case 20: + /* FirstStartTag[ATTRIBUTE[STRING](Id), CHARACTERS[BINARY_BASE64]] */ + if ( xmldsigSignatureValueType->Id_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRSAKeyValueType->Modulus.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigRSAKeyValueType->Modulus.bytes, xmldsigRSAKeyValueType->Modulus.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignatureValueType->Id.characters, xmldsigSignatureValueType->Id.charactersLen); } } - grammarID = 13; + grammarID = 21; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->CONTENT.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytes, xmldsigSignatureValueType->CONTENT.bytesLen); + } + } + grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 13: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent)] */ - if ( 1 == 1 ) { + case 21: + /* StartTag[CHARACTERS[BINARY_BASE64]] */ + if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { - /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRSAKeyValueType->Exponent.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigRSAKeyValueType->Exponent.bytes, xmldsigRSAKeyValueType->Exponent.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->CONTENT.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytes, xmldsigSignatureValueType->CONTENT.bytesLen); } } - grammarID = 11; + grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 11: + case 19: /* Element[END_ELEMENT] */ if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); @@ -475,16 +975,183 @@ static int encode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAK return errn; } +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ +static int encode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { + int grammarID = 22; + int done = 0; + + + while(!done) { + switch(grammarID) { + case 22: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509IssuerSerialType->X509IssuerName.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigX509IssuerSerialType->X509IssuerName.characters, xmldsigX509IssuerSerialType->X509IssuerName.charactersLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 23; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 23: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeInteger64(stream, xmldsigX509IssuerSerialType->X509SerialNumber); + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 19; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 19: + /* Element[END_ELEMENT] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType) { + int grammarID = 24; + int done = 0; + + unsigned int xmldsigSignedInfoType_Reference_currArrayIndex = 0; + + while(!done) { + switch(grammarID) { + case 24: + /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ + if ( xmldsigSignedInfoType->Id_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignedInfoType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignedInfoType->Id.characters, xmldsigSignedInfoType->Id.charactersLen); + } + } + grammarID = 25; + } else if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + errn = encode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod ); + } + grammarID = 26; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 25: + /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod ); + } + grammarID = 26; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 26: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encode_xmldsigSignatureMethodType(stream, &xmldsigSignedInfoType->SignatureMethod ); + } + grammarID = 27; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 27: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ + if (xmldsigSignedInfoType_Reference_currArrayIndex < xmldsigSignedInfoType->Reference.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array [xmldsigSignedInfoType_Reference_currArrayIndex++]); + } + grammarID = 6; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 6: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ + if (xmldsigSignedInfoType_Reference_currArrayIndex < xmldsigSignedInfoType->Reference.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + errn = encode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array [xmldsigSignedInfoType_Reference_currArrayIndex++]); + } + grammarID = 6; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ static int encode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) { - int grammarID = 14; + int grammarID = 28; int done = 0; unsigned int xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 14: + case 28: /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ if ( xmldsigSignaturePropertiesType->Id_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); @@ -495,37 +1162,37 @@ static int encode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xml errn = encodeCharacters(stream, xmldsigSignaturePropertiesType->Id.characters, xmldsigSignaturePropertiesType->Id.charactersLen); } } - grammarID = 15; + grammarID = 29; } else if (xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex < xmldsigSignaturePropertiesType->SignatureProperty.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { errn = encode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array [xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex++]); } - grammarID = 16; + grammarID = 30; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 15: + case 29: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty)] */ if (xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex < xmldsigSignaturePropertiesType->SignatureProperty.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { errn = encode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array [xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex++]); } - grammarID = 16; + grammarID = 30; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 16: + case 30: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), END_ELEMENT] */ if (xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex < xmldsigSignaturePropertiesType->SignatureProperty.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { errn = encode_xmldsigSignaturePropertyType(stream, &xmldsigSignaturePropertiesType->SignatureProperty.array [xmldsigSignaturePropertiesType_SignatureProperty_currArrayIndex++]); } - grammarID = 16; + grammarID = 30; } else if (1==1) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { @@ -547,62 +1214,119 @@ static int encode_xmldsigSignaturePropertiesType(bitstream_t* stream, struct xml return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) { - int grammarID = 17; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int encode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { + int grammarID = 31; int done = 0; + int wcDone = 0; while(!done) { switch(grammarID) { - case 17: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ + case 31: + /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Target)] */ + if ( xmldsigSignaturePropertyType->Id_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Id.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Id.characters, xmldsigSignaturePropertyType->Id.charactersLen); + } + } + grammarID = 32; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType->Target.charactersLen); + } + } + grammarID = 33; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 32: + /* StartTag[ATTRIBUTE[STRING](Target)] */ if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigCanonicalizationMethodType->Algorithm.charactersLen + 2)); + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen + 2)); if (errn == 0) { - errn = encodeCharacters(stream, xmldsigCanonicalizationMethodType->Algorithm.characters, xmldsigCanonicalizationMethodType->Algorithm.charactersLen); + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType->Target.charactersLen); } } - grammarID = 18; + grammarID = 33; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + case 33: + /* StartTag[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { + grammarID = 2; + } else if ( xmldsigSignaturePropertyType->ANY_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { - done = 1; + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType->ANY.charactersLen); + } } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; + wcDone = 1; + grammarID = 34; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 19: + case 2: /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { + grammarID = 2; + } else if ( xmldsigSignaturePropertyType->ANY_isUsed == 0u || wcDone ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { done = 1; } grammarID = 3; - } else if (1==0) { + } else if ( xmldsigSignaturePropertyType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 2; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 34: + /* Element[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; + grammarID = 2; + } else if ( xmldsigSignaturePropertyType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigSignaturePropertyType->ANY.characters, xmldsigSignaturePropertyType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 34; } else { errn = EXI_ERROR_UNKOWN_EVENT; } @@ -618,160 +1342,272 @@ static int encode_xmldsigCanonicalizationMethodType(bitstream_t* stream, struct return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##any])){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int encode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectType* xmldsigObjectType) { - int grammarID = 20; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))', derivedBy='RESTRICTION'. */ +static int encode_xmldsigKeyValueType(bitstream_t* stream, struct xmldsigKeyValueType* xmldsigKeyValueType) { + int grammarID = 35; + int done = 0; + int wcDone = 0; + + + while(!done) { + switch(grammarID) { + case 35: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigKeyValueType->DSAKeyValue_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + errn = encode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue ); + } + grammarID = 36; + } else if ( xmldsigKeyValueType->RSAKeyValue_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + errn = encode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue ); + } + grammarID = 36; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 36; + } else if ( xmldsigKeyValueType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyValueType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 37; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 36: + /* Element[END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigKeyValueType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else if ( xmldsigKeyValueType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyValueType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 36; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 37: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ + if ( xmldsigKeyValueType->DSAKeyValue_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + errn = encode_xmldsigDSAKeyValueType(stream, &xmldsigKeyValueType->DSAKeyValue ); + } + grammarID = 36; + } else if ( xmldsigKeyValueType->RSAKeyValue_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + errn = encode_xmldsigRSAKeyValueType(stream, &xmldsigKeyValueType->RSAKeyValue ); + } + grammarID = 36; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 36; + } else if ( xmldsigKeyValueType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyValueType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyValueType->ANY.characters, xmldsigKeyValueType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 37; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)', derivedBy='RESTRICTION'. */ +static int encode_xmldsigRSAKeyValueType(bitstream_t* stream, struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) { + int grammarID = 38; int done = 0; while(!done) { switch(grammarID) { - case 20: - /* FirstStartTag[ATTRIBUTE[STRING](Encoding), ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigObjectType->Encoding_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); + case 38: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Encoding.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->Encoding.characters, xmldsigObjectType->Encoding.charactersLen); + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRSAKeyValueType->Modulus.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigRSAKeyValueType->Modulus.bytes, xmldsigRSAKeyValueType->Modulus.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 21; - } else if ( xmldsigObjectType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Id.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->Id.characters, xmldsigObjectType->Id.charactersLen); - } - } - grammarID = 22; - } else if ( xmldsigObjectType->MimeType_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); - } - } - grammarID = 18; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 4); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; + grammarID = 39; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 21: - /* StartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigObjectType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); + case 39: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->Id.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->Id.characters, xmldsigObjectType->Id.charactersLen); + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRSAKeyValueType->Exponent.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigRSAKeyValueType->Exponent.bytes, xmldsigRSAKeyValueType->Exponent.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 22; - } else if ( xmldsigObjectType->MimeType_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); - } - } - grammarID = 18; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 3); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 22: - /* StartTag[ATTRIBUTE[STRING](MimeType), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigObjectType->MimeType_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigObjectType->MimeType.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigObjectType->MimeType.characters, xmldsigObjectType->MimeType.charactersLen); - } - } - grammarID = 18; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ + /* Element[END_ELEMENT] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))', derivedBy='RESTRICTION'. */ +static int encode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType) { + int grammarID = 40; + int done = 0; + int wcDone = 0; + + + while(!done) { + switch(grammarID) { + case 40: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket)] */ + if ( xmldsigPGPDataType->PGPKeyID_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyID.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyID.bytes, xmldsigPGPDataType->PGPKeyID.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 41; + } else if ( xmldsigPGPDataType->PGPKeyPacket_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyPacket.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytes, xmldsigPGPDataType->PGPKeyPacket.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 42; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 41: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT_GENERIC, END_ELEMENT] */ + if ( xmldsigPGPDataType->PGPKeyPacket_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyPacket.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytes, xmldsigPGPDataType->PGPKeyPacket.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 42; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 42; + } else if ( xmldsigPGPDataType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 42: + /* Element[START_ELEMENT_GENERIC, END_ELEMENT] */ if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { + grammarID = 42; + } else if ( xmldsigPGPDataType->ANY_isUsed == 0u || wcDone ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { done = 1; } grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } @@ -789,33 +1625,33 @@ static int encode_xmldsigObjectType(bitstream_t* stream, struct xmldsigObjectTyp /* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ static int encode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTransformsType* xmldsigTransformsType) { - int grammarID = 23; + int grammarID = 43; int done = 0; unsigned int xmldsigTransformsType_Transform_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 23: + case 43: /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform)] */ if (xmldsigTransformsType_Transform_currArrayIndex < xmldsigTransformsType->Transform.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { errn = encode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array [xmldsigTransformsType_Transform_currArrayIndex++]); } - grammarID = 24; + grammarID = 44; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 24: + case 44: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), END_ELEMENT] */ if (xmldsigTransformsType_Transform_currArrayIndex < xmldsigTransformsType->Transform.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { errn = encode_xmldsigTransformType(stream, &xmldsigTransformsType->Transform.array [xmldsigTransformsType_Transform_currArrayIndex++]); } - grammarID = 24; + grammarID = 44; } else if (1==1) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { @@ -837,168 +1673,182 @@ static int encode_xmldsigTransformsType(bitstream_t* stream, struct xmldsigTrans return errn; } -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int encode_xmldsigTransformType(bitstream_t* stream, struct xmldsigTransformType* xmldsigTransformType) { - int grammarID = 25; +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ +static int encode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType) { + int grammarID = 45; int done = 0; + int wcDone = 0; - unsigned int xmldsigTransformType_XPath_currArrayIndex = 0; + unsigned int xmldsigX509DataType_X509IssuerSerial_currArrayIndex = 0; + unsigned int xmldsigX509DataType_X509SKI_currArrayIndex = 0; + unsigned int xmldsigX509DataType_X509SubjectName_currArrayIndex = 0; + unsigned int xmldsigX509DataType_X509Certificate_currArrayIndex = 0; + unsigned int xmldsigX509DataType_X509CRL_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 25: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->Algorithm.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigTransformType->Algorithm.characters, xmldsigTransformType->Algorithm.charactersLen); - } - } - grammarID = 26; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 26: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (xmldsigTransformType_XPath_currArrayIndex < xmldsigTransformType->XPath.arrayLen ) { + case 45: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC] */ + if (xmldsigX509DataType_X509IssuerSerial_currArrayIndex < xmldsigX509DataType->X509IssuerSerial.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 3, 0); if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = encode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array [xmldsigX509DataType_X509IssuerSerial_currArrayIndex++]); + } + grammarID = 46; + } else if (xmldsigX509DataType_X509SKI_currArrayIndex < xmldsigX509DataType->X509SKI.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen + 2)); + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen)); if (errn == 0) { - errn = encodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].characters, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen); - xmldsigTransformType_XPath_currArrayIndex++; + errn = encodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytes, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen); + xmldsigX509DataType_X509SKI_currArrayIndex++; } /* valid EE */ errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 27; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 27; - } else if (1==1) { + grammarID = 46; + } else if (xmldsigX509DataType_X509SubjectName_currArrayIndex < xmldsigX509DataType->X509SubjectName.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 27; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 27: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (xmldsigTransformType_XPath_currArrayIndex < xmldsigTransformType->XPath.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); if(errn == 0) { /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen + 2)); + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen + 2)); if (errn == 0) { - errn = encodeCharacters(stream, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].characters, xmldsigTransformType->XPath.array[xmldsigTransformType_XPath_currArrayIndex].charactersLen); - xmldsigTransformType_XPath_currArrayIndex++; + errn = encodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].characters, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen); + xmldsigX509DataType_X509SubjectName_currArrayIndex++; } /* valid EE */ errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 27; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 27; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); + grammarID = 46; + } else if (xmldsigX509DataType_X509Certificate_currArrayIndex < xmldsigX509DataType->X509Certificate.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 27; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDigestMethodType* xmldsigDigestMethodType) { - int grammarID = 17; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 17: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDigestMethodType->Algorithm.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigDigestMethodType->Algorithm.characters, xmldsigDigestMethodType->Algorithm.charactersLen); + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytes, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen); + xmldsigX509DataType_X509Certificate_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 18; + grammarID = 46; + } else if (xmldsigX509DataType_X509CRL_currArrayIndex < xmldsigX509DataType->X509CRL.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 4); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytes, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen); + xmldsigX509DataType_X509CRL_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 46; + } else if (1==0) { + errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; + grammarID = 46; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 18: - /* StartTag[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { + case 46: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC, END_ELEMENT] */ + if (xmldsigX509DataType_X509IssuerSerial_currArrayIndex < xmldsigX509DataType->X509IssuerSerial.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 0); + if(errn == 0) { + errn = encode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array [xmldsigX509DataType_X509IssuerSerial_currArrayIndex++]); + } + grammarID = 46; + } else if (xmldsigX509DataType_X509SKI_currArrayIndex < xmldsigX509DataType->X509SKI.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 1); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytes, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen); + xmldsigX509DataType_X509SKI_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 46; + } else if (xmldsigX509DataType_X509SubjectName_currArrayIndex < xmldsigX509DataType->X509SubjectName.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 2); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].characters, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen); + xmldsigX509DataType_X509SubjectName_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 46; + } else if (xmldsigX509DataType_X509Certificate_currArrayIndex < xmldsigX509DataType->X509Certificate.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 3); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytes, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen); + xmldsigX509DataType_X509Certificate_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 46; + } else if (xmldsigX509DataType_X509CRL_currArrayIndex < xmldsigX509DataType->X509CRL.arrayLen ) { + errn = encodeNBitUnsignedInteger(stream, 3, 4); + if(errn == 0) { + /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytes, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen); + xmldsigX509DataType_X509CRL_currArrayIndex++; + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 46; + } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); + grammarID = 46; + } else if ( xmldsigX509DataType->ANY_isUsed == 0u || wcDone ) { + errn = encodeNBitUnsignedInteger(stream, 3, 6); if(errn == 0) { done = 1; } grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } @@ -1016,14 +1866,14 @@ static int encode_xmldsigDigestMethodType(bitstream_t* stream, struct xmldsigDig /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})', derivedBy='RESTRICTION'. */ static int encode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignatureType* xmldsigSignatureType) { - int grammarID = 28; + int grammarID = 47; int done = 0; unsigned int xmldsigSignatureType_Object_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 28: + case 47: /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ if ( xmldsigSignatureType->Id_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); @@ -1034,55 +1884,55 @@ static int encode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignat errn = encodeCharacters(stream, xmldsigSignatureType->Id.characters, xmldsigSignatureType->Id.charactersLen); } } - grammarID = 29; + grammarID = 48; } else if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { errn = encode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo ); } - grammarID = 30; + grammarID = 49; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 29: + case 48: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo)] */ if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { errn = encode_xmldsigSignedInfoType(stream, &xmldsigSignatureType->SignedInfo ); } - grammarID = 30; + grammarID = 49; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 30: + case 49: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue)] */ if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { errn = encode_xmldsigSignatureValueType(stream, &xmldsigSignatureType->SignatureValue ); } - grammarID = 31; + grammarID = 50; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 31: + case 50: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ if ( xmldsigSignatureType->KeyInfo_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { errn = encode_xmldsigKeyInfoType(stream, &xmldsigSignatureType->KeyInfo ); } - grammarID = 32; + grammarID = 51; } else if (xmldsigSignatureType_Object_currArrayIndex < xmldsigSignatureType->Object.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { errn = encode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array [xmldsigSignatureType_Object_currArrayIndex++]); } - grammarID = 32; + grammarID = 51; } else if (1==1) { errn = encodeNBitUnsignedInteger(stream, 2, 2); if(errn == 0) { @@ -1093,14 +1943,14 @@ static int encode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignat errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 32: + case 51: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), END_ELEMENT] */ if (xmldsigSignatureType_Object_currArrayIndex < xmldsigSignatureType->Object.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { errn = encode_xmldsigObjectType(stream, &xmldsigSignatureType->Object.array [xmldsigSignatureType_Object_currArrayIndex++]); } - grammarID = 32; + grammarID = 51; } else if (1==1) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { @@ -1122,15 +1972,265 @@ static int encode_xmldsigSignatureType(bitstream_t* stream, struct xmldsigSignat return errn; } +/* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})', derivedBy='RESTRICTION'. */ +static int encode_xmldsigDSAKeyValueType(bitstream_t* stream, struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType) { + int grammarID = 52; + int done = 0; + + + while(!done) { + switch(grammarID) { + case 52: + /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ + if ( xmldsigDSAKeyValueType->P_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->P.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->P.bytes, xmldsigDSAKeyValueType->P.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 53; + } else if ( xmldsigDSAKeyValueType->G_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->G.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->G.bytes, xmldsigDSAKeyValueType->G.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 54; + } else if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 55; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 53: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q)] */ + if ( xmldsigDSAKeyValueType->Q_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Q.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Q.bytes, xmldsigDSAKeyValueType->Q.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 56; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 56: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ + if ( xmldsigDSAKeyValueType->G_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->G.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->G.bytes, xmldsigDSAKeyValueType->G.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 54; + } else if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 55; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 54: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y)] */ + if ( 1 == 1 ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Y.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Y.bytes, xmldsigDSAKeyValueType->Y.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 55; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 55: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ + if ( xmldsigDSAKeyValueType->J_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->J.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->J.bytes, xmldsigDSAKeyValueType->J.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 57; + } else if ( xmldsigDSAKeyValueType->Seed_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Seed.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Seed.bytes, xmldsigDSAKeyValueType->Seed.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 58; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 2); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 57: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), END_ELEMENT] */ + if ( xmldsigDSAKeyValueType->Seed_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 2, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->Seed.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->Seed.bytes, xmldsigDSAKeyValueType->Seed.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 58; + } else if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 2, 1); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 58: + /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter)] */ + if ( xmldsigDSAKeyValueType->PgenCounter_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + /* FirstStartTag[CHARACTERS[BINARY_BASE64]] */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigDSAKeyValueType->PgenCounter.bytesLen)); + if (errn == 0) { + errn = encodeBytes(stream, xmldsigDSAKeyValueType->PgenCounter.bytes, xmldsigDSAKeyValueType->PgenCounter.bytesLen); + } + /* valid EE */ + errn = encodeNBitUnsignedInteger(stream, 1, 0); + } + } + grammarID = 19; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + case 19: + /* Element[END_ELEMENT] */ + if (1==1) { + errn = encodeNBitUnsignedInteger(stream, 1, 0); + if(errn == 0) { + done = 1; + } + grammarID = 3; + } else { + errn = EXI_ERROR_UNKOWN_EVENT; + } + break; + default: + errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; + break; + } + if(errn) { + done = 1; + } + } + return errn; +} + /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)', derivedBy='RESTRICTION'. */ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigReferenceType* xmldsigReferenceType) { - int grammarID = 33; + int grammarID = 59; int done = 0; while(!done) { switch(grammarID) { - case 33: + case 59: /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ if ( xmldsigReferenceType->Id_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 0); @@ -1141,7 +2241,7 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->Id.characters, xmldsigReferenceType->Id.charactersLen); } } - grammarID = 34; + grammarID = 60; } else if ( xmldsigReferenceType->Type_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 1); if(errn == 0) { @@ -1151,7 +2251,7 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->Type.characters, xmldsigReferenceType->Type.charactersLen); } } - grammarID = 35; + grammarID = 61; } else if ( xmldsigReferenceType->URI_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 2); if(errn == 0) { @@ -1161,24 +2261,24 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->URI.characters, xmldsigReferenceType->URI.charactersLen); } } - grammarID = 36; + grammarID = 62; } else if ( xmldsigReferenceType->Transforms_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 3); if(errn == 0) { errn = encode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms ); } - grammarID = 37; + grammarID = 63; } else if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 3, 4); if(errn == 0) { errn = encode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod ); } - grammarID = 38; + grammarID = 64; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 34: + case 60: /* StartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ if ( xmldsigReferenceType->Type_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 0); @@ -1189,7 +2289,7 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->Type.characters, xmldsigReferenceType->Type.charactersLen); } } - grammarID = 35; + grammarID = 61; } else if ( xmldsigReferenceType->URI_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 1); if(errn == 0) { @@ -1199,24 +2299,24 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->URI.characters, xmldsigReferenceType->URI.charactersLen); } } - grammarID = 36; + grammarID = 62; } else if ( xmldsigReferenceType->Transforms_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 3, 2); if(errn == 0) { errn = encode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms ); } - grammarID = 37; + grammarID = 63; } else if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 3, 3); if(errn == 0) { errn = encode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod ); } - grammarID = 38; + grammarID = 64; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 35: + case 61: /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ if ( xmldsigReferenceType->URI_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); @@ -1227,54 +2327,54 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeCharacters(stream, xmldsigReferenceType->URI.characters, xmldsigReferenceType->URI.charactersLen); } } - grammarID = 36; + grammarID = 62; } else if ( xmldsigReferenceType->Transforms_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { errn = encode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms ); } - grammarID = 37; + grammarID = 63; } else if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 2, 2); if(errn == 0) { errn = encode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod ); } - grammarID = 38; + grammarID = 64; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 36: + case 62: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ if ( xmldsigReferenceType->Transforms_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); if(errn == 0) { errn = encode_xmldsigTransformsType(stream, &xmldsigReferenceType->Transforms ); } - grammarID = 37; + grammarID = 63; } else if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { errn = encode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod ); } - grammarID = 38; + grammarID = 64; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 37: + case 63: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod)] */ if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); if(errn == 0) { errn = encode_xmldsigDigestMethodType(stream, &xmldsigReferenceType->DigestMethod ); } - grammarID = 38; + grammarID = 64; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 38: + case 64: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue)] */ if ( 1 == 1 ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); @@ -1290,12 +2390,12 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 11; + grammarID = 19; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 11: + case 19: /* Element[END_ELEMENT] */ if (1==1) { errn = encodeNBitUnsignedInteger(stream, 1, 0); @@ -1320,14 +2420,15 @@ static int encode_xmldsigReferenceType(bitstream_t* stream, struct xmldsigRefere /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDataType* xmldsigSPKIDataType) { - int grammarID = 39; + int grammarID = 65; int done = 0; + int wcDone = 0; unsigned int xmldsigSPKIDataType_SPKISexp_currArrayIndex = 0; while(!done) { switch(grammarID) { - case 39: + case 65: /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp)] */ if (xmldsigSPKIDataType_SPKISexp_currArrayIndex < xmldsigSPKIDataType->SPKISexp.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 1, 0); @@ -1344,12 +2445,12 @@ static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 40; + grammarID = 66; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 40: + case 66: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), START_ELEMENT_GENERIC, END_ELEMENT] */ if (xmldsigSPKIDataType_SPKISexp_currArrayIndex < xmldsigSPKIDataType->SPKISexp.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); @@ -1366,11 +2467,11 @@ static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 40; + grammarID = 66; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 41; - } else if (1==1) { + grammarID = 67; + } else if ( xmldsigSPKIDataType->ANY_isUsed == 0u || wcDone ) { errn = encodeNBitUnsignedInteger(stream, 2, 2); if(errn == 0) { done = 1; @@ -1380,7 +2481,7 @@ static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 41: + case 67: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), END_ELEMENT] */ if (xmldsigSPKIDataType_SPKISexp_currArrayIndex < xmldsigSPKIDataType->SPKISexp.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 2, 0); @@ -1397,606 +2498,8 @@ static int encode_xmldsigSPKIDataType(bitstream_t* stream, struct xmldsigSPKIDat errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 40; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))', derivedBy='RESTRICTION'. */ -static int encode_xmldsigPGPDataType(bitstream_t* stream, struct xmldsigPGPDataType* xmldsigPGPDataType) { - int grammarID = 42; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 42: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket)] */ - if ( xmldsigPGPDataType->PGPKeyID_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyID.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyID.bytes, xmldsigPGPDataType->PGPKeyID.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 43; - } else if ( xmldsigPGPDataType->PGPKeyPacket_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyPacket.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytes, xmldsigPGPDataType->PGPKeyPacket.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 44; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 43: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT_GENERIC, END_ELEMENT] */ - if ( xmldsigPGPDataType->PGPKeyPacket_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigPGPDataType->PGPKeyPacket.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigPGPDataType->PGPKeyPacket.bytes, xmldsigPGPDataType->PGPKeyPacket.bytesLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 44; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 44; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 44: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 44; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)', derivedBy='RESTRICTION'. */ -static int encode_xmldsigX509IssuerSerialType(bitstream_t* stream, struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) { - int grammarID = 45; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 45: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509IssuerSerialType->X509IssuerName.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigX509IssuerSerialType->X509IssuerName.characters, xmldsigX509IssuerSerialType->X509IssuerName.charactersLen); - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 46; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 46: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[INTEGER]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeInteger64(stream, xmldsigX509IssuerSerialType->X509SerialNumber); - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 11; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 11: - /* Element[END_ELEMENT] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigSignatureMethodType(bitstream_t* stream, struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) { - int grammarID = 47; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 47: - /* FirstStartTag[ATTRIBUTE[STRING](Algorithm)] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureMethodType->Algorithm.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignatureMethodType->Algorithm.characters, xmldsigSignatureMethodType->Algorithm.charactersLen); - } - } - grammarID = 48; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 48: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigSignatureMethodType->HMACOutputLength_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[INTEGER]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeInteger64(stream, xmldsigSignatureMethodType->HMACOutputLength); - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 19; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 49; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 49: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if ( xmldsigSignatureMethodType->HMACOutputLength_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - /* FirstStartTag[CHARACTERS[INTEGER]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeInteger64(stream, xmldsigSignatureMethodType->HMACOutputLength); - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 19; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 49; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigRetrievalMethodType(bitstream_t* stream, struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) { - int grammarID = 50; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 50: - /* FirstStartTag[ATTRIBUTE[STRING](Type), ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - if ( xmldsigRetrievalMethodType->Type_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->Type.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigRetrievalMethodType->Type.characters, xmldsigRetrievalMethodType->Type.charactersLen); - } - } - grammarID = 51; - } else if ( xmldsigRetrievalMethodType->URI_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType->URI.charactersLen); - } - } - grammarID = 52; - } else if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); - } - grammarID = 11; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 3); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 51: - /* StartTag[ATTRIBUTE[STRING](URI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - if ( xmldsigRetrievalMethodType->URI_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigRetrievalMethodType->URI.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigRetrievalMethodType->URI.characters, xmldsigRetrievalMethodType->URI.charactersLen); - } - } - grammarID = 52; - } else if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); - } - grammarID = 11; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 2); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 52: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), END_ELEMENT] */ - if ( xmldsigRetrievalMethodType->Transforms_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - errn = encode_xmldsigTransformsType(stream, &xmldsigRetrievalMethodType->Transforms ); - } - grammarID = 11; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 11: - /* Element[END_ELEMENT] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int encode_xmldsigSignaturePropertyType(bitstream_t* stream, struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) { - int grammarID = 53; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 53: - /* FirstStartTag[ATTRIBUTE[STRING](Id), ATTRIBUTE[STRING](Target)] */ - if ( xmldsigSignaturePropertyType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Id.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Id.characters, xmldsigSignaturePropertyType->Id.charactersLen); - } - } - grammarID = 54; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType->Target.charactersLen); - } - } - grammarID = 55; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 54: - /* StartTag[ATTRIBUTE[STRING](Target)] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignaturePropertyType->Target.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignaturePropertyType->Target.characters, xmldsigSignaturePropertyType->Target.charactersLen); - } - } - grammarID = 55; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 55: - /* StartTag[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 56; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 19: - /* Element[START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 56: - /* Element[START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ - if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 19; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 56; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSignedInfoType* xmldsigSignedInfoType) { - int grammarID = 57; - int done = 0; - - unsigned int xmldsigSignedInfoType_Reference_currArrayIndex = 0; - - while(!done) { - switch(grammarID) { - case 57: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ - if ( xmldsigSignedInfoType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignedInfoType->Id.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignedInfoType->Id.characters, xmldsigSignedInfoType->Id.charactersLen); - } - } - grammarID = 58; - } else if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - errn = encode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod ); - } - grammarID = 59; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 58: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encode_xmldsigCanonicalizationMethodType(stream, &xmldsigSignedInfoType->CanonicalizationMethod ); - } - grammarID = 59; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 59: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod)] */ - if ( 1 == 1 ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encode_xmldsigSignatureMethodType(stream, &xmldsigSignedInfoType->SignatureMethod ); - } - grammarID = 60; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 60: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - if (xmldsigSignedInfoType_Reference_currArrayIndex < xmldsigSignedInfoType->Reference.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array [xmldsigSignedInfoType_Reference_currArrayIndex++]); - } - grammarID = 61; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 61: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ - if (xmldsigSignedInfoType_Reference_currArrayIndex < xmldsigSignedInfoType->Reference.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - errn = encode_xmldsigReferenceType(stream, &xmldsigSignedInfoType->Reference.array [xmldsigSignedInfoType_Reference_currArrayIndex++]); - } - grammarID = 61; - } else if (1==1) { + grammarID = 66; + } else if ( xmldsigSPKIDataType->ANY_isUsed == 0u || wcDone ) { errn = encodeNBitUnsignedInteger(stream, 2, 1); if(errn == 0) { done = 1; @@ -2019,8 +2522,9 @@ static int encode_xmldsigSignedInfoType(bitstream_t* stream, struct xmldsigSigne /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyInfoType', base type name='anyType', content type='MIXED', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":KeyName|"http://www.w3.org/2000/09/xmldsig#":KeyValue|"http://www.w3.org/2000/09/xmldsig#":RetrievalMethod|"http://www.w3.org/2000/09/xmldsig#":X509Data|"http://www.w3.org/2000/09/xmldsig#":PGPData|"http://www.w3.org/2000/09/xmldsig#":SPKIData|"http://www.w3.org/2000/09/xmldsig#":MgmtData|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoType* xmldsigKeyInfoType) { - int grammarID = 62; + int grammarID = 68; int done = 0; + int wcDone = 0; unsigned int xmldsigKeyInfoType_KeyName_currArrayIndex = 0; unsigned int xmldsigKeyInfoType_KeyValue_currArrayIndex = 0; @@ -2032,7 +2536,7 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT while(!done) { switch(grammarID) { - case 62: + case 68: /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ if ( xmldsigKeyInfoType->Id_isUsed == 1u ) { errn = encodeNBitUnsignedInteger(stream, 4, 0); @@ -2043,7 +2547,7 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeCharacters(stream, xmldsigKeyInfoType->Id.characters, xmldsigKeyInfoType->Id.charactersLen); } } - grammarID = 63; + grammarID = 69; } else if (xmldsigKeyInfoType_KeyName_currArrayIndex < xmldsigKeyInfoType->KeyName.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 1); if(errn == 0) { @@ -2060,37 +2564,37 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_KeyValue_currArrayIndex < xmldsigKeyInfoType->KeyValue.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 2); if(errn == 0) { errn = encode_xmldsigKeyValueType(stream, &xmldsigKeyInfoType->KeyValue.array [xmldsigKeyInfoType_KeyValue_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_RetrievalMethod_currArrayIndex < xmldsigKeyInfoType->RetrievalMethod.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 3); if(errn == 0) { errn = encode_xmldsigRetrievalMethodType(stream, &xmldsigKeyInfoType->RetrievalMethod.array [xmldsigKeyInfoType_RetrievalMethod_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_X509Data_currArrayIndex < xmldsigKeyInfoType->X509Data.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 4); if(errn == 0) { errn = encode_xmldsigX509DataType(stream, &xmldsigKeyInfoType->X509Data.array [xmldsigKeyInfoType_X509Data_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_PGPData_currArrayIndex < xmldsigKeyInfoType->PGPData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 5); if(errn == 0) { errn = encode_xmldsigPGPDataType(stream, &xmldsigKeyInfoType->PGPData.array [xmldsigKeyInfoType_PGPData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_SPKIData_currArrayIndex < xmldsigKeyInfoType->SPKIData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 6); if(errn == 0) { errn = encode_xmldsigSPKIDataType(stream, &xmldsigKeyInfoType->SPKIData.array [xmldsigKeyInfoType_SPKIData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_MgmtData_currArrayIndex < xmldsigKeyInfoType->MgmtData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 7); if(errn == 0) { @@ -2107,18 +2611,26 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 64; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 65; + grammarID = 70; + } else if ( xmldsigKeyInfoType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 4, 9); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 71; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 63: + case 69: /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ if (xmldsigKeyInfoType_KeyName_currArrayIndex < xmldsigKeyInfoType->KeyName.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 0); @@ -2136,37 +2648,37 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_KeyValue_currArrayIndex < xmldsigKeyInfoType->KeyValue.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 1); if(errn == 0) { errn = encode_xmldsigKeyValueType(stream, &xmldsigKeyInfoType->KeyValue.array [xmldsigKeyInfoType_KeyValue_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_RetrievalMethod_currArrayIndex < xmldsigKeyInfoType->RetrievalMethod.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 2); if(errn == 0) { errn = encode_xmldsigRetrievalMethodType(stream, &xmldsigKeyInfoType->RetrievalMethod.array [xmldsigKeyInfoType_RetrievalMethod_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_X509Data_currArrayIndex < xmldsigKeyInfoType->X509Data.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 3); if(errn == 0) { errn = encode_xmldsigX509DataType(stream, &xmldsigKeyInfoType->X509Data.array [xmldsigKeyInfoType_X509Data_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_PGPData_currArrayIndex < xmldsigKeyInfoType->PGPData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 4); if(errn == 0) { errn = encode_xmldsigPGPDataType(stream, &xmldsigKeyInfoType->PGPData.array [xmldsigKeyInfoType_PGPData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_SPKIData_currArrayIndex < xmldsigKeyInfoType->SPKIData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 5); if(errn == 0) { errn = encode_xmldsigSPKIDataType(stream, &xmldsigKeyInfoType->SPKIData.array [xmldsigKeyInfoType_SPKIData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_MgmtData_currArrayIndex < xmldsigKeyInfoType->MgmtData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 6); if(errn == 0) { @@ -2183,18 +2695,26 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 64; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 65; + grammarID = 70; + } else if ( xmldsigKeyInfoType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 4, 8); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 71; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 64: + case 70: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, END_ELEMENT, CHARACTERS_GENERIC[STRING]] */ if (xmldsigKeyInfoType_KeyName_currArrayIndex < xmldsigKeyInfoType->KeyName.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 0); @@ -2212,37 +2732,37 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_KeyValue_currArrayIndex < xmldsigKeyInfoType->KeyValue.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 1); if(errn == 0) { errn = encode_xmldsigKeyValueType(stream, &xmldsigKeyInfoType->KeyValue.array [xmldsigKeyInfoType_KeyValue_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_RetrievalMethod_currArrayIndex < xmldsigKeyInfoType->RetrievalMethod.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 2); if(errn == 0) { errn = encode_xmldsigRetrievalMethodType(stream, &xmldsigKeyInfoType->RetrievalMethod.array [xmldsigKeyInfoType_RetrievalMethod_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_X509Data_currArrayIndex < xmldsigKeyInfoType->X509Data.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 3); if(errn == 0) { errn = encode_xmldsigX509DataType(stream, &xmldsigKeyInfoType->X509Data.array [xmldsigKeyInfoType_X509Data_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_PGPData_currArrayIndex < xmldsigKeyInfoType->PGPData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 4); if(errn == 0) { errn = encode_xmldsigPGPDataType(stream, &xmldsigKeyInfoType->PGPData.array [xmldsigKeyInfoType_PGPData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_SPKIData_currArrayIndex < xmldsigKeyInfoType->SPKIData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 5); if(errn == 0) { errn = encode_xmldsigSPKIDataType(stream, &xmldsigKeyInfoType->SPKIData.array [xmldsigKeyInfoType_SPKIData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_MgmtData_currArrayIndex < xmldsigKeyInfoType->MgmtData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 6); if(errn == 0) { @@ -2259,24 +2779,32 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 64; - } else if (1==1) { + grammarID = 70; + } else if ( xmldsigKeyInfoType->ANY_isUsed == 0u || wcDone ) { errn = encodeNBitUnsignedInteger(stream, 4, 8); if(errn == 0) { done = 1; } grammarID = 3; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 64; + } else if ( xmldsigKeyInfoType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 4, 9); + if(errn == 0) { + /* encode string as string table miss (+2 len)*/ + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen + 2)); + if (errn == 0) { + errn = encodeCharacters(stream, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType->ANY.charactersLen); + } + } + wcDone = 1; + grammarID = 70; } else { errn = EXI_ERROR_UNKOWN_EVENT; } break; - case 65: + case 71: /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT_GENERIC, CHARACTERS_GENERIC[STRING]] */ if (xmldsigKeyInfoType_KeyName_currArrayIndex < xmldsigKeyInfoType->KeyName.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 0); @@ -2294,37 +2822,37 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_KeyValue_currArrayIndex < xmldsigKeyInfoType->KeyValue.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 1); if(errn == 0) { errn = encode_xmldsigKeyValueType(stream, &xmldsigKeyInfoType->KeyValue.array [xmldsigKeyInfoType_KeyValue_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_RetrievalMethod_currArrayIndex < xmldsigKeyInfoType->RetrievalMethod.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 2); if(errn == 0) { errn = encode_xmldsigRetrievalMethodType(stream, &xmldsigKeyInfoType->RetrievalMethod.array [xmldsigKeyInfoType_RetrievalMethod_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_X509Data_currArrayIndex < xmldsigKeyInfoType->X509Data.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 3); if(errn == 0) { errn = encode_xmldsigX509DataType(stream, &xmldsigKeyInfoType->X509Data.array [xmldsigKeyInfoType_X509Data_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_PGPData_currArrayIndex < xmldsigKeyInfoType->PGPData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 4); if(errn == 0) { errn = encode_xmldsigPGPDataType(stream, &xmldsigKeyInfoType->PGPData.array [xmldsigKeyInfoType_PGPData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_SPKIData_currArrayIndex < xmldsigKeyInfoType->SPKIData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 5); if(errn == 0) { errn = encode_xmldsigSPKIDataType(stream, &xmldsigKeyInfoType->SPKIData.array [xmldsigKeyInfoType_SPKIData_currArrayIndex++]); } - grammarID = 64; + grammarID = 70; } else if (xmldsigKeyInfoType_MgmtData_currArrayIndex < xmldsigKeyInfoType->MgmtData.arrayLen ) { errn = encodeNBitUnsignedInteger(stream, 4, 6); if(errn == 0) { @@ -2341,346 +2869,21 @@ static int encode_xmldsigKeyInfoType(bitstream_t* stream, struct xmldsigKeyInfoT errn = encodeNBitUnsignedInteger(stream, 1, 0); } } - grammarID = 64; + grammarID = 70; } else if (1==0) { errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 64; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 65; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})', derivedBy='RESTRICTION'. */ -static int encode_xmldsigManifestType(bitstream_t* stream, struct xmldsigManifestType* xmldsigManifestType) { - int grammarID = 66; - int done = 0; - - unsigned int xmldsigManifestType_Reference_currArrayIndex = 0; - - while(!done) { - switch(grammarID) { - case 66: - /* FirstStartTag[ATTRIBUTE[STRING](Id), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - if ( xmldsigManifestType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); + grammarID = 70; + } else if ( xmldsigKeyInfoType->ANY_isUsed == 1u ) { + errn = encodeNBitUnsignedInteger(stream, 4, 8); if(errn == 0) { /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigManifestType->Id.charactersLen + 2)); + errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigKeyInfoType->ANY.charactersLen + 2)); if (errn == 0) { - errn = encodeCharacters(stream, xmldsigManifestType->Id.characters, xmldsigManifestType->Id.charactersLen); + errn = encodeCharacters(stream, xmldsigKeyInfoType->ANY.characters, xmldsigKeyInfoType->ANY.charactersLen); } } - grammarID = 67; - } else if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); - } - grammarID = 61; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 67: - /* StartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference)] */ - if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); - } - grammarID = 61; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 61: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), END_ELEMENT] */ - if (xmldsigManifestType_Reference_currArrayIndex < xmldsigManifestType->Reference.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - errn = encode_xmldsigReferenceType(stream, &xmldsigManifestType->Reference.array [xmldsigManifestType_Reference_currArrayIndex++]); - } - grammarID = 61; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType', base type name='base64Binary', content type='SIMPLE', isAbstract='false', hasTypeId='false', final='0', block='0', derivedBy='EXTENSION'. */ -static int encode_xmldsigSignatureValueType(bitstream_t* stream, struct xmldsigSignatureValueType* xmldsigSignatureValueType) { - int grammarID = 68; - int done = 0; - - - while(!done) { - switch(grammarID) { - case 68: - /* FirstStartTag[ATTRIBUTE[STRING](Id), CHARACTERS[BINARY_BASE64]] */ - if ( xmldsigSignatureValueType->Id_isUsed == 1u ) { - errn = encodeNBitUnsignedInteger(stream, 2, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->Id.charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigSignatureValueType->Id.characters, xmldsigSignatureValueType->Id.charactersLen); - } - } - grammarID = 69; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 2, 1); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->CONTENT.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytes, xmldsigSignatureValueType->CONTENT.bytesLen); - } - } - grammarID = 11; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 69: - /* StartTag[CHARACTERS[BINARY_BASE64]] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigSignatureValueType->CONTENT.bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigSignatureValueType->CONTENT.bytes, xmldsigSignatureValueType->CONTENT.bytesLen); - } - } - grammarID = 11; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 11: - /* Element[END_ELEMENT] */ - if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - done = 1; - } - grammarID = 3; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - default: - errn = EXI_ERROR_UNKOWN_GRAMMAR_ID; - break; - } - if(errn) { - done = 1; - } - } - return errn; -} - -/* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType', base type name='anyType', content type='ELEMENT', isAbstract='false', hasTypeId='false', final='0', block='0', particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}', derivedBy='RESTRICTION'. */ -static int encode_xmldsigX509DataType(bitstream_t* stream, struct xmldsigX509DataType* xmldsigX509DataType) { - int grammarID = 70; - int done = 0; - - unsigned int xmldsigX509DataType_X509IssuerSerial_currArrayIndex = 0; - unsigned int xmldsigX509DataType_X509SKI_currArrayIndex = 0; - unsigned int xmldsigX509DataType_X509SubjectName_currArrayIndex = 0; - unsigned int xmldsigX509DataType_X509Certificate_currArrayIndex = 0; - unsigned int xmldsigX509DataType_X509CRL_currArrayIndex = 0; - - while(!done) { - switch(grammarID) { - case 70: - /* FirstStartTag[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC] */ - if (xmldsigX509DataType_X509IssuerSerial_currArrayIndex < xmldsigX509DataType->X509IssuerSerial.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - errn = encode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array [xmldsigX509DataType_X509IssuerSerial_currArrayIndex++]); - } + wcDone = 1; grammarID = 71; - } else if (xmldsigX509DataType_X509SKI_currArrayIndex < xmldsigX509DataType->X509SKI.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytes, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen); - xmldsigX509DataType_X509SKI_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509SubjectName_currArrayIndex < xmldsigX509DataType->X509SubjectName.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].characters, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen); - xmldsigX509DataType_X509SubjectName_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509Certificate_currArrayIndex < xmldsigX509DataType->X509Certificate.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 3); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytes, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen); - xmldsigX509DataType_X509Certificate_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509CRL_currArrayIndex < xmldsigX509DataType->X509CRL.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 4); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytes, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen); - xmldsigX509DataType_X509CRL_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 71; - } else { - errn = EXI_ERROR_UNKOWN_EVENT; - } - break; - case 71: - /* Element[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT_GENERIC, END_ELEMENT] */ - if (xmldsigX509DataType_X509IssuerSerial_currArrayIndex < xmldsigX509DataType->X509IssuerSerial.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 0); - if(errn == 0) { - errn = encode_xmldsigX509IssuerSerialType(stream, &xmldsigX509DataType->X509IssuerSerial.array [xmldsigX509DataType_X509IssuerSerial_currArrayIndex++]); - } - grammarID = 71; - } else if (xmldsigX509DataType_X509SKI_currArrayIndex < xmldsigX509DataType->X509SKI.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 1); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytes, xmldsigX509DataType->X509SKI.array[xmldsigX509DataType_X509SKI_currArrayIndex].bytesLen); - xmldsigX509DataType_X509SKI_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509SubjectName_currArrayIndex < xmldsigX509DataType->X509SubjectName.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 2); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[STRING]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - /* encode string as string table miss (+2 len)*/ - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen + 2)); - if (errn == 0) { - errn = encodeCharacters(stream, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].characters, xmldsigX509DataType->X509SubjectName.array[xmldsigX509DataType_X509SubjectName_currArrayIndex].charactersLen); - xmldsigX509DataType_X509SubjectName_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509Certificate_currArrayIndex < xmldsigX509DataType->X509Certificate.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 3); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytes, xmldsigX509DataType->X509Certificate.array[xmldsigX509DataType_X509Certificate_currArrayIndex].bytesLen); - xmldsigX509DataType_X509Certificate_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (xmldsigX509DataType_X509CRL_currArrayIndex < xmldsigX509DataType->X509CRL.arrayLen ) { - errn = encodeNBitUnsignedInteger(stream, 3, 4); - if(errn == 0) { - /* First(xsi:type)StartTag[CHARACTERS[BINARY_BASE64]] */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - if(errn == 0) { - errn = encodeUnsignedInteger16(stream, (uint16_t)(xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen)); - if (errn == 0) { - errn = encodeBytes(stream, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytes, xmldsigX509DataType->X509CRL.array[xmldsigX509DataType_X509CRL_currArrayIndex].bytesLen); - xmldsigX509DataType_X509CRL_currArrayIndex++; - } - /* valid EE */ - errn = encodeNBitUnsignedInteger(stream, 1, 0); - } - } - grammarID = 71; - } else if (1==0) { - errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS; - grammarID = 71; - } else if (1==1) { - errn = encodeNBitUnsignedInteger(stream, 3, 6); - if(errn == 0) { - done = 1; - } - grammarID = 3; } else { errn = EXI_ERROR_UNKOWN_EVENT; } @@ -2889,12 +3092,12 @@ int encode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* ex return errn; } - + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES int encode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag) { errn = writeEXIHeader(stream); - if(errn == 0) { + if(errn == 0) { /* FragmentContent[START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}DigestValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Exponent), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}G), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}HMACOutputLength), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}J), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}KeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Manifest), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}MgmtData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Modulus), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Object), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}P), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyID), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PGPKeyPacket), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}PgenCounter), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Q), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RSAKeyValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Reference), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}RetrievalMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKIData), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SPKISexp), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Seed), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Signature), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureMethod), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperties), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureProperty), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignatureValue), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}SignedInfo), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transform), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Transforms), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509CRL), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Certificate), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509Data), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509IssuerSerial), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SKI), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SerialNumber), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}X509SubjectName), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}XPath), START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}Y), START_ELEMENT_GENERIC, END_DOCUMENT] */ if ( exiFrag->CanonicalizationMethod_isUsed == 1u ) { /* START_ELEMENT({http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod) */ @@ -3363,13 +3566,12 @@ int encode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex } else { errn = EXI_ERROR_UNKOWN_EVENT; } - } - if(errn == 0) { /* EndDocument */ errn = encodeNBitUnsignedInteger(stream, 6, 46); - } + } + if(errn == 0) { /* flush any pending bits */ @@ -3377,9 +3579,10 @@ int encode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* ex } return errn; -} +} #endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ + #endif /* DEPLOY_XMLDSIG_CODEC */ #endif diff --git a/src/xmldsig/xmldsigEXIDatatypesEncoder.h b/src/xmldsig/xmldsigEXIDatatypesEncoder.h index 61d57a3..62a2c63 100644 --- a/src/xmldsig/xmldsigEXIDatatypesEncoder.h +++ b/src/xmldsig/xmldsigEXIDatatypesEncoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Siemens AG + * Copyright (C) 2007-2017 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,8 +18,8 @@ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com - * @version 0.9.3 - * @contact Joerg.Heuer@siemens.com + * @version 2017-09-04 + * @contact Richard.Kuntschke@siemens.com * *

Code generated by EXIdizer

*

Schema: xmldsig-core-schema.xsd

@@ -51,10 +51,11 @@ extern "C" { int encode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* exiDoc); - + #if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES int encode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag); -#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ +#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */ + #endif /* DEPLOY_XMLDSIG_CODEC */